Bug 783574 - Remove useMethodJIT, it was not always updated correctly. r=dvander
authorJan de Mooij <jdemooij@mozilla.com>
Sat, 18 Aug 2012 10:01:24 +0200
changeset 104443 a6c1953435ee2c8fd897c9306f14cdba07abe0cf
parent 104442 d794f23798f43a54c58ae9f0340549b880977e07
child 104444 8dfc1dbac04b0d0c7d562d741acb6150f509b819
push id1245
push userjandemooij@gmail.com
push dateSat, 18 Aug 2012 08:01:51 +0000
reviewersdvander
bugs783574
milestone17.0a1
Bug 783574 - Remove useMethodJIT, it was not always updated correctly. r=dvander
js/src/jsinterp.cpp
--- a/js/src/jsinterp.cpp
+++ b/js/src/jsinterp.cpp
@@ -1165,50 +1165,33 @@ js::Interpret(JSContext *cx, StackFrame 
 # define ADD_EMPTY_CASE(OP) BEGIN_CASE(OP)
 # define END_EMPTY_CASES    goto advance_pc_by_one;
 
 #endif /* !JS_THREADED_INTERP */
 
 #define LOAD_DOUBLE(PCOFF, dbl)                                               \
     (dbl = script->getConst(GET_UINT32_INDEX(regs.pc + (PCOFF))).toDouble())
 
-#if defined(JS_METHODJIT)
-    bool useMethodJIT = false;
-#endif
-
 #ifdef JS_METHODJIT
 
-#define RESET_USE_METHODJIT()                                                 \
-    JS_BEGIN_MACRO                                                            \
-        useMethodJIT = cx->methodJitEnabled &&                                \
-           (interpMode == JSINTERP_NORMAL ||                                  \
-            interpMode == JSINTERP_REJOIN ||                                  \
-            interpMode == JSINTERP_SKIP_TRAP);                                \
-    JS_END_MACRO
-
 #define CHECK_PARTIAL_METHODJIT(status)                                       \
     JS_BEGIN_MACRO                                                            \
         switch (status) {                                                     \
           case mjit::Jaeger_UnfinishedAtTrap:                                 \
             interpMode = JSINTERP_SKIP_TRAP;                                  \
             /* FALLTHROUGH */                                                 \
           case mjit::Jaeger_Unfinished:                                       \
             op = (JSOp) *regs.pc;                                             \
             SET_SCRIPT(regs.fp()->script());                                  \
             if (cx->isExceptionPending())                                     \
                 goto error;                                                   \
             DO_OP();                                                          \
           default:;                                                           \
         }                                                                     \
     JS_END_MACRO
-
-#else
-
-#define RESET_USE_METHODJIT() ((void) 0)
-
 #endif
 
     /*
      * Prepare to call a user-supplied branch handler, and abort the script
      * if it returns false.
      */
 #define CHECK_BRANCH()                                                        \
     JS_BEGIN_MACRO                                                            \
@@ -1319,18 +1302,16 @@ js::Interpret(JSContext *cx, StackFrame 
             }
         }
     }
 
     /* The REJOIN mode acts like the normal mode, except the prologue is skipped. */
     if (interpMode == JSINTERP_REJOIN)
         interpMode = JSINTERP_NORMAL;
 
-    RESET_USE_METHODJIT();
-
     /*
      * It is important that "op" be initialized before calling DO_OP because
      * it is possible for "op" to be specially assigned during the normal
      * processing of an opcode while looping. We rely on DO_NEXT_OP to manage
      * "op" correctly in all other cases.
      */
     JSOp op;
     int32_t len;
@@ -1485,18 +1466,16 @@ END_CASE(JSOP_LABEL)
 
 check_backedge:
 {
     CHECK_BRANCH();
     if (op != JSOP_LOOPHEAD)
         DO_OP();
 
 #ifdef JS_METHODJIT
-    if (!useMethodJIT)
-        DO_OP();
     // Attempt on-stack replacement with JaegerMonkey code, which is keyed to
     // the interpreter state at the JSOP_LOOPHEAD at the start of the loop.
     // Unlike IonMonkey, this requires two different code fragments to perform
     // hoisting.
     mjit::CompileStatus status =
         mjit::CanMethodJIT(cx, script, regs.pc, regs.fp()->isConstructing(),
                            mjit::CompileRequest_Interpreter, regs.fp());
     if (status == mjit::Compile_Error)
@@ -1510,18 +1489,16 @@ check_backedge:
             goto error;
         CHECK_PARTIAL_METHODJIT(status);
         interpReturnOK = (status == mjit::Jaeger_Returned);
         if (entryFrame != regs.fp())
             goto jit_return;
         regs.fp()->setFinishedInInterpreter();
         goto leave_on_safe_point;
     }
-    if (status == mjit::Compile_Abort)
-        useMethodJIT = false;
 #endif /* JS_METHODJIT */
 
     DO_OP();
 }
 
 BEGIN_CASE(JSOP_LOOPENTRY)
 
 #ifdef JS_ION
@@ -1643,17 +1620,16 @@ BEGIN_CASE(JSOP_STOP)
 
         cx->stack.popInlineFrame(regs);
         SET_SCRIPT(regs.fp()->script());
 
         JS_ASSERT(*regs.pc == JSOP_NEW || *regs.pc == JSOP_CALL ||
                   *regs.pc == JSOP_FUNCALL || *regs.pc == JSOP_FUNAPPLY);
 
         /* Resume execution in the calling frame. */
-        RESET_USE_METHODJIT();
         if (JS_LIKELY(interpReturnOK)) {
             TypeScript::Monitor(cx, script, regs.pc, regs.sp[-1]);
 
             if (shiftResult) {
                 regs.sp[-2] = regs.sp[-1];
                 regs.sp--;
             }
 
@@ -2505,17 +2481,16 @@ BEGIN_CASE(JSOP_FUNCALL)
         JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CLEARED_SCOPE);
         goto error;
     }
 
     if (!cx->stack.pushInlineFrame(cx, regs, args, *fun, newScript, initial))
         goto error;
 
     SET_SCRIPT(regs.fp()->script());
-    RESET_USE_METHODJIT();
 
 #ifdef JS_ION
     if (!newType && ion::IsEnabled(cx)) {
         ion::MethodStatus status = ion::CanEnter(cx, script, regs.fp(), newType);
         if (status == ion::Method_Error)
             goto error;
         if (status == ion::Method_Compiled) {
             ion::IonExecStatus exec = ion::Cannon(cx, regs.fp());