Bug 910782 - SpiderMonkey: Simply uses of BRANCH. r=luke
authorDan Gohman <sunfish@google.com>
Wed, 04 Sep 2013 20:06:07 -0700
changeset 145623 6df80a4fdb06a24ba5b83c71d2e49731c7598e51
parent 145622 ebb5b0609fe601da56ea5500381f79d8fe7d8d85
child 145624 d09951d9e0c01f9c92890100b364ded52c1c328c
push id25216
push useremorley@mozilla.com
push dateThu, 05 Sep 2013 10:06:42 +0000
treeherdermozilla-central@676322e0166c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
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: Simply uses of BRANCH. r=luke
js/src/vm/Interpreter.cpp
--- a/js/src/vm/Interpreter.cpp
+++ b/js/src/vm/Interpreter.cpp
@@ -1298,19 +1298,20 @@ Interpret(JSContext *cx, RunState &state
 #define CHECK_BRANCH()                                                        \
     JS_BEGIN_MACRO                                                            \
         if (cx->runtime()->interrupt && !js_HandleExecutionInterrupt(cx))     \
             goto error;                                                       \
     JS_END_MACRO
 
 #define BRANCH(n)                                                             \
     JS_BEGIN_MACRO                                                            \
-        regs.pc += (n);                                                       \
+        int32_t nlen = (n);                                                   \
+        regs.pc += nlen;                                                      \
         op = (JSOp) *regs.pc;                                                 \
-        if ((n) <= 0)                                                         \
+        if (nlen <= 0)                                                        \
             goto check_backedge;                                              \
         DO_OP();                                                              \
     JS_END_MACRO
 
 #define SET_SCRIPT(s)                                                         \
     JS_BEGIN_MACRO                                                            \
         script = (s);                                                         \
         if (script->hasAnyBreakpointsOrStepMode() || script->hasScriptCounts) \
@@ -1700,57 +1701,51 @@ BEGIN_CASE(JSOP_STOP)
     goto exit;
 }
 
 BEGIN_CASE(JSOP_DEFAULT)
     regs.sp--;
     /* FALL THROUGH */
 BEGIN_CASE(JSOP_GOTO)
 {
-    len = GET_JUMP_OFFSET(regs.pc);
-    BRANCH(len);
+    BRANCH(GET_JUMP_OFFSET(regs.pc));
 }
-END_CASE(JSOP_GOTO)
 
 BEGIN_CASE(JSOP_IFEQ)
 {
     bool cond = ToBooleanOp(regs);
     regs.sp--;
-    if (cond == false) {
-        len = GET_JUMP_OFFSET(regs.pc);
-        BRANCH(len);
-    }
+    if (!cond)
+        BRANCH(GET_JUMP_OFFSET(regs.pc));
 }
 END_CASE(JSOP_IFEQ)
 
 BEGIN_CASE(JSOP_IFNE)
 {
     bool cond = ToBooleanOp(regs);
     regs.sp--;
-    if (cond != false) {
-        len = GET_JUMP_OFFSET(regs.pc);
-        BRANCH(len);
-    }
+    if (cond)
+        BRANCH(GET_JUMP_OFFSET(regs.pc));
 }
 END_CASE(JSOP_IFNE)
 
 BEGIN_CASE(JSOP_OR)
 {
     bool cond = ToBooleanOp(regs);
-    if (cond == true) {
+    if (cond) {
         len = GET_JUMP_OFFSET(regs.pc);
         goto advanceAndDoOp;
     }
 }
 END_CASE(JSOP_OR)
 
 BEGIN_CASE(JSOP_AND)
 {
     bool cond = ToBooleanOp(regs);
-    if (cond == false) {
+    if (!cond) {
         len = GET_JUMP_OFFSET(regs.pc);
         goto advanceAndDoOp;
     }
 }
 END_CASE(JSOP_AND)
 
 #define FETCH_ELEMENT_ID(n, id)                                               \
     JS_BEGIN_MACRO                                                            \
@@ -1761,18 +1756,17 @@ END_CASE(JSOP_AND)
 #define TRY_BRANCH_AFTER_COND(cond,spdec)                                     \
     JS_BEGIN_MACRO                                                            \
         JS_ASSERT(js_CodeSpec[op].length == 1);                               \
         unsigned diff_ = (unsigned) GET_UINT8(regs.pc) - (unsigned) JSOP_IFEQ;\
         if (diff_ <= 1) {                                                     \
             regs.sp -= (spdec);                                               \
             if ((cond) == (diff_ != 0)) {                                     \
                 ++regs.pc;                                                    \
-                len = GET_JUMP_OFFSET(regs.pc);                               \
-                BRANCH(len);                                                  \
+                BRANCH(GET_JUMP_OFFSET(regs.pc));                             \
             }                                                                 \
             len = 1 + JSOP_IFEQ_LENGTH;                                       \
             goto advanceAndDoOp;                                              \
         }                                                                     \
     JS_END_MACRO
 
 BEGIN_CASE(JSOP_IN)
 {
@@ -2007,18 +2001,17 @@ BEGIN_CASE(JSOP_STRICTNE)
 END_CASE(JSOP_STRICTNE)
 
 BEGIN_CASE(JSOP_CASE)
 {
     bool cond;
     STRICT_EQUALITY_OP(==, cond);
     if (cond) {
         regs.sp--;
-        len = GET_JUMP_OFFSET(regs.pc);
-        BRANCH(len);
+        BRANCH(GET_JUMP_OFFSET(regs.pc));
     }
 }
 END_CASE(JSOP_CASE)
 
 #undef STRICT_EQUALITY_OP
 
 BEGIN_CASE(JSOP_LT)
 {