Bug 774330: Don't unnecessarily prevent code from entering the JIT with SPS enabled. r=luke
authorAlex Crichton <acrichton@mozilla.com>
Mon, 16 Jul 2012 18:07:10 -0700
changeset 99507 36fcd6eabf67ce621c669b7edf8b75446333bd5e
parent 99506 02bffdc6ce7f01b5f7722c670dd91fc237d77d99
child 99508 dd08c10193c62abf525b3be5a3ecffbc6012c152
push id23135
push useremorley@mozilla.com
push dateTue, 17 Jul 2012 09:04:49 +0000
treeherdermozilla-central@ba8463beab13 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs774330
milestone17.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 774330: Don't unnecessarily prevent code from entering the JIT with SPS enabled. r=luke
js/src/methodjit/Compiler.cpp
--- a/js/src/methodjit/Compiler.cpp
+++ b/js/src/methodjit/Compiler.cpp
@@ -912,17 +912,23 @@ MakeJITScript(JSContext *cx, JSScript *s
 CompileStatus
 mjit::CanMethodJIT(JSContext *cx, JSScript *script, jsbytecode *pc,
                    bool construct, CompileRequest request, StackFrame *frame)
 {
   restart:
     if (!cx->methodJitEnabled)
         return Compile_Abort;
 
-    if (frame->hasPushedSPSFrame())
+    /*
+     * If an SPS frame has already been pushed and profiling has since been
+     * turned off, then we can't enter the jit because the epilogue of a pop
+     * will not be emitted. Otherwise, we're safe with respect to balancing the
+     * push/pops to the SPS sampling stack.
+     */
+    if (frame->hasPushedSPSFrame() && !cx->runtime->spsProfiler.enabled())
         return Compile_Skipped;
 
     if (script->hasJITInfo()) {
         JSScript::JITScriptHandle *jith = script->jitHandle(construct, cx->compartment->needsBarrier());
         if (jith->isUnjittable())
             return Compile_Abort;
     }