Bug 910782 - SpiderMonkey: Simplfy the END_CASE macros. r=terrence
authorDan Gohman <sunfish@google.com>
Mon, 02 Sep 2013 13:21:40 -0700
changeset 145243 14d93040175bd84f961d2910a2197d03c69cec63
parent 145242 3a23243301c90741d3cf9c310c731473cc566977
child 145244 8d55e506ea72c75e799ae3d994a6a79a802b3b90
push id25203
push useremorley@mozilla.com
push dateTue, 03 Sep 2013 11:11:23 +0000
treeherdermozilla-central@541ba36e8b9d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersterrence
bugs910782
milestone26.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 910782 - SpiderMonkey: Simplfy the END_CASE macros. r=terrence
js/src/vm/Interpreter.cpp
--- a/js/src/vm/Interpreter.cpp
+++ b/js/src/vm/Interpreter.cpp
@@ -1275,39 +1275,20 @@ Interpret(JSContext *cx, RunState &state
      * handler is added: setting switchMask to -1 will enable interrupts.
      */
     register int switchMask = 0;
     int switchOp;
 
 # define DO_OP()            goto do_op
 
 # define BEGIN_CASE(OP)     case OP:
-# define END_CASE(OP)       END_CASE_LEN(OP##_LENGTH)
-# define END_CASE_LEN(n)    END_CASE_LENX(n)
-# define END_CASE_LENX(n)   END_CASE_LEN##n
-
-/*
- * To share the code for all len == 1 cases we use the specialized label with
- * code that falls through to advanceAndDoOp: .
- */
-# define END_CASE_LEN1      goto advance_pc_by_one;
-# define END_CASE_LEN2      len = 2; goto advanceAndDoOp;
-# define END_CASE_LEN3      len = 3; goto advanceAndDoOp;
-# define END_CASE_LEN4      len = 4; goto advanceAndDoOp;
-# define END_CASE_LEN5      len = 5; goto advanceAndDoOp;
-# define END_CASE_LEN6      len = 6; goto advanceAndDoOp;
-# define END_CASE_LEN7      len = 7; goto advanceAndDoOp;
-# define END_CASE_LEN8      len = 8; goto advanceAndDoOp;
-# define END_CASE_LEN9      len = 9; goto advanceAndDoOp;
-# define END_CASE_LEN10     len = 10; goto advanceAndDoOp;
-# define END_CASE_LEN11     len = 11; goto advanceAndDoOp;
-# define END_CASE_LEN12     len = 12; goto advanceAndDoOp;
+# define END_CASE(OP)       len = OP##_LENGTH; goto advanceAndDoOp;
+
 # define END_VARLEN_CASE    goto advanceAndDoOp;
 # define ADD_EMPTY_CASE(OP) BEGIN_CASE(OP)
-# define END_EMPTY_CASES    goto advance_pc_by_one;
 
 #define LOAD_DOUBLE(PCOFF, dbl)                                               \
     (dbl = script->getConst(GET_UINT32_INDEX(regs.pc + (PCOFF))).toDouble())
 
     /*
      * Prepare to call a user-supplied branch handler, and abort the script
      * if it returns false.
      */
@@ -1426,22 +1407,17 @@ Interpret(JSContext *cx, RunState &state
      */
     JSOp op;
     int32_t len;
     len = 0;
 
     if (rt->profilingScripts || cx->runtime()->debugHooks.interruptHook)
         switchMask = -1; /* Enable interrupts. */
 
-    goto advanceAndDoOp;
-
     for (;;) {
-      advance_pc_by_one:
-        JS_ASSERT(js_CodeSpec[op].length == 1);
-        len = 1;
       advanceAndDoOp:
         js::gc::MaybeVerifyBarriers(cx);
         regs.pc += len;
         op = (JSOp) *regs.pc;
 
       do_op:
         CHECK_PCCOUNT_INTERRUPTS();
         switchOp = int(op) | switchMask;
@@ -1557,17 +1533,21 @@ ADD_EMPTY_CASE(JSOP_UNUSED209)
 ADD_EMPTY_CASE(JSOP_UNUSED210)
 ADD_EMPTY_CASE(JSOP_UNUSED219)
 ADD_EMPTY_CASE(JSOP_UNUSED220)
 ADD_EMPTY_CASE(JSOP_UNUSED221)
 ADD_EMPTY_CASE(JSOP_UNUSED222)
 ADD_EMPTY_CASE(JSOP_UNUSED223)
 ADD_EMPTY_CASE(JSOP_CONDSWITCH)
 ADD_EMPTY_CASE(JSOP_TRY)
-END_EMPTY_CASES
+{
+    JS_ASSERT(js_CodeSpec[op].length == 1);
+    len = 1;
+    goto advanceAndDoOp;
+}
 
 BEGIN_CASE(JSOP_LOOPHEAD)
 END_CASE(JSOP_LOOPHEAD)
 
 BEGIN_CASE(JSOP_LABEL)
 END_CASE(JSOP_LABEL)
 
 check_backedge: