Bug 829175 - Allow reentering JM code if Ion was compiled for a different OSR point, r=dvander.
☠☠ backed out by a2d8abdc82a3 ☠ ☠
authorBrian Hackett <bhackett1024@gmail.com>
Thu, 10 Jan 2013 14:18:40 -0700
changeset 118465 9095b0b49905fbfb0eeac08175c8f185332747f2
parent 118464 d932f2172ce2dbbea666c9612d78833ffcdcfba0
child 118466 9d5aa110926732040cde8833de469dcf95590358
push id24166
push userMs2ger@gmail.com
push dateFri, 11 Jan 2013 13:57:41 +0000
treeherdermozilla-central@63c4b0f66a0c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander
bugs829175
milestone21.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 829175 - Allow reentering JM code if Ion was compiled for a different OSR point, r=dvander.
js/src/methodjit/Compiler.cpp
--- a/js/src/methodjit/Compiler.cpp
+++ b/js/src/methodjit/Compiler.cpp
@@ -932,17 +932,17 @@ MakeJITScript(JSContext *cx, HandleScrip
         CrossChunkEdge &edge = jitEdges[i];
         edge.shimLabel = shimCode + (size_t) edge.shimLabel;
     }
 
     return jit;
 }
 
 static inline bool
-IonGetsFirstChance(JSContext *cx, JSScript *script, CompileRequest request)
+IonGetsFirstChance(JSContext *cx, JSScript *script, jsbytecode *pc, CompileRequest request)
 {
 #ifdef JS_ION
     if (!ion::IsEnabled(cx))
         return false;
 
     // If the script is not hot, use JM. recompileCheckHelper will insert a check
     // to trigger a recompile when the script becomes hot.
     if (script->getUseCount() < ion::js_IonOptions.usesBeforeCompile)
@@ -955,16 +955,21 @@ IonGetsFirstChance(JSContext *cx, JSScri
     // If there's no way this script is going to be Ion compiled, let JM take over.
     if (!script->canIonCompile())
         return false;
 
     // If we cannot enter Ion because bailouts are expected, let JM take over.
     if (script->hasIonScript() && script->ion->bailoutExpected())
         return false;
 
+    // If we cannot enter Ion because it was compiled for OSR at a different PC,
+    // let JM take over until the PC is reached.
+    if (script->hasIonScript() && pc && script->ionScript()->osrPc() != pc)
+        return false;
+
     // If ion compilation is pending or in progress on another thread, continue
     // using JM until that compilation finishes.
     if (script->ion == ION_COMPILING_SCRIPT)
         return false;
 
     return true;
 #endif
     return false;
@@ -993,17 +998,17 @@ mjit::CanMethodJIT(JSContext *cx, Handle
      * good to go. If, however, the two are different, then we cannot emit JIT
      * code because the instrumentation will be wrong one way or another.
      */
     if (frame->script() == script && pc != script->code) {
         if (frame->hasPushedSPSFrame() != cx->runtime->spsProfiler.enabled())
             return Compile_Skipped;
     }
 
-    if (IonGetsFirstChance(cx, script, request))
+    if (IonGetsFirstChance(cx, script, pc, request))
         return Compile_Skipped;
 
     if (script->hasMJITInfo()) {
         JSScript::JITScriptHandle *jith = script->jitHandle(construct, cx->compartment->compileBarriers());
         if (jith->isUnjittable())
             return Compile_Abort;
     }