Concurrent FTL causes !hasOptimizedReplacement() asserts in cti_optimize
[WebKit-https.git] / Source / JavaScriptCore / dfg / DFGToFTLDeferredCompilationCallback.cpp
index 1cb32d76a3646f0c8aa28b882cfeb10bd3cd9663..7770fd627ebebfaaff8bb50ff35261576511fb1e 100644 (file)
@@ -70,6 +70,15 @@ void ToFTLDeferredCompilationCallback::compilationDidComplete(
             ") result: ", result, "\n");
     }
     
             ") result: ", result, "\n");
     }
     
+    if (m_dfgCodeBlock->replacement() != m_dfgCodeBlock) {
+        if (Options::verboseOSR()) {
+            dataLog(
+                "Dropping FTL code block ", *codeBlock, " on the floor because the "
+                "DFG code block ", *m_dfgCodeBlock, " was jettisoned.\n");
+        }
+        return;
+    }
+    
     if (result == CompilationSuccessful)
         codeBlock->install();
     
     if (result == CompilationSuccessful)
         codeBlock->install();