Bug 1299108 - IonMonkey - Make sure we don't compile the same script twice at the same time, r=jandem a=ritu
authorHannes Verschore <hv1989@gmail.com>
Mon, 10 Oct 2016 13:53:35 -0700
changeset 428774 29d25f5224ad918470c049f1991628853e1831cd
parent 428773 b35318b86b335200340aad6893828b99c187ad84
child 428775 6b1a3f769aa6d826bd404750e7af66702ff01214
push id33416
push userpaul@paul.cx
push dateMon, 24 Oct 2016 16:26:20 +0000
reviewersjandem, ritu
bugs1299108
milestone50.0
Bug 1299108 - IonMonkey - Make sure we don't compile the same script twice at the same time, r=jandem a=ritu
js/src/jit/Ion.cpp
--- a/js/src/jit/Ion.cpp
+++ b/js/src/jit/Ion.cpp
@@ -2560,16 +2560,21 @@ jit::CanEnter(JSContext* cx, RunState& s
     // If --ion-eager is used, compile with Baseline first, so that we
     // can directly enter IonMonkey.
     if (JitOptions.eagerCompilation && !rscript->hasBaselineScript()) {
         MethodStatus status = CanEnterBaselineMethod(cx, state);
         if (status != Method_Compiled)
             return status;
     }
 
+    // Skip if the script is being compiled off thread (again).
+    // The above lines (invoke) could have started an ion compilation.
+    if (rscript->isIonCompilingOffThread())
+        return Method_Skipped;
+
     // Attempt compilation. Returns Method_Compiled if already compiled.
     bool constructing = state.isInvoke() && state.asInvoke()->constructing();
     MethodStatus status = Compile(cx, rscript, nullptr, nullptr, constructing);
     if (status != Method_Compiled) {
         if (status == Method_CantCompile)
             ForbidCompilation(cx, rscript);
         return status;
     }