Bug 1002797 - Cancel off-thread Ion compilation when doing debug mode OSR. (r=jandem)
authorShu-yu Guo <shu@rfrn.org>
Tue, 29 Apr 2014 21:57:36 -0700
changeset 181341 0112ac69a293df106443627dff31f8b367f5af03
parent 181340 c3c7a4b24fbe186c86e218da6b96219246f77f95
child 181342 ef50feec881a82d7ad3a195734dba9f389088734
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersjandem
bugs1002797
milestone32.0a1
Bug 1002797 - Cancel off-thread Ion compilation when doing debug mode OSR. (r=jandem)
js/src/jit-test/tests/debug/bug1002797.js
js/src/jit/BaselineDebugModeOSR.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/debug/bug1002797.js
@@ -0,0 +1,15 @@
+var lfcode = new Array();
+lfcode.push("");
+lfcode.push("0");
+lfcode.push("newGlobal(\"1\").eval(\"(new Debugger).addAllGlobalsAsDebuggees();\");\n");
+while (true) {
+    var file = lfcode.shift(); if (file == undefined) { break; }
+    loadFile(file)
+}
+function loadFile(lfVarx) {
+    try {
+      if (lfVarx.substr(-3) != ".js" && lfVarx.length != 1) {
+        evaluate(lfVarx); 
+      } else if (!isNaN(lfVarx)) {}
+    } catch (lfVare) {    }
+}
--- a/js/src/jit/BaselineDebugModeOSR.cpp
+++ b/js/src/jit/BaselineDebugModeOSR.cpp
@@ -408,16 +408,18 @@ RecompileBaselineScriptForDebugMode(JSCo
     // been recompiled.
     bool expectedDebugMode = cx->compartment()->debugMode();
     if (oldBaselineScript->debugMode() == expectedDebugMode)
         return true;
 
     IonSpew(IonSpew_BaselineDebugModeOSR, "Recompiling (%s:%d) for debug mode %s",
             script->filename(), script->lineno(), expectedDebugMode ? "ON" : "OFF");
 
+    CancelOffThreadIonCompile(cx->compartment(), script);
+
     if (script->hasIonScript())
         Invalidate(cx, script, /* resetUses = */ false);
 
     script->setBaselineScript(cx, nullptr);
 
     MethodStatus status = BaselineCompile(cx, script);
     if (status != Method_Compiled) {
         // We will only fail to recompile for debug mode due to OOM. Restore