Respect ION_DISABLED_SCRIPT in CanEnterAtBranch(). (Bug 715481, r=dvander)
authorSean Stangl <sstangl@mozilla.com>
Thu, 05 Jan 2012 13:04:57 -0800
changeset 112381 acfa9cd41bcb1d8fce22e95d25699cebb4371605
parent 112380 e603054dd5d671394478d24d21fae5e92412b477
child 112382 cfc7bfe1eb7d4a5859ee6b4d45ad0125c954461a
push id239
push userakeybl@mozilla.com
push dateThu, 03 Jan 2013 21:54:43 +0000
treeherdermozilla-release@3a7b66445659 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander
bugs715481
milestone12.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
Respect ION_DISABLED_SCRIPT in CanEnterAtBranch(). (Bug 715481, r=dvander)
js/src/ion/Ion.cpp
--- a/js/src/ion/Ion.cpp
+++ b/js/src/ion/Ion.cpp
@@ -769,26 +769,27 @@ CheckFrame(StackFrame *fp)
 // Decide if a transition from interpreter execution to Ion code should occur.
 // May compile or recompile the target JSScript.
 MethodStatus
 ion::CanEnterAtBranch(JSContext *cx, JSScript *script, StackFrame *fp, jsbytecode *pc)
 {
     JS_ASSERT(ion::IsEnabled());
     JS_ASSERT((JSOp)*pc == JSOP_LOOPHEAD);
 
-    // Optionally ignore on user request.
-    if (!js_IonOptions.osr)
+    // Skip if the script has been disabled.
+    if (script->ion == ION_DISABLED_SCRIPT)
         return Method_Skipped;
 
     // Ignore OSR if the code is expected to result in a bailout.
-    if (script->ion && script->ion != ION_DISABLED_SCRIPT &&
-        script->ion->isOsrForbidden())
-    {
+    if (script->ion && script->ion->isOsrForbidden())
         return Method_Skipped;
-    }
+
+    // Optionally ignore on user request.
+    if (!js_IonOptions.osr)
+        return Method_Skipped;
 
     // Attempt compilation. Returns Method_Compiled if already compiled.
     MethodStatus status = Compile(cx, script, fp, pc);
     if (status != Method_Compiled)
         return status;
 
     if (script->ion->osrPc() != pc)
         return Method_Skipped;
@@ -797,35 +798,42 @@ ion::CanEnterAtBranch(JSContext *cx, JSS
 }
 
 MethodStatus
 ion::Compile(JSContext *cx, JSScript *script, js::StackFrame *fp, jsbytecode *osrPc)
 {
     JS_ASSERT(ion::IsEnabled());
     JS_ASSERT_IF(osrPc != NULL, (JSOp)*osrPc == JSOP_LOOPHEAD);
 
+
+    if (script->ion == ION_DISABLED_SCRIPT)
+        return Method_CantCompile;
+
     if (cx->compartment->debugMode()) {
         IonSpew(IonSpew_Abort, "debugging");
         return Method_CantCompile;
     }
 
-    if (!CheckFrame(fp))
+    if (!CheckFrame(fp)) {
+        JS_ASSERT(script->ion != ION_DISABLED_SCRIPT);
+        script->ion = ION_DISABLED_SCRIPT;
         return Method_CantCompile;
+    }
 
     if (script->ion) {
-        if (script->ion == ION_DISABLED_SCRIPT || !script->ion->method())
+        if (!script->ion->method())
             return Method_CantCompile;
-
         return Method_Compiled;
     }
 
     if (script->incUseCount() <= js_IonOptions.invokesBeforeCompile)
         return Method_Skipped;
 
     if (!IonCompile(cx, script, fp, osrPc)) {
+        JS_ASSERT(script->ion != ION_DISABLED_SCRIPT);
         script->ion = ION_DISABLED_SCRIPT;
         return Method_CantCompile;
     }
 
     return Method_Compiled;
 }
 
 // Function pointer to call from EnterIon().