Bug 774330: Don't unnecessarily prevent code from entering the JIT with SPS enabled. r=luke a=lsblakk
authorAlex Crichton <acrichton@mozilla.com>
Mon, 16 Jul 2012 18:07:10 -0700
changeset 102145 c5081fdf23e0109defa5dc4d47324642c2c9488d
parent 102144 0565f384e382fb4d0822b57cee5dcf7824714f20
child 102146 5527cad8832793e015ac900580f0d58899009d2d
push id1742
push usereakhgari@mozilla.com
push dateThu, 19 Jul 2012 18:11:39 +0000
treeherdermozilla-aurora@c5081fdf23e0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke, lsblakk
bugs774330
milestone16.0a2
Bug 774330: Don't unnecessarily prevent code from entering the JIT with SPS enabled. r=luke a=lsblakk
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;
     }