Bug 633929 - Fix --disable-methodjit (r=dvander)
authorBill McCloskey <wmccloskey@mozilla.com>
Tue, 15 Feb 2011 11:51:05 -0800
changeset 62777 b84a3c09482d1245b0220d3d4164a5124f3566cf
parent 62604 d3bcd1655cc59a964b86b3646eb7c1161e1136e4
child 62778 b7066265d596ea431d03ac2bbf50ad5820dcef40
push idunknown
push userunknown
push dateunknown
reviewersdvander
bugs633929
milestone2.0b12pre
Bug 633929 - Fix --disable-methodjit (r=dvander)
js/src/jsinterp.cpp
--- a/js/src/jsinterp.cpp
+++ b/js/src/jsinterp.cpp
@@ -2322,18 +2322,22 @@ Interpret(JSContext *cx, JSStackFrame *e
     (obj = script->getObject(GET_FULL_INDEX(PCOFF)))
 
 #define LOAD_FUNCTION(PCOFF)                                                  \
     (fun = script->getFunction(GET_FULL_INDEX(PCOFF)))
 
 #define LOAD_DOUBLE(PCOFF, dbl)                                               \
     (dbl = script->getConst(GET_FULL_INDEX(PCOFF)).toDouble())
 
-    bool methodJitFailed = false;
-    
+#ifdef JS_METHODJIT
+    bool useMethodJIT = cx->methodJitEnabled && interpMode == JSINTERP_NORMAL;
+#else
+    bool useMethodJIT = false;
+#endif
+
 #ifdef JS_METHODJIT
 
 #define MONITOR_BRANCH_METHODJIT()                                            \
     JS_BEGIN_MACRO                                                            \
         mjit::CompileStatus status =                                          \
             mjit::CanMethodJITAtBranch(cx, script, regs.fp, regs.pc);         \
         if (status == mjit::Compile_Error)                                    \
             goto error;                                                       \
@@ -2341,17 +2345,17 @@ Interpret(JSContext *cx, JSStackFrame *e
             void *ncode =                                                     \
                 script->nativeCodeForPC(regs.fp->isConstructing(), regs.pc);  \
             interpReturnOK = mjit::JaegerShotAtSafePoint(cx, ncode);          \
             if (inlineCallCount)                                              \
                 goto jit_return;                                              \
             goto leave_on_safe_point;                                         \
         }                                                                     \
         if (status == mjit::Compile_Abort) {                                  \
-            methodJitFailed = true;                                           \
+            useMethodJIT = false;                                             \
         }                                                                     \
     JS_END_MACRO
 
 #else
 
 #define MONITOR_BRANCH_METHODJIT() ((void) 0)
 
 #endif
@@ -2383,22 +2387,17 @@ Interpret(JSContext *cx, JSStackFrame *e
         JS_ASSERT(cx->regs == &regs);                                         \
         if (cx->isExceptionPending())                                         \
             goto error;                                                       \
     JS_END_MACRO
 
 #define MONITOR_BRANCH()                                                      \
     JS_BEGIN_MACRO                                                            \
         if (TRACING_ENABLED(cx)) {                                            \
-            if (!TRACE_RECORDER(cx) &&                                        \
-                !TRACE_PROFILER(cx) &&                                        \
-                interpMode == JSINTERP_NORMAL &&                              \
-                cx->methodJitEnabled &&                                       \
-                !methodJitFailed)                                             \
-            {                                                                 \
+            if (!TRACE_RECORDER(cx) && !TRACE_PROFILER(cx) && useMethodJIT) { \
                 MONITOR_BRANCH_METHODJIT();                                   \
             } else {                                                          \
                 MonitorResult r = MonitorLoopEdge(cx, inlineCallCount, interpMode); \
                 if (r == MONITOR_RECORDING) {                                 \
                     JS_ASSERT(TRACE_RECORDER(cx));                            \
                     JS_ASSERT(!TRACE_PROFILER(cx));                           \
                     MONITOR_BRANCH_TRACEVIS;                                  \
                     ENABLE_INTERRUPTS();                                      \