Bug 1099224 - Fix cancelling off-thread Ion compiles for scripts going through debug mode OSR. (r=h4writer)
authorShu-yu Guo <shu@rfrn.org>
Fri, 14 Nov 2014 16:28:29 -0800
changeset 215874 ca6516a8ca1d5dcb13d9bab74f4dc3ea51ea4f7d
parent 215873 6b81753950778d82e9b71142f44aef23c6f234f3
child 215875 a083cd9a7c8c645b4afe483871cf9f33ebe8cac7
push id27829
push usergszorc@mozilla.com
push dateSat, 15 Nov 2014 22:34:49 +0000
treeherderautoland@19f75e1211e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersh4writer
bugs1099224
milestone36.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 1099224 - Fix cancelling off-thread Ion compiles for scripts going through debug mode OSR. (r=h4writer)
js/src/jit/BaselineDebugModeOSR.cpp
--- a/js/src/jit/BaselineDebugModeOSR.cpp
+++ b/js/src/jit/BaselineDebugModeOSR.cpp
@@ -699,22 +699,36 @@ CloneOldBaselineStub(JSContext *cx, Debu
 }
 
 static bool
 InvalidateScriptsInZone(JSContext *cx, Zone *zone, const Vector<DebugModeOSREntry> &entries)
 {
     types::RecompileInfoVector invalid;
     for (UniqueScriptOSREntryIter iter(entries); !iter.done(); ++iter) {
         JSScript *script = iter.entry().script;
-        if (script->hasIonScript() && script->compartment()->zone() == zone) {
+        if (script->compartment()->zone() != zone)
+            continue;
+
+        if (script->hasIonScript()) {
             if (!invalid.append(script->ionScript()->recompileInfo()))
                 return false;
         }
+
+        // Cancel off-thread Ion compile for anything that has a
+        // BaselineScript. If we relied on the call to Invalidate below to
+        // cancel off-thread Ion compiles, only those with existing IonScripts
+        // would be cancelled.
+        if (script->hasBaselineScript())
+            CancelOffThreadIonCompile(script->compartment(), script);
     }
-    Invalidate(zone->types, cx->runtime()->defaultFreeOp(), invalid);
+
+    // No need to cancel off-thread Ion compiles again, we already did it
+    // above.
+    Invalidate(zone->types, cx->runtime()->defaultFreeOp(), invalid,
+               /* resetUses = */ true, /* cancelOffThread = */ false);
     return true;
 }
 
 static void
 UndoRecompileBaselineScriptsForDebugMode(JSContext *cx,
                                          const DebugModeOSREntryVector &entries)
 {
     // In case of failure, roll back the entire set of active scripts so that