<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[278082] trunk/Source/JavaScriptCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/278082">278082</a></dd>
<dt>Author</dt> <dd>tzagallo@apple.com</dd>
<dt>Date</dt> <dd>2021-05-26 08:15:22 -0700 (Wed, 26 May 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge all the JIT worklists into a shared worklist
https://bugs.webkit.org/show_bug.cgi?id=226207

Reviewed by Saam Barati.

Delete the DFG and FTL worklists and refactor JITWorklist to handle the compilation
for all tiers. This reduces the total number of compiler threads while allowing each
tier to use more threads whenever necessary. The default configuration is for the
worklist to have 3 threads, baseline can use up to all 3 threads and DFG and FTL follow
the previous limits set through JSC::Options. Right now, the worklist will only do work
on upper tiers when all lower tiers have no pending tasks or have exceeded the maximum
number of concurrent compilations. i.e. by default we only DFG compile when there are
no baseline tasks in the queue and we only FTL compile when we either have no DFG tasks
in the queue OR there are already 2 DFG compilations in progress.

* API/JSVirtualMachine.mm:
(+[JSVirtualMachine setNumberOfDFGCompilerThreads:]):
(+[JSVirtualMachine setNumberOfFTLCompilerThreads:]):
* API/tests/testapi.mm:
(runJITThreadLimitTests):
* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Sources.txt:
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::checkIfOptimizationThresholdReached):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):
* dfg/DFGCommon.h:
(JSC::DFG::verboseCompilationEnabled):
(JSC::DFG::logCompilationChanges):
(JSC::DFG::shouldDumpGraphAtEachPhase):
(JSC::DFG::shouldDumpDisassembly):
* dfg/DFGDriver.cpp:
(JSC::DFG::compileImpl):
(JSC::DFG::compile):
* dfg/DFGDriver.h:
* dfg/DFGGraph.h:
* dfg/DFGGraphSafepoint.h:
* dfg/DFGOSRAvailabilityAnalysisPhase.cpp:
(JSC::DFG::OSRAvailabilityAnalysisPhase::run):
* dfg/DFGOSREntrypointCreationPhase.cpp:
(JSC::DFG::OSREntrypointCreationPhase::run):
* dfg/DFGOperations.cpp:
(JSC::DFG::triggerFTLReplacementCompile):
(JSC::DFG::tierUpCommon):
* dfg/DFGPlan.cpp:
(JSC::DFG::Plan::Plan):
(JSC::DFG::Plan::codeSize const):
(JSC::DFG::Plan::finalizeInGC):
(JSC::DFG::Plan::notifyReady):
(JSC::DFG::Plan::cancel):
(JSC::DFG::Plan::compileInThreadImpl):
(JSC::DFG::Plan::finalize):
(JSC::DFG::Plan::iterateCodeBlocksForGC):
(JSC::DFG::Plan::checkLivenessAndVisitChildren):
(JSC::DFG::Plan::isKnownToBeLiveDuringGC):
(JSC::DFG::Plan::isKnownToBeLiveAfterGC):
* dfg/DFGPlan.h:
* dfg/DFGPlanInlines.h: Removed.
* dfg/DFGTierUpCheckInjectionPhase.cpp:
(JSC::DFG::TierUpCheckInjectionPhase::run):
* dfg/DFGWorklist.cpp: Removed.
* dfg/DFGWorklist.h: Removed.
* dfg/DFGWorklistInlines.h: Removed.
* ftl/FTLCompile.h:
* ftl/FTLLink.cpp:
(JSC::FTL::link):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::lower):
(JSC::FTL::DFG::LowerDFGToB3::buildExitArguments):
* ftl/FTLState.cpp:
(JSC::FTL::State::State):
* ftl/FTLState.h:
(JSC::FTL::verboseCompilationEnabled):
(JSC::FTL::shouldDumpDisassembly):
* heap/Heap.cpp:
(JSC::Heap::completeAllJITPlans):
(JSC::Heap::iterateExecutingAndCompilingCodeBlocks):
(JSC::Heap::removeDeadCompilerWorklistEntries):
(JSC::Heap::stopThePeriphery):
(JSC::Heap::suspendCompilerThreads):
(JSC::Heap::resumeCompilerThreads):
(JSC::Heap::addCoreConstraints):
* heap/Heap.h:
* heap/RootMarkReason.h:
* jit/JIT.cpp:
(JSC::JIT::compileAndLinkWithoutFinalizing):
(JSC::JIT::codeSize const):
(JSC::JIT::compileTimeStats):
* jit/JIT.h:
* jit/JITBaselinePlan.cpp: Copied from Source/JavaScriptCore/ftl/FTLState.cpp.
(JSC::JITBaselinePlan::JITBaselinePlan):
(JSC::JITBaselinePlan::compileInThreadImpl):
(JSC::JITBaselinePlan::codeSize const):
(JSC::JITBaselinePlan::finalize):
* jit/JITBaselinePlan.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h.
* jit/JITCompilationKey.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.cpp.
(JSC::JITCompilationKey::dump const):
* jit/JITCompilationKey.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.h.
(JSC::JITCompilationKey::JITCompilationKey):
(JSC::JITCompilationKey::operator! const):
(JSC::JITCompilationKey::isHashTableDeletedValue const):
(JSC::JITCompilationKey::mode const):
(JSC::JITCompilationKey::operator== const):
(JSC::JITCompilationKey::hash const):
(JSC::JITCompilationKeyHash::hash):
(JSC::JITCompilationKeyHash::equal):
* jit/JITCompilationMode.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.cpp.
(WTF::printInternal):
* jit/JITCompilationMode.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.h.
(JSC::isFTL):
* jit/JITOperations.cpp:
(JSC::JSC_DEFINE_JIT_OPERATION):
* jit/JITPlan.cpp: Added.
(JSC::JITPlan::JITPlan):
(JSC::JITPlan::cancel):
(JSC::JITPlan::notifyCompiling):
(JSC::JITPlan::notifyReady):
(JSC::JITPlan::tier const):
(JSC::JITPlan::key):
(JSC::JITPlan::isKnownToBeLiveAfterGC):
(JSC::JITPlan::isKnownToBeLiveDuringGC):
(JSC::JITPlan::iterateCodeBlocksForGC):
(JSC::JITPlan::checkLivenessAndVisitChildren):
(JSC::JITPlan::computeCompileTimes const):
(JSC::JITPlan::reportCompileTimes const):
(JSC::JITPlan::compileInThread):
* jit/JITPlan.h: Added.
(JSC::JITPlan::~JITPlan):
(JSC::JITPlan::vm const):
(JSC::JITPlan::codeBlock const):
(JSC::JITPlan::thread const):
(JSC::JITPlan::mode const):
(JSC::JITPlan::stage const):
(JSC::JITPlan::isFTL const):
(JSC::JITPlan::finalizeInGC):
* jit/JITPlanStage.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.cpp.
* jit/JITSafepoint.cpp: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.cpp.
(JSC::Safepoint::Safepoint):
(JSC::Safepoint::~Safepoint):
(JSC::Safepoint::begin):
(JSC::Safepoint::cancel):
* jit/JITSafepoint.h: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.h.
* jit/JITScannable.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h.
* jit/JITWorklist.cpp:
(JSC::JITWorklist::JITWorklist):
(JSC::JITWorklist::~JITWorklist):
(JSC::JITWorklist::existingGlobalWorklistOrNull):
(JSC::JITWorklist::ensureGlobalWorklist):
(JSC::JITWorklist::enqueue):
(JSC::JITWorklist::queueLength const):
(JSC::JITWorklist::suspendAllThreads):
(JSC::JITWorklist::resumeAllThreads):
(JSC::JITWorklist::compilationState):
(JSC::JITWorklist::completeAllReadyPlansForVM):
(JSC::JITWorklist::waitUntilAllPlansForVMAreReady):
(JSC::JITWorklist::completeAllPlansForVM):
(JSC::JITWorklist::cancelAllPlansForVM):
(JSC::JITWorklist::removeDeadPlans):
(JSC::JITWorklist::setMaximumNumberOfConcurrentDFGCompilations):
(JSC::JITWorklist::setMaximumNumberOfConcurrentFTLCompilations):
(JSC::JITWorklist::visitWeakReferences):
(JSC::JITWorklist::dump const):
(JSC::JITWorklist::removeAllReadyPlansForVM):
(JSC::JITWorklist::removeMatchingPlansForVM):
* jit/JITWorklist.h:
(JSC::JITWorklist::static_cast<size_t>):
* jit/JITWorklistInlines.h: Renamed from Source/JavaScriptCore/dfg/DFGScannable.h.
(JSC::JITWorklist::iterateCodeBlocksForGC):
* jit/JITWorklistThread.cpp: Added.
(JSC::JITWorklistThread::JITWorklistThread):
(JSC::JITWorklistThread::name const):
(JSC::JITWorklistThread::poll):
(JSC::JITWorklistThread::work):
(JSC::JITWorklistThread::threadDidStart):
(JSC::JITWorklistThread::threadIsStopping):
* jit/JITWorklistThread.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.h.
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::jitCompileAndSetHeuristics):
* runtime/OptionsList.h:
* runtime/VM.cpp:
(JSC::VM::~VM):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreAPIJSVirtualMachinemm">trunk/Source/JavaScriptCore/API/JSVirtualMachine.mm</a></li>
<li><a href="#trunkSourceJavaScriptCoreAPIteststestapimm">trunk/Source/JavaScriptCore/API/tests/testapi.mm</a></li>
<li><a href="#trunkSourceJavaScriptCoreCMakeListstxt">trunk/Source/JavaScriptCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj">trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceJavaScriptCoreSourcestxt">trunk/Source/JavaScriptCore/Sources.txt</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeCodeBlockcpp">trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGByteCodeParsercpp">trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGCommonh">trunk/Source/JavaScriptCore/dfg/DFGCommon.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGDrivercpp">trunk/Source/JavaScriptCore/dfg/DFGDriver.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGDriverh">trunk/Source/JavaScriptCore/dfg/DFGDriver.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGGraphh">trunk/Source/JavaScriptCore/dfg/DFGGraph.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGGraphSafepointh">trunk/Source/JavaScriptCore/dfg/DFGGraphSafepoint.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGOSRAvailabilityAnalysisPhasecpp">trunk/Source/JavaScriptCore/dfg/DFGOSRAvailabilityAnalysisPhase.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGOSREntrypointCreationPhasecpp">trunk/Source/JavaScriptCore/dfg/DFGOSREntrypointCreationPhase.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGOperationscpp">trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGPlancpp">trunk/Source/JavaScriptCore/dfg/DFGPlan.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGPlanh">trunk/Source/JavaScriptCore/dfg/DFGPlan.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGTierUpCheckInjectionPhasecpp">trunk/Source/JavaScriptCore/dfg/DFGTierUpCheckInjectionPhase.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLCompileh">trunk/Source/JavaScriptCore/ftl/FTLCompile.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLLinkcpp">trunk/Source/JavaScriptCore/ftl/FTLLink.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLLowerDFGToB3cpp">trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLStatecpp">trunk/Source/JavaScriptCore/ftl/FTLState.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLStateh">trunk/Source/JavaScriptCore/ftl/FTLState.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapHeapcpp">trunk/Source/JavaScriptCore/heap/Heap.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapHeaph">trunk/Source/JavaScriptCore/heap/Heap.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapRootMarkReasonh">trunk/Source/JavaScriptCore/heap/RootMarkReason.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITcpp">trunk/Source/JavaScriptCore/jit/JIT.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITh">trunk/Source/JavaScriptCore/jit/JIT.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITOperationscpp">trunk/Source/JavaScriptCore/jit/JITOperations.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITWorklistcpp">trunk/Source/JavaScriptCore/jit/JITWorklist.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITWorklisth">trunk/Source/JavaScriptCore/jit/JITWorklist.h</a></li>
<li><a href="#trunkSourceJavaScriptCorellintLLIntSlowPathscpp">trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeOptionsListh">trunk/Source/JavaScriptCore/runtime/OptionsList.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeVMcpp">trunk/Source/JavaScriptCore/runtime/VM.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCorejitBaselineJITPlancpp">trunk/Source/JavaScriptCore/jit/BaselineJITPlan.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitBaselineJITPlanh">trunk/Source/JavaScriptCore/jit/BaselineJITPlan.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITCompilationKeycpp">trunk/Source/JavaScriptCore/jit/JITCompilationKey.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITCompilationKeyh">trunk/Source/JavaScriptCore/jit/JITCompilationKey.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITCompilationModecpp">trunk/Source/JavaScriptCore/jit/JITCompilationMode.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITCompilationModeh">trunk/Source/JavaScriptCore/jit/JITCompilationMode.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITPlancpp">trunk/Source/JavaScriptCore/jit/JITPlan.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITPlanh">trunk/Source/JavaScriptCore/jit/JITPlan.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITPlanStageh">trunk/Source/JavaScriptCore/jit/JITPlanStage.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITSafepointcpp">trunk/Source/JavaScriptCore/jit/JITSafepoint.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITSafepointh">trunk/Source/JavaScriptCore/jit/JITSafepoint.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITScannableh">trunk/Source/JavaScriptCore/jit/JITScannable.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITWorklistInlinesh">trunk/Source/JavaScriptCore/jit/JITWorklistInlines.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITWorklistThreadcpp">trunk/Source/JavaScriptCore/jit/JITWorklistThread.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITWorklistThreadh">trunk/Source/JavaScriptCore/jit/JITWorklistThread.h</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoredfgDFGCompilationKeycpp">trunk/Source/JavaScriptCore/dfg/DFGCompilationKey.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGCompilationKeyh">trunk/Source/JavaScriptCore/dfg/DFGCompilationKey.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGCompilationModecpp">trunk/Source/JavaScriptCore/dfg/DFGCompilationMode.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGCompilationModeh">trunk/Source/JavaScriptCore/dfg/DFGCompilationMode.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGPlanInlinesh">trunk/Source/JavaScriptCore/dfg/DFGPlanInlines.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGSafepointcpp">trunk/Source/JavaScriptCore/dfg/DFGSafepoint.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGSafepointh">trunk/Source/JavaScriptCore/dfg/DFGSafepoint.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGScannableh">trunk/Source/JavaScriptCore/dfg/DFGScannable.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGThreadDatacpp">trunk/Source/JavaScriptCore/dfg/DFGThreadData.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGThreadDatah">trunk/Source/JavaScriptCore/dfg/DFGThreadData.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGWorklistcpp">trunk/Source/JavaScriptCore/dfg/DFGWorklist.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGWorklisth">trunk/Source/JavaScriptCore/dfg/DFGWorklist.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGWorklistInlinesh">trunk/Source/JavaScriptCore/dfg/DFGWorklistInlines.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreAPIJSVirtualMachinemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/API/JSVirtualMachine.mm (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/API/JSVirtualMachine.mm      2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/API/JSVirtualMachine.mm 2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -30,7 +30,7 @@
</span><span class="cx"> #if JSC_OBJC_API_ENABLED
</span><span class="cx"> 
</span><span class="cx"> #import "APICast.h"
</span><del>-#import "DFGWorklist.h"
</del><ins>+#import "JITWorklist.h"
</ins><span class="cx"> #import "JSManagedValueInternal.h"
</span><span class="cx"> #import "JSVirtualMachineInternal.h"
</span><span class="cx"> #import "JSVirtualMachinePrivate.h"
</span><span class="lines">@@ -275,11 +275,7 @@
</span><span class="cx"> + (NSUInteger)setNumberOfDFGCompilerThreads:(NSUInteger)numberOfThreads
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(DFG_JIT)
</span><del>-    JSC::DFG::Worklist* worklist = JSC::DFG::existingGlobalDFGWorklistOrNull();
-    if (worklist)
-        return worklist->setNumberOfThreads(numberOfThreads, JSC::Options::priorityDeltaOfDFGCompilerThreads());
-    else
-        return JSC::DFG::setNumberOfDFGCompilerThreads(numberOfThreads);
</del><ins>+    return JSC::JITWorklist::ensureGlobalWorklist().setMaximumNumberOfConcurrentDFGCompilations(numberOfThreads);
</ins><span class="cx"> #else
</span><span class="cx">     return 0;
</span><span class="cx"> #endif // ENABLE(DFG_JIT)
</span><span class="lines">@@ -288,11 +284,7 @@
</span><span class="cx"> + (NSUInteger)setNumberOfFTLCompilerThreads:(NSUInteger)numberOfThreads
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(DFG_JIT)
</span><del>-    JSC::DFG::Worklist* worklist = JSC::DFG::existingGlobalFTLWorklistOrNull();
-    if (worklist)
-        return worklist->setNumberOfThreads(numberOfThreads, JSC::Options::priorityDeltaOfFTLCompilerThreads());
-    else
-        return JSC::DFG::setNumberOfFTLCompilerThreads(numberOfThreads);
</del><ins>+    return JSC::JITWorklist::ensureGlobalWorklist().setMaximumNumberOfConcurrentFTLCompilations(numberOfThreads);
</ins><span class="cx"> #else
</span><span class="cx">     return 0;
</span><span class="cx"> #endif // ENABLE(DFG_JIT)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreAPIteststestapimm"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/API/tests/testapi.mm (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/API/tests/testapi.mm 2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/API/tests/testapi.mm    2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013-2019 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013-2021 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -28,7 +28,6 @@
</span><span class="cx"> #import <JavaScriptCore/JavaScriptCore.h>
</span><span class="cx"> 
</span><span class="cx"> #import "CurrentThisInsideBlockGetterTest.h"
</span><del>-#import "DFGWorklist.h"
</del><span class="cx"> #import "DateTests.h"
</span><span class="cx"> #import "JSCast.h"
</span><span class="cx"> #import "JSContextPrivate.h"
</span><span class="lines">@@ -549,15 +548,8 @@
</span><span class="cx">         checkResult(@"Number of FTL threads should have been updated", updatedNumberOfThreads == targetNumberOfThreads);
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    checkResult(@"runJITThreadLimitTests() must run at the very beginning to test the case where the global JIT worklist was not initialized yet", !JSC::DFG::existingGlobalDFGWorklistOrNull() && !JSC::DFG::existingGlobalFTLWorklistOrNull());
-
</del><span class="cx">     testDFG();
</span><del>-    JSC::DFG::ensureGlobalDFGWorklist();
-    testDFG();
-
</del><span class="cx">     testFTL();
</span><del>-    JSC::DFG::ensureGlobalFTLWorklist();
-    testFTL();
</del><span class="cx"> #endif // ENABLE(DFG_JIT)
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/CMakeLists.txt (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/CMakeLists.txt       2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/CMakeLists.txt  2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -604,7 +604,6 @@
</span><span class="cx"> 
</span><span class="cx">     dfg/DFGCodeOriginPool.h
</span><span class="cx">     dfg/DFGCommon.h
</span><del>-    dfg/DFGCompilationMode.h
</del><span class="cx">     dfg/DFGDoesGCCheck.h
</span><span class="cx">     dfg/DFGMinifiedID.h
</span><span class="cx"> 
</span><span class="lines">@@ -771,6 +770,7 @@
</span><span class="cx">     jit/JITCodeMap.h
</span><span class="cx">     jit/JITCompilation.h
</span><span class="cx">     jit/JITCompilationEffort.h
</span><ins>+    jit/JITCompilationMode.h
</ins><span class="cx">     jit/JITMathICForwards.h
</span><span class="cx">     jit/JITOperations.h
</span><span class="cx">     jit/JITStubRoutine.h
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog    2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/ChangeLog       2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -1,3 +1,188 @@
</span><ins>+2021-05-26  Tadeu Zagallo  <tzagallo@apple.com>
+
+        Merge all the JIT worklists into a shared worklist
+        https://bugs.webkit.org/show_bug.cgi?id=226207
+
+        Reviewed by Saam Barati.
+
+        Delete the DFG and FTL worklists and refactor JITWorklist to handle the compilation
+        for all tiers. This reduces the total number of compiler threads while allowing each
+        tier to use more threads whenever necessary. The default configuration is for the
+        worklist to have 3 threads, baseline can use up to all 3 threads and DFG and FTL follow
+        the previous limits set through JSC::Options. Right now, the worklist will only do work
+        on upper tiers when all lower tiers have no pending tasks or have exceeded the maximum
+        number of concurrent compilations. i.e. by default we only DFG compile when there are
+        no baseline tasks in the queue and we only FTL compile when we either have no DFG tasks
+        in the queue OR there are already 2 DFG compilations in progress.
+
+        * API/JSVirtualMachine.mm:
+        (+[JSVirtualMachine setNumberOfDFGCompilerThreads:]):
+        (+[JSVirtualMachine setNumberOfFTLCompilerThreads:]):
+        * API/tests/testapi.mm:
+        (runJITThreadLimitTests):
+        * CMakeLists.txt:
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        * Sources.txt:
+        * bytecode/CodeBlock.cpp:
+        (JSC::CodeBlock::checkIfOptimizationThresholdReached):
+        * dfg/DFGByteCodeParser.cpp:
+        (JSC::DFG::ByteCodeParser::parseBlock):
+        * dfg/DFGCommon.h:
+        (JSC::DFG::verboseCompilationEnabled):
+        (JSC::DFG::logCompilationChanges):
+        (JSC::DFG::shouldDumpGraphAtEachPhase):
+        (JSC::DFG::shouldDumpDisassembly):
+        * dfg/DFGDriver.cpp:
+        (JSC::DFG::compileImpl):
+        (JSC::DFG::compile):
+        * dfg/DFGDriver.h:
+        * dfg/DFGGraph.h:
+        * dfg/DFGGraphSafepoint.h:
+        * dfg/DFGOSRAvailabilityAnalysisPhase.cpp:
+        (JSC::DFG::OSRAvailabilityAnalysisPhase::run):
+        * dfg/DFGOSREntrypointCreationPhase.cpp:
+        (JSC::DFG::OSREntrypointCreationPhase::run):
+        * dfg/DFGOperations.cpp:
+        (JSC::DFG::triggerFTLReplacementCompile):
+        (JSC::DFG::tierUpCommon):
+        * dfg/DFGPlan.cpp:
+        (JSC::DFG::Plan::Plan):
+        (JSC::DFG::Plan::codeSize const):
+        (JSC::DFG::Plan::finalizeInGC):
+        (JSC::DFG::Plan::notifyReady):
+        (JSC::DFG::Plan::cancel):
+        (JSC::DFG::Plan::compileInThreadImpl):
+        (JSC::DFG::Plan::finalize):
+        (JSC::DFG::Plan::iterateCodeBlocksForGC):
+        (JSC::DFG::Plan::checkLivenessAndVisitChildren):
+        (JSC::DFG::Plan::isKnownToBeLiveDuringGC):
+        (JSC::DFG::Plan::isKnownToBeLiveAfterGC):
+        * dfg/DFGPlan.h:
+        * dfg/DFGPlanInlines.h: Removed.
+        * dfg/DFGTierUpCheckInjectionPhase.cpp:
+        (JSC::DFG::TierUpCheckInjectionPhase::run):
+        * dfg/DFGWorklist.cpp: Removed.
+        * dfg/DFGWorklist.h: Removed.
+        * dfg/DFGWorklistInlines.h: Removed.
+        * ftl/FTLCompile.h:
+        * ftl/FTLLink.cpp:
+        (JSC::FTL::link):
+        * ftl/FTLLowerDFGToB3.cpp:
+        (JSC::FTL::DFG::LowerDFGToB3::lower):
+        (JSC::FTL::DFG::LowerDFGToB3::buildExitArguments):
+        * ftl/FTLState.cpp:
+        (JSC::FTL::State::State):
+        * ftl/FTLState.h:
+        (JSC::FTL::verboseCompilationEnabled):
+        (JSC::FTL::shouldDumpDisassembly):
+        * heap/Heap.cpp:
+        (JSC::Heap::completeAllJITPlans):
+        (JSC::Heap::iterateExecutingAndCompilingCodeBlocks):
+        (JSC::Heap::removeDeadCompilerWorklistEntries):
+        (JSC::Heap::stopThePeriphery):
+        (JSC::Heap::suspendCompilerThreads):
+        (JSC::Heap::resumeCompilerThreads):
+        (JSC::Heap::addCoreConstraints):
+        * heap/Heap.h:
+        * heap/RootMarkReason.h:
+        * jit/JIT.cpp:
+        (JSC::JIT::compileAndLinkWithoutFinalizing):
+        (JSC::JIT::codeSize const):
+        (JSC::JIT::compileTimeStats):
+        * jit/JIT.h:
+        * jit/JITBaselinePlan.cpp: Copied from Source/JavaScriptCore/ftl/FTLState.cpp.
+        (JSC::JITBaselinePlan::JITBaselinePlan):
+        (JSC::JITBaselinePlan::compileInThreadImpl):
+        (JSC::JITBaselinePlan::codeSize const):
+        (JSC::JITBaselinePlan::finalize):
+        * jit/JITBaselinePlan.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h.
+        * jit/JITCompilationKey.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.cpp.
+        (JSC::JITCompilationKey::dump const):
+        * jit/JITCompilationKey.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.h.
+        (JSC::JITCompilationKey::JITCompilationKey):
+        (JSC::JITCompilationKey::operator! const):
+        (JSC::JITCompilationKey::isHashTableDeletedValue const):
+        (JSC::JITCompilationKey::mode const):
+        (JSC::JITCompilationKey::operator== const):
+        (JSC::JITCompilationKey::hash const):
+        (JSC::JITCompilationKeyHash::hash):
+        (JSC::JITCompilationKeyHash::equal):
+        * jit/JITCompilationMode.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.cpp.
+        (WTF::printInternal):
+        * jit/JITCompilationMode.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.h.
+        (JSC::isFTL):
+        * jit/JITOperations.cpp:
+        (JSC::JSC_DEFINE_JIT_OPERATION):
+        * jit/JITPlan.cpp: Added.
+        (JSC::JITPlan::JITPlan):
+        (JSC::JITPlan::cancel):
+        (JSC::JITPlan::notifyCompiling):
+        (JSC::JITPlan::notifyReady):
+        (JSC::JITPlan::tier const):
+        (JSC::JITPlan::key):
+        (JSC::JITPlan::isKnownToBeLiveAfterGC):
+        (JSC::JITPlan::isKnownToBeLiveDuringGC):
+        (JSC::JITPlan::iterateCodeBlocksForGC):
+        (JSC::JITPlan::checkLivenessAndVisitChildren):
+        (JSC::JITPlan::computeCompileTimes const):
+        (JSC::JITPlan::reportCompileTimes const):
+        (JSC::JITPlan::compileInThread):
+        * jit/JITPlan.h: Added.
+        (JSC::JITPlan::~JITPlan):
+        (JSC::JITPlan::vm const):
+        (JSC::JITPlan::codeBlock const):
+        (JSC::JITPlan::thread const):
+        (JSC::JITPlan::mode const):
+        (JSC::JITPlan::stage const):
+        (JSC::JITPlan::isFTL const):
+        (JSC::JITPlan::finalizeInGC):
+        * jit/JITPlanStage.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.cpp.
+        * jit/JITSafepoint.cpp: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.cpp.
+        (JSC::Safepoint::Safepoint):
+        (JSC::Safepoint::~Safepoint):
+        (JSC::Safepoint::begin):
+        (JSC::Safepoint::cancel):
+        * jit/JITSafepoint.h: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.h.
+        * jit/JITScannable.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h.
+        * jit/JITWorklist.cpp:
+        (JSC::JITWorklist::JITWorklist):
+        (JSC::JITWorklist::~JITWorklist):
+        (JSC::JITWorklist::existingGlobalWorklistOrNull):
+        (JSC::JITWorklist::ensureGlobalWorklist):
+        (JSC::JITWorklist::enqueue):
+        (JSC::JITWorklist::queueLength const):
+        (JSC::JITWorklist::suspendAllThreads):
+        (JSC::JITWorklist::resumeAllThreads):
+        (JSC::JITWorklist::compilationState):
+        (JSC::JITWorklist::completeAllReadyPlansForVM):
+        (JSC::JITWorklist::waitUntilAllPlansForVMAreReady):
+        (JSC::JITWorklist::completeAllPlansForVM):
+        (JSC::JITWorklist::cancelAllPlansForVM):
+        (JSC::JITWorklist::removeDeadPlans):
+        (JSC::JITWorklist::setMaximumNumberOfConcurrentDFGCompilations):
+        (JSC::JITWorklist::setMaximumNumberOfConcurrentFTLCompilations):
+        (JSC::JITWorklist::visitWeakReferences):
+        (JSC::JITWorklist::dump const):
+        (JSC::JITWorklist::removeAllReadyPlansForVM):
+        (JSC::JITWorklist::removeMatchingPlansForVM):
+        * jit/JITWorklist.h:
+        (JSC::JITWorklist::static_cast<size_t>):
+        * jit/JITWorklistInlines.h: Renamed from Source/JavaScriptCore/dfg/DFGScannable.h.
+        (JSC::JITWorklist::iterateCodeBlocksForGC):
+        * jit/JITWorklistThread.cpp: Added.
+        (JSC::JITWorklistThread::JITWorklistThread):
+        (JSC::JITWorklistThread::name const):
+        (JSC::JITWorklistThread::poll):
+        (JSC::JITWorklistThread::work):
+        (JSC::JITWorklistThread::threadDidStart):
+        (JSC::JITWorklistThread::threadIsStopping):
+        * jit/JITWorklistThread.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.h.
+        * llint/LLIntSlowPaths.cpp:
+        (JSC::LLInt::jitCompileAndSetHeuristics):
+        * runtime/OptionsList.h:
+        * runtime/VM.cpp:
+        (JSC::VM::~VM):
+
</ins><span class="cx"> 2021-05-25  Fujii Hironori  <Hironori.Fujii@sony.com>
</span><span class="cx"> 
</span><span class="cx">         Clang can't compile Optional<GPRTemporary> since r278035 because GPRTemporary has non-const copy constructor
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj     2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -164,8 +164,6 @@
</span><span class="cx">          0F1E3A471534CBB9000F9456 /* DFGDoubleFormatState.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F1E3A441534CBAD000F9456 /* DFGDoubleFormatState.h */; };
</span><span class="cx">          0F1E3A67153A21E2000F9456 /* DFGSilentRegisterSavePlan.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F1E3A65153A21DF000F9456 /* DFGSilentRegisterSavePlan.h */; };
</span><span class="cx">          0F1FB38F1E173A6700A9BE50 /* SynchronousStopTheWorldMutatorScheduler.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F1FB38B1E173A6200A9BE50 /* SynchronousStopTheWorldMutatorScheduler.h */; };
</span><del>-               0F1FB3961E1AF7E100A9BE50 /* DFGPlanInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F1FB3941E1AF7DF00A9BE50 /* DFGPlanInlines.h */; };
-               0F1FB3971E1AF7E300A9BE50 /* DFGWorklistInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F1FB3951E1AF7DF00A9BE50 /* DFGWorklistInlines.h */; };
</del><span class="cx">           0F1FB3991E1F65FB00A9BE50 /* MutatorScheduler.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F1FB3981E1F65F900A9BE50 /* MutatorScheduler.h */; };
</span><span class="cx">          0F1FE51C1922A3BC006987C5 /* AbortReason.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F1FE51B1922A3BC006987C5 /* AbortReason.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          0F2017801DCADC3500EA5950 /* DFGFlowIndexing.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F20177E1DCADC3000EA5950 /* DFGFlowIndexing.h */; };
</span><span class="lines">@@ -276,9 +274,6 @@
</span><span class="cx">          0F2E892D16D02BAF009E4FD2 /* DFGMinifiedID.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FB4B51016B3A964003F696B /* DFGMinifiedID.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          0F2FC77316E12F740038D976 /* DFGDCEPhase.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F2FC77116E12F6F0038D976 /* DFGDCEPhase.h */; };
</span><span class="cx">          0F2FCCFA18A60070001A27F8 /* DFGGraphSafepoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F2FCCF318A60070001A27F8 /* DFGGraphSafepoint.h */; };
</span><del>-               0F2FCCFC18A60070001A27F8 /* DFGSafepoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F2FCCF518A60070001A27F8 /* DFGSafepoint.h */; };
-               0F2FCCFD18A60070001A27F8 /* DFGScannable.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F2FCCF618A60070001A27F8 /* DFGScannable.h */; };
-               0F2FCCFF18A60070001A27F8 /* DFGThreadData.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F2FCCF818A60070001A27F8 /* DFGThreadData.h */; };
</del><span class="cx">           0F300B7818AB051100A6D72E /* DFGNodeOrigin.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F300B7718AB051100A6D72E /* DFGNodeOrigin.h */; };
</span><span class="cx">          0F300B7C18AB1B1400A6D72E /* DFGIntegerCheckCombiningPhase.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F300B7A18AB1B1400A6D72E /* DFGIntegerCheckCombiningPhase.h */; };
</span><span class="cx">          0F30CB5E1FCE4E37004B5323 /* AllocatorForMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F30CB5D1FCE46B4004B5323 /* AllocatorForMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -304,8 +299,6 @@
</span><span class="cx">          0F3730911C0CD70C00052BFA /* AllowMacroScratchRegisterUsage.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F3730901C0CD70C00052BFA /* AllowMacroScratchRegisterUsage.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          0F3730931C0D67EE00052BFA /* AirUseCounts.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F3730921C0D67EE00052BFA /* AirUseCounts.h */; };
</span><span class="cx">          0F38B01217CF078300B144D3 /* LLIntEntrypoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F38B01017CF077F00B144D3 /* LLIntEntrypoint.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-               0F38B01817CFE75500B144D3 /* DFGCompilationKey.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F38B01417CFE75500B144D3 /* DFGCompilationKey.h */; };
-               0F38B01A17CFE75500B144D3 /* DFGCompilationMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F38B01617CFE75500B144D3 /* DFGCompilationMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
</del><span class="cx">           0F38D2A21D44196800680499 /* AuxiliaryBarrier.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F38D2A01D44196600680499 /* AuxiliaryBarrier.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          0F38D2A31D44196D00680499 /* AuxiliaryBarrierInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F38D2A11D44196600680499 /* AuxiliaryBarrierInlines.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          0F392C8A1B46188400844728 /* DFGOSRExitFuzz.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F392C881B46188400844728 /* DFGOSRExitFuzz.h */; };
</span><span class="lines">@@ -459,7 +452,6 @@
</span><span class="cx">          0F885E111849A3BE00F1E3FA /* BytecodeUseDef.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F885E101849A3BE00F1E3FA /* BytecodeUseDef.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          0F898F321B27689F0083A33C /* DFGIntegerRangeOptimizationPhase.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F898F301B27689F0083A33C /* DFGIntegerRangeOptimizationPhase.h */; };
</span><span class="cx">          0F8F14341ADF090100ED792C /* DFGEpoch.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F8F14301ADF090100ED792C /* DFGEpoch.h */; };
</span><del>-               0F8F14361ADF090100ED792C /* DFGMovHintRemovalPhase.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F8F14321ADF090100ED792C /* DFGMovHintRemovalPhase.h */; };
</del><span class="cx">           0F8F2B96172E04A3007DBDA5 /* FTLLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F8F2B94172E049E007DBDA5 /* FTLLink.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          0F8F2B9A172F0501007DBDA5 /* DFGDesiredIdentifiers.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F8F2B98172F04FD007DBDA5 /* DFGDesiredIdentifiers.h */; };
</span><span class="cx">          0F8F94411667633200D61971 /* CodeBlockHash.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F8F943E1667632D00D61971 /* CodeBlockHash.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -592,7 +584,6 @@
</span><span class="cx">          0FD8A32C17D51F5700CA2C40 /* DFGToFTLForOSREntryDeferredCompilationCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD8A32417D51F5700CA2C40 /* DFGToFTLForOSREntryDeferredCompilationCallback.h */; };
</span><span class="cx">          0FDB2CC9173DA520007B3C1B /* FTLAbbreviatedTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FDB2CC7173DA51E007B3C1B /* FTLAbbreviatedTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          0FDB2CCA173DA523007B3C1B /* FTLValueFromBlock.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FDB2CC8173DA51E007B3C1B /* FTLValueFromBlock.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-               0FDB2CE8174830A2007B3C1B /* DFGWorklist.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FDB2CE6174830A2007B3C1B /* DFGWorklist.h */; };
</del><span class="cx">           0FDB2CEA174896C7007B3C1B /* ConcurrentJSLock.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FDB2CE9174896C7007B3C1B /* ConcurrentJSLock.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          0FDCE11C1FAE6209006F3901 /* AllocationFailureMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FDCE11B1FAE61F4006F3901 /* AllocationFailureMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          0FDCE1221FAE858C006F3901 /* HeapCellType.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FDCE11F1FAE8587006F3901 /* HeapCellType.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -1183,6 +1174,15 @@
</span><span class="cx">          70EC0EC71AA0D7DA00B6AAFA /* StringIteratorPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = 70EC0EC11AA0D7DA00B6AAFA /* StringIteratorPrototype.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          70ECA6061AFDBEA200449739 /* JSTemplateObjectDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 70ECA6011AFDBEA200449739 /* JSTemplateObjectDescriptor.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          70ECA6091AFDBEA200449739 /* TemplateObjectDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 70ECA6041AFDBEA200449739 /* TemplateObjectDescriptor.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+               72131BF826587EF2007114CF /* JITScannable.h in Headers */ = {isa = PBXBuildFile; fileRef = 72131BF426587EF2007114CF /* JITScannable.h */; };
+               72131BF926587EF2007114CF /* JITSafepoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 72131BF526587EF2007114CF /* JITSafepoint.h */; };
+               72131BFA26587EF2007114CF /* JITPlanStage.h in Headers */ = {isa = PBXBuildFile; fileRef = 72131BF626587EF2007114CF /* JITPlanStage.h */; };
+               72131BFC26587EFA007114CF /* JITWorklistInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = 72131BFB26587EFA007114CF /* JITWorklistInlines.h */; };
+               723998F7265DBCDB0057867F /* BaselineJITPlan.h in Headers */ = {isa = PBXBuildFile; fileRef = 723998F5265DBCDB0057867F /* BaselineJITPlan.h */; };
+               726B91B026581653008E6F82 /* JITWorklistThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 726B91A826581652008E6F82 /* JITWorklistThread.h */; };
+               726B91B326581653008E6F82 /* JITCompilationMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 726B91AB26581653008E6F82 /* JITCompilationMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               726B91B726581653008E6F82 /* JITPlan.h in Headers */ = {isa = PBXBuildFile; fileRef = 726B91AF26581653008E6F82 /* JITPlan.h */; };
+               726B91BA2658263D008E6F82 /* JITCompilationKey.h in Headers */ = {isa = PBXBuildFile; fileRef = 726B91B82658263C008E6F82 /* JITCompilationKey.h */; };
</ins><span class="cx">           7311FA32240DB1D3003D48DB /* DeleteByIdVariant.h in Headers */ = {isa = PBXBuildFile; fileRef = 7311FA31240DB1D3003D48DB /* DeleteByIdVariant.h */; };
</span><span class="cx">          734B655523F5C10400A069D1 /* DeletePropertySlot.h in Headers */ = {isa = PBXBuildFile; fileRef = 734B655423F4A33100A069D1 /* DeletePropertySlot.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          73AD062923FF662600F53593 /* DeleteByStatus.h in Headers */ = {isa = PBXBuildFile; fileRef = 73AD062823FF662600F53593 /* DeleteByStatus.h */; };
</span><span class="lines">@@ -2362,8 +2362,6 @@
</span><span class="cx">          0F1FB38A1E173A6200A9BE50 /* SynchronousStopTheWorldMutatorScheduler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SynchronousStopTheWorldMutatorScheduler.cpp; sourceTree = "<group>"; };
</span><span class="cx">          0F1FB38B1E173A6200A9BE50 /* SynchronousStopTheWorldMutatorScheduler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SynchronousStopTheWorldMutatorScheduler.h; sourceTree = "<group>"; };
</span><span class="cx">          0F1FB38C1E173A6200A9BE50 /* MutatorScheduler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MutatorScheduler.cpp; sourceTree = "<group>"; };
</span><del>-               0F1FB3941E1AF7DF00A9BE50 /* DFGPlanInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGPlanInlines.h; path = dfg/DFGPlanInlines.h; sourceTree = "<group>"; };
-               0F1FB3951E1AF7DF00A9BE50 /* DFGWorklistInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGWorklistInlines.h; path = dfg/DFGWorklistInlines.h; sourceTree = "<group>"; };
</del><span class="cx">           0F1FB3981E1F65F900A9BE50 /* MutatorScheduler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MutatorScheduler.h; sourceTree = "<group>"; };
</span><span class="cx">          0F1FE51B1922A3BC006987C5 /* AbortReason.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AbortReason.h; sourceTree = "<group>"; };
</span><span class="cx">          0F20177D1DCADC3000EA5950 /* DFGFlowIndexing.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGFlowIndexing.cpp; path = dfg/DFGFlowIndexing.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -2537,11 +2535,6 @@
</span><span class="cx">          0F2FC77116E12F6F0038D976 /* DFGDCEPhase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGDCEPhase.h; path = dfg/DFGDCEPhase.h; sourceTree = "<group>"; };
</span><span class="cx">          0F2FCCF218A60070001A27F8 /* DFGGraphSafepoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGGraphSafepoint.cpp; path = dfg/DFGGraphSafepoint.cpp; sourceTree = "<group>"; };
</span><span class="cx">          0F2FCCF318A60070001A27F8 /* DFGGraphSafepoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGGraphSafepoint.h; path = dfg/DFGGraphSafepoint.h; sourceTree = "<group>"; };
</span><del>-               0F2FCCF418A60070001A27F8 /* DFGSafepoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGSafepoint.cpp; path = dfg/DFGSafepoint.cpp; sourceTree = "<group>"; };
-               0F2FCCF518A60070001A27F8 /* DFGSafepoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGSafepoint.h; path = dfg/DFGSafepoint.h; sourceTree = "<group>"; };
-               0F2FCCF618A60070001A27F8 /* DFGScannable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGScannable.h; path = dfg/DFGScannable.h; sourceTree = "<group>"; };
-               0F2FCCF718A60070001A27F8 /* DFGThreadData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGThreadData.cpp; path = dfg/DFGThreadData.cpp; sourceTree = "<group>"; };
-               0F2FCCF818A60070001A27F8 /* DFGThreadData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGThreadData.h; path = dfg/DFGThreadData.h; sourceTree = "<group>"; };
</del><span class="cx">           0F300B7718AB051100A6D72E /* DFGNodeOrigin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGNodeOrigin.h; path = dfg/DFGNodeOrigin.h; sourceTree = "<group>"; };
</span><span class="cx">          0F300B7918AB1B1400A6D72E /* DFGIntegerCheckCombiningPhase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGIntegerCheckCombiningPhase.cpp; path = dfg/DFGIntegerCheckCombiningPhase.cpp; sourceTree = "<group>"; };
</span><span class="cx">          0F300B7A18AB1B1400A6D72E /* DFGIntegerCheckCombiningPhase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGIntegerCheckCombiningPhase.h; path = dfg/DFGIntegerCheckCombiningPhase.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -2582,10 +2575,6 @@
</span><span class="cx">          0F3730921C0D67EE00052BFA /* AirUseCounts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AirUseCounts.h; path = b3/air/AirUseCounts.h; sourceTree = "<group>"; };
</span><span class="cx">          0F38B00F17CF077F00B144D3 /* LLIntEntrypoint.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = LLIntEntrypoint.cpp; path = llint/LLIntEntrypoint.cpp; sourceTree = "<group>"; };
</span><span class="cx">          0F38B01017CF077F00B144D3 /* LLIntEntrypoint.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = LLIntEntrypoint.h; path = llint/LLIntEntrypoint.h; sourceTree = "<group>"; };
</span><del>-               0F38B01317CFE75500B144D3 /* DFGCompilationKey.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGCompilationKey.cpp; path = dfg/DFGCompilationKey.cpp; sourceTree = "<group>"; };
-               0F38B01417CFE75500B144D3 /* DFGCompilationKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGCompilationKey.h; path = dfg/DFGCompilationKey.h; sourceTree = "<group>"; };
-               0F38B01517CFE75500B144D3 /* DFGCompilationMode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGCompilationMode.cpp; path = dfg/DFGCompilationMode.cpp; sourceTree = "<group>"; };
-               0F38B01617CFE75500B144D3 /* DFGCompilationMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGCompilationMode.h; path = dfg/DFGCompilationMode.h; sourceTree = "<group>"; };
</del><span class="cx">           0F38D2A01D44196600680499 /* AuxiliaryBarrier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuxiliaryBarrier.h; sourceTree = "<group>"; };
</span><span class="cx">          0F38D2A11D44196600680499 /* AuxiliaryBarrierInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuxiliaryBarrierInlines.h; sourceTree = "<group>"; };
</span><span class="cx">          0F392C871B46188400844728 /* DFGOSRExitFuzz.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGOSRExitFuzz.cpp; path = dfg/DFGOSRExitFuzz.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -2835,8 +2824,6 @@
</span><span class="cx">          0F898F301B27689F0083A33C /* DFGIntegerRangeOptimizationPhase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGIntegerRangeOptimizationPhase.h; path = dfg/DFGIntegerRangeOptimizationPhase.h; sourceTree = "<group>"; };
</span><span class="cx">          0F8F142F1ADF090100ED792C /* DFGEpoch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGEpoch.cpp; path = dfg/DFGEpoch.cpp; sourceTree = "<group>"; };
</span><span class="cx">          0F8F14301ADF090100ED792C /* DFGEpoch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGEpoch.h; path = dfg/DFGEpoch.h; sourceTree = "<group>"; };
</span><del>-               0F8F14311ADF090100ED792C /* DFGMovHintRemovalPhase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGMovHintRemovalPhase.cpp; path = dfg/DFGMovHintRemovalPhase.cpp; sourceTree = "<group>"; };
-               0F8F14321ADF090100ED792C /* DFGMovHintRemovalPhase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGMovHintRemovalPhase.h; path = dfg/DFGMovHintRemovalPhase.h; sourceTree = "<group>"; };
</del><span class="cx">           0F8F2B93172E049E007DBDA5 /* FTLLink.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = FTLLink.cpp; path = ftl/FTLLink.cpp; sourceTree = "<group>"; };
</span><span class="cx">          0F8F2B94172E049E007DBDA5 /* FTLLink.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = FTLLink.h; path = ftl/FTLLink.h; sourceTree = "<group>"; };
</span><span class="cx">          0F8F2B97172F04FD007DBDA5 /* DFGDesiredIdentifiers.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = DFGDesiredIdentifiers.cpp; path = dfg/DFGDesiredIdentifiers.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -3078,8 +3065,6 @@
</span><span class="cx">          0FD8A32417D51F5700CA2C40 /* DFGToFTLForOSREntryDeferredCompilationCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGToFTLForOSREntryDeferredCompilationCallback.h; path = dfg/DFGToFTLForOSREntryDeferredCompilationCallback.h; sourceTree = "<group>"; };
</span><span class="cx">          0FDB2CC7173DA51E007B3C1B /* FTLAbbreviatedTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = FTLAbbreviatedTypes.h; path = ftl/FTLAbbreviatedTypes.h; sourceTree = "<group>"; };
</span><span class="cx">          0FDB2CC8173DA51E007B3C1B /* FTLValueFromBlock.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = FTLValueFromBlock.h; path = ftl/FTLValueFromBlock.h; sourceTree = "<group>"; };
</span><del>-               0FDB2CE5174830A2007B3C1B /* DFGWorklist.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGWorklist.cpp; path = dfg/DFGWorklist.cpp; sourceTree = "<group>"; };
-               0FDB2CE6174830A2007B3C1B /* DFGWorklist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGWorklist.h; path = dfg/DFGWorklist.h; sourceTree = "<group>"; };
</del><span class="cx">           0FDB2CE9174896C7007B3C1B /* ConcurrentJSLock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConcurrentJSLock.h; sourceTree = "<group>"; };
</span><span class="cx">          0FDCE11B1FAE61F4006F3901 /* AllocationFailureMode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AllocationFailureMode.h; sourceTree = "<group>"; };
</span><span class="cx">          0FDCE11F1FAE8587006F3901 /* HeapCellType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HeapCellType.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -4062,6 +4047,21 @@
</span><span class="cx">          70ECA6001AFDBEA200449739 /* JSTemplateObjectDescriptor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTemplateObjectDescriptor.cpp; sourceTree = "<group>"; };
</span><span class="cx">          70ECA6011AFDBEA200449739 /* JSTemplateObjectDescriptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSTemplateObjectDescriptor.h; sourceTree = "<group>"; };
</span><span class="cx">          70ECA6041AFDBEA200449739 /* TemplateObjectDescriptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TemplateObjectDescriptor.h; sourceTree = "<group>"; };
</span><ins>+               72131BF326587EF2007114CF /* JITSafepoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITSafepoint.cpp; sourceTree = "<group>"; };
+               72131BF426587EF2007114CF /* JITScannable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITScannable.h; sourceTree = "<group>"; };
+               72131BF526587EF2007114CF /* JITSafepoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITSafepoint.h; sourceTree = "<group>"; };
+               72131BF626587EF2007114CF /* JITPlanStage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITPlanStage.h; sourceTree = "<group>"; };
+               72131BFB26587EFA007114CF /* JITWorklistInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITWorklistInlines.h; sourceTree = "<group>"; };
+               723998F5265DBCDB0057867F /* BaselineJITPlan.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaselineJITPlan.h; sourceTree = "<group>"; };
+               723998F6265DBCDB0057867F /* BaselineJITPlan.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BaselineJITPlan.cpp; sourceTree = "<group>"; };
+               726B91A826581652008E6F82 /* JITWorklistThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITWorklistThread.h; sourceTree = "<group>"; };
+               726B91AA26581653008E6F82 /* JITPlan.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITPlan.cpp; sourceTree = "<group>"; };
+               726B91AB26581653008E6F82 /* JITCompilationMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITCompilationMode.h; sourceTree = "<group>"; };
+               726B91AC26581653008E6F82 /* JITWorklistThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITWorklistThread.cpp; sourceTree = "<group>"; };
+               726B91AE26581653008E6F82 /* JITCompilationMode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITCompilationMode.cpp; sourceTree = "<group>"; };
+               726B91AF26581653008E6F82 /* JITPlan.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITPlan.h; sourceTree = "<group>"; };
+               726B91B82658263C008E6F82 /* JITCompilationKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITCompilationKey.h; sourceTree = "<group>"; };
+               726B91B92658263C008E6F82 /* JITCompilationKey.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITCompilationKey.cpp; sourceTree = "<group>"; };
</ins><span class="cx">           7311FA31240DB1D3003D48DB /* DeleteByIdVariant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DeleteByIdVariant.h; sourceTree = "<group>"; };
</span><span class="cx">          7311FA33240DB249003D48DB /* DeleteByIdVariant.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DeleteByIdVariant.cpp; sourceTree = "<group>"; };
</span><span class="cx">          73190D962400934900F891C9 /* DeleteByStatus.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DeleteByStatus.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -6199,6 +6199,8 @@
</span><span class="cx">                  children = (
</span><span class="cx">                          0F24E53B17EA9F5900ABB217 /* AssemblyHelpers.cpp */,
</span><span class="cx">                          0F24E53C17EA9F5900ABB217 /* AssemblyHelpers.h */,
</span><ins>+                               723998F6265DBCDB0057867F /* BaselineJITPlan.cpp */,
+                               723998F5265DBCDB0057867F /* BaselineJITPlan.h */,
</ins><span class="cx">                           0F64B26F1A784BAF006E4E66 /* BinarySwitch.cpp */,
</span><span class="cx">                          0F64B2701A784BAF006E4E66 /* BinarySwitch.h */,
</span><span class="cx">                          65B8392D1BACA9D30044E824 /* CachedRecovery.cpp */,
</span><span class="lines">@@ -6246,6 +6248,10 @@
</span><span class="cx">                          86D446E825B2124800ECAE75 /* JITCompilation.cpp */,
</span><span class="cx">                          86D446E725B2124800ECAE75 /* JITCompilation.h */,
</span><span class="cx">                          0F0776BD14FF002800102332 /* JITCompilationEffort.h */,
</span><ins>+                               726B91B92658263C008E6F82 /* JITCompilationKey.cpp */,
+                               726B91B82658263C008E6F82 /* JITCompilationKey.h */,
+                               726B91AE26581653008E6F82 /* JITCompilationMode.cpp */,
+                               726B91AB26581653008E6F82 /* JITCompilationMode.h */,
</ins><span class="cx">                           0FAF7EFA165BA919000C8455 /* JITDisassembler.cpp */,
</span><span class="cx">                          0FAF7EFB165BA919000C8455 /* JITDisassembler.h */,
</span><span class="cx">                          FE187A0A1C0229230038BBCA /* JITDivGenerator.cpp */,
</span><span class="lines">@@ -6271,10 +6277,16 @@
</span><span class="cx">                          A71236E41195F33C00BD2174 /* JITOpcodes32_64.cpp */,
</span><span class="cx">                          0F24E54517EE274900ABB217 /* JITOperations.cpp */,
</span><span class="cx">                          0F24E54617EE274900ABB217 /* JITOperations.h */,
</span><ins>+                               726B91AA26581653008E6F82 /* JITPlan.cpp */,
+                               726B91AF26581653008E6F82 /* JITPlan.h */,
+                               72131BF626587EF2007114CF /* JITPlanStage.h */,
</ins><span class="cx">                           86CC85C30EE7A89400288682 /* JITPropertyAccess.cpp */,
</span><span class="cx">                          A7C1E8C8112E701C00A37F98 /* JITPropertyAccess32_64.cpp */,
</span><span class="cx">                          FE3A06B81C1103D900390FDD /* JITRightShiftGenerator.cpp */,
</span><span class="cx">                          FE3A06B91C1103D900390FDD /* JITRightShiftGenerator.h */,
</span><ins>+                               72131BF326587EF2007114CF /* JITSafepoint.cpp */,
+                               72131BF526587EF2007114CF /* JITSafepoint.h */,
+                               72131BF426587EF2007114CF /* JITScannable.h */,
</ins><span class="cx">                           0F766D2615A8CC1B008F363E /* JITStubRoutine.cpp */,
</span><span class="cx">                          0F766D1C15A5028D008F363E /* JITStubRoutine.h */,
</span><span class="cx">                          FE42388F1BE18C1200514737 /* JITSubGenerator.cpp */,
</span><span class="lines">@@ -6285,6 +6297,9 @@
</span><span class="cx">                          0FC712E117CD878F008CC93C /* JITToDFGDeferredCompilationCallback.h */,
</span><span class="cx">                          DC0184171D10C1870057B053 /* JITWorklist.cpp */,
</span><span class="cx">                          DC0184181D10C1870057B053 /* JITWorklist.h */,
</span><ins>+                               72131BFB26587EFA007114CF /* JITWorklistInlines.h */,
+                               726B91AC26581653008E6F82 /* JITWorklistThread.cpp */,
+                               726B91A826581652008E6F82 /* JITWorklistThread.h */,
</ins><span class="cx">                           A76C51741182748D00715B05 /* JSInterfaceJIT.h */,
</span><span class="cx">                          792CB3471C4EED5C00D13AF3 /* PCToCodeOriginMap.cpp */,
</span><span class="cx">                          792CB3481C4EED5C00D13AF3 /* PCToCodeOriginMap.h */,
</span><span class="lines">@@ -8102,10 +8117,6 @@
</span><span class="cx">                          0FC0977E1469EBC400CF2442 /* DFGCommon.h */,
</span><span class="cx">                          0FEA0A2D170D40BF00BB722C /* DFGCommonData.cpp */,
</span><span class="cx">                          0FEA0A2E170D40BF00BB722C /* DFGCommonData.h */,
</span><del>-                               0F38B01317CFE75500B144D3 /* DFGCompilationKey.cpp */,
-                               0F38B01417CFE75500B144D3 /* DFGCompilationKey.h */,
-                               0F38B01517CFE75500B144D3 /* DFGCompilationMode.cpp */,
-                               0F38B01617CFE75500B144D3 /* DFGCompilationMode.h */,
</del><span class="cx">                           0F3B3A17153E68EF003ED0FF /* DFGConstantFoldingPhase.cpp */,
</span><span class="cx">                          0F3B3A18153E68EF003ED0FF /* DFGConstantFoldingPhase.h */,
</span><span class="cx">                          0FED67B71B26256D0066CE15 /* DFGConstantHoistingPhase.cpp */,
</span><span class="lines">@@ -8209,8 +8220,6 @@
</span><span class="cx">                          E3850B14226ED63E009ABF9C /* DFGMinifiedIDInlines.h */,
</span><span class="cx">                          0F2BDC4C1522818300CD8910 /* DFGMinifiedNode.cpp */,
</span><span class="cx">                          0F2BDC3E1522801700CD8910 /* DFGMinifiedNode.h */,
</span><del>-                               0F8F14311ADF090100ED792C /* DFGMovHintRemovalPhase.cpp */,
-                               0F8F14321ADF090100ED792C /* DFGMovHintRemovalPhase.h */,
</del><span class="cx">                           0FF2CD591B61A4F8004955A8 /* DFGMultiGetByOffsetData.cpp */,
</span><span class="cx">                          0FF2CD5A1B61A4F8004955A8 /* DFGMultiGetByOffsetData.h */,
</span><span class="cx">                          A737810B1799EA2E00817533 /* DFGNaturalLoops.h */,
</span><span class="lines">@@ -8258,7 +8267,6 @@
</span><span class="cx">                          0F2B9CDF19D0BA7D00B1D1B5 /* DFGPhiChildren.h */,
</span><span class="cx">                          A78A9772179738B8009DF744 /* DFGPlan.cpp */,
</span><span class="cx">                          A78A9773179738B8009DF744 /* DFGPlan.h */,
</span><del>-                               0F1FB3941E1AF7DF00A9BE50 /* DFGPlanInlines.h */,
</del><span class="cx">                           DC00039019D8BE6F00023EB0 /* DFGPreciseLocalClobberize.h */,
</span><span class="cx">                          0FBE0F6D16C1DB010082C5E8 /* DFGPredictionInjectionPhase.cpp */,
</span><span class="cx">                          0FBE0F6E16C1DB010082C5E8 /* DFGPredictionInjectionPhase.h */,
</span><span class="lines">@@ -8275,11 +8283,8 @@
</span><span class="cx">                          79FC8A071E32E9F000D88F0E /* DFGRegisteredStructure.h */,
</span><span class="cx">                          7980C16A1E3A940E00B71615 /* DFGRegisteredStructureSet.cpp */,
</span><span class="cx">                          7980C16B1E3A940E00B71615 /* DFGRegisteredStructureSet.h */,
</span><del>-                               0F2FCCF418A60070001A27F8 /* DFGSafepoint.cpp */,
-                               0F2FCCF518A60070001A27F8 /* DFGSafepoint.h */,
</del><span class="cx">                           A77A423C17A0BBFD00A8DB81 /* DFGSafeToExecute.h */,
</span><span class="cx">                          A741017E179DAF80002EB8BA /* DFGSaneStringGetByValSlowPathGenerator.h */,
</span><del>-                               0F2FCCF618A60070001A27F8 /* DFGScannable.h */,
</del><span class="cx">                           86ECA3F9132DF25A002B2AD7 /* DFGScoreBoard.h */,
</span><span class="cx">                          0F1E3A65153A21DF000F9456 /* DFGSilentRegisterSavePlan.h */,
</span><span class="cx">                          0F1E3A501537C2CB000F9456 /* DFGSlowPathGenerator.h */,
</span><span class="lines">@@ -8308,8 +8313,6 @@
</span><span class="cx">                          0F893BDA1936E23C001211F4 /* DFGStructureAbstractValue.cpp */,
</span><span class="cx">                          0F63947615DCE347006A597C /* DFGStructureAbstractValue.h */,
</span><span class="cx">                          0F50AF3B193E8B3900674EE8 /* DFGStructureClobberState.h */,
</span><del>-                               0F2FCCF718A60070001A27F8 /* DFGThreadData.cpp */,
-                               0F2FCCF818A60070001A27F8 /* DFGThreadData.h */,
</del><span class="cx">                           0FC0979F146B28C700CF2442 /* DFGThunks.cpp */,
</span><span class="cx">                          0FC097A0146B28C700CF2442 /* DFGThunks.h */,
</span><span class="cx">                          0FD8A31F17D51F5700CA2C40 /* DFGTierUpCheckInjectionPhase.cpp */,
</span><span class="lines">@@ -8348,9 +8351,6 @@
</span><span class="cx">                          0FFFC95414EF909500C72532 /* DFGVirtualRegisterAllocationPhase.h */,
</span><span class="cx">                          0FC97F3B18202119002C9B26 /* DFGWatchpointCollectionPhase.cpp */,
</span><span class="cx">                          0FC97F3C18202119002C9B26 /* DFGWatchpointCollectionPhase.h */,
</span><del>-                               0FDB2CE5174830A2007B3C1B /* DFGWorklist.cpp */,
-                               0FDB2CE6174830A2007B3C1B /* DFGWorklist.h */,
-                               0F1FB3951E1AF7DF00A9BE50 /* DFGWorklistInlines.h */,
</del><span class="cx">                           52CD0F672242F71C004A18A5 /* testdfg.cpp */,
</span><span class="cx">                  );
</span><span class="cx">                  name = dfg;
</span><span class="lines">@@ -9370,6 +9370,7 @@
</span><span class="cx">                          53D444DC1DAF08AB00B92784 /* B3WasmAddressValue.h in Headers */,
</span><span class="cx">                          5341FC721DAC343C00E7E4D7 /* B3WasmBoundsCheckValue.h in Headers */,
</span><span class="cx">                          0F2C63B21E60AE4700C13839 /* B3Width.h in Headers */,
</span><ins>+                               723998F7265DBCDB0057867F /* BaselineJITPlan.h in Headers */,
</ins><span class="cx">                           52678F8F1A031009006A306D /* BasicBlockLocation.h in Headers */,
</span><span class="cx">                          147B83AC0E6DB8C9004775A4 /* BatchedTransitionOptimizer.h in Headers */,
</span><span class="cx">                          E35E89FD25C50F870071EE1E /* BigInt64Array.h in Headers */,
</span><span class="lines">@@ -9458,7 +9459,6 @@
</span><span class="cx">                          BC18C45E0E16F5CD00B34460 /* CLoopStack.h in Headers */,
</span><span class="cx">                          A7C1EAF017987AB600299DB2 /* CLoopStackInlines.h in Headers */,
</span><span class="cx">                          969A07970ED1D3AE00F1F681 /* CodeBlock.h in Headers */,
</span><del>-                               FEF5B4292628B5240016E776 /* JSSetInlines.h in Headers */,
</del><span class="cx">                           0F8F94411667633200D61971 /* CodeBlockHash.h in Headers */,
</span><span class="cx">                          0FC97F34182020D7002C9B26 /* CodeBlockJettisoningWatchpoint.h in Headers */,
</span><span class="cx">                          0FD8A31417D4326C00CA2C40 /* CodeBlockSet.h in Headers */,
</span><span class="lines">@@ -9579,8 +9579,6 @@
</span><span class="cx">                          0F04396E1B03DC0B009598B7 /* DFGCombinedLiveness.h in Headers */,
</span><span class="cx">                          0F7B294D14C3CD4C007C3DB1 /* DFGCommon.h in Headers */,
</span><span class="cx">                          0FEA0A32170D40BF00BB722C /* DFGCommonData.h in Headers */,
</span><del>-                               0F38B01817CFE75500B144D3 /* DFGCompilationKey.h in Headers */,
-                               0F38B01A17CFE75500B144D3 /* DFGCompilationMode.h in Headers */,
</del><span class="cx">                           0F3B3A1B153E68F4003ED0FF /* DFGConstantFoldingPhase.h in Headers */,
</span><span class="cx">                          0FED67BA1B26256D0066CE15 /* DFGConstantHoistingPhase.h in Headers */,
</span><span class="cx">                          DCEE220B1CEB9895000C2396 /* DFGControlEquivalenceAnalysis.h in Headers */,
</span><span class="lines">@@ -9639,7 +9637,6 @@
</span><span class="cx">                          0F2E892D16D02BAF009E4FD2 /* DFGMinifiedID.h in Headers */,
</span><span class="cx">                          E3850B15226ED641009ABF9C /* DFGMinifiedIDInlines.h in Headers */,
</span><span class="cx">                          0F2BDC461522802000CD8910 /* DFGMinifiedNode.h in Headers */,
</span><del>-                               0F8F14361ADF090100ED792C /* DFGMovHintRemovalPhase.h in Headers */,
</del><span class="cx">                           0FF2CD5C1B61A4F8004955A8 /* DFGMultiGetByOffsetData.h in Headers */,
</span><span class="cx">                          A737810E1799EA2E00817533 /* DFGNaturalLoops.h in Headers */,
</span><span class="cx">                          86ECA3EA132DEF1C002B2AD7 /* DFGNode.h in Headers */,
</span><span class="lines">@@ -9657,7 +9654,6 @@
</span><span class="cx">                          0FD82E57141DAF1000179C94 /* DFGOSREntry.h in Headers */,
</span><span class="cx">                          0FD8A32617D51F5700CA2C40 /* DFGOSREntrypointCreationPhase.h in Headers */,
</span><span class="cx">                          0FC0976A1468A6F700CF2442 /* DFGOSRExit.h in Headers */,
</span><del>-                               FEF5B4272628ABD90016E776 /* JSWeakMapInlines.h in Headers */,
</del><span class="cx">                           0F235BEC17178E7300690C7F /* DFGOSRExitBase.h in Headers */,
</span><span class="cx">                          0FFB921C16D02F110055A5DB /* DFGOSRExitCompilationInfo.h in Headers */,
</span><span class="cx">                          0F7025AA1714B0FC00382C0E /* DFGOSRExitCompilerCommon.h in Headers */,
</span><span class="lines">@@ -9667,7 +9663,6 @@
</span><span class="cx">                          0FFFC95C14EF90AF00C72532 /* DFGPhase.h in Headers */,
</span><span class="cx">                          0F2B9CEB19D0BA7D00B1D1B5 /* DFGPhiChildren.h in Headers */,
</span><span class="cx">                          A78A977B179738B8009DF744 /* DFGPlan.h in Headers */,
</span><del>-                               0F1FB3961E1AF7E100A9BE50 /* DFGPlanInlines.h in Headers */,
</del><span class="cx">                           DC00039319D8BE6F00023EB0 /* DFGPreciseLocalClobberize.h in Headers */,
</span><span class="cx">                          0FBE0F7516C1DB0B0082C5E8 /* DFGPredictionInjectionPhase.h in Headers */,
</span><span class="cx">                          0FFFC95E14EF90B700C72532 /* DFGPredictionPropagationPhase.h in Headers */,
</span><span class="lines">@@ -9678,10 +9673,8 @@
</span><span class="cx">                          86EC9DD11328DF82002B2AD7 /* DFGRegisterBank.h in Headers */,
</span><span class="cx">                          79FC8A081E32E9F000D88F0E /* DFGRegisteredStructure.h in Headers */,
</span><span class="cx">                          7980C16D1E3A940E00B71615 /* DFGRegisteredStructureSet.h in Headers */,
</span><del>-                               0F2FCCFC18A60070001A27F8 /* DFGSafepoint.h in Headers */,
</del><span class="cx">                           A77A424317A0BBFD00A8DB81 /* DFGSafeToExecute.h in Headers */,
</span><span class="cx">                          A741017F179DAF80002EB8BA /* DFGSaneStringGetByValSlowPathGenerator.h in Headers */,
</span><del>-                               0F2FCCFD18A60070001A27F8 /* DFGScannable.h in Headers */,
</del><span class="cx">                           86ECA3FA132DF25A002B2AD7 /* DFGScoreBoard.h in Headers */,
</span><span class="cx">                          0F1E3A67153A21E2000F9456 /* DFGSilentRegisterSavePlan.h in Headers */,
</span><span class="cx">                          0FFB921D16D02F300055A5DB /* DFGSlowPathGenerator.h in Headers */,
</span><span class="lines">@@ -9697,7 +9690,6 @@
</span><span class="cx">                          0FC20CB61852E2C600C9E954 /* DFGStrengthReductionPhase.h in Headers */,
</span><span class="cx">                          0F63947815DCE34B006A597C /* DFGStructureAbstractValue.h in Headers */,
</span><span class="cx">                          0F50AF3C193E8B3900674EE8 /* DFGStructureClobberState.h in Headers */,
</span><del>-                               0F2FCCFF18A60070001A27F8 /* DFGThreadData.h in Headers */,
</del><span class="cx">                           0FC097A2146B28CC00CF2442 /* DFGThunks.h in Headers */,
</span><span class="cx">                          0FD8A32817D51F5700CA2C40 /* DFGTierUpCheckInjectionPhase.h in Headers */,
</span><span class="cx">                          0FD8A32A17D51F5700CA2C40 /* DFGToFTLDeferredCompilationCallback.h in Headers */,
</span><span class="lines">@@ -9717,8 +9709,6 @@
</span><span class="cx">                          0F2BDC4B1522809D00CD8910 /* DFGVariableEventStream.h in Headers */,
</span><span class="cx">                          0FFFC96014EF90BD00C72532 /* DFGVirtualRegisterAllocationPhase.h in Headers */,
</span><span class="cx">                          0FC97F4218202119002C9B26 /* DFGWatchpointCollectionPhase.h in Headers */,
</span><del>-                               0FDB2CE8174830A2007B3C1B /* DFGWorklist.h in Headers */,
-                               0F1FB3971E1AF7E300A9BE50 /* DFGWorklistInlines.h in Headers */,
</del><span class="cx">                           0FE050181AA9091100D33B33 /* DirectArguments.h in Headers */,
</span><span class="cx">                          0FE050161AA9091100D33B33 /* DirectArgumentsOffset.h in Headers */,
</span><span class="cx">                          969A07980ED1D3AE00F1F681 /* DirectEvalCodeCache.h in Headers */,
</span><span class="lines">@@ -9752,6 +9742,7 @@
</span><span class="cx">                          147341D21DC02E2E00AA29BA /* EvalExecutable.h in Headers */,
</span><span class="cx">                          FE1C0FFD1B193E9800B53FCA /* Exception.h in Headers */,
</span><span class="cx">                          FE6029D91D6E1E4F0030204D /* ExceptionEventLocation.h in Headers */,
</span><ins>+                               FEF5B430262A338B0016E776 /* ExceptionExpectation.h in Headers */,
</ins><span class="cx">                           0F12DE101979D5FD0006FF4E /* ExceptionFuzz.h in Headers */,
</span><span class="cx">                          BC18C4000E16F5CD00B34460 /* ExceptionHelpers.h in Headers */,
</span><span class="cx">                          FE6491371D78F01D00A694D4 /* ExceptionScope.h in Headers */,
</span><span class="lines">@@ -9788,7 +9779,6 @@
</span><span class="cx">                          0FEA0A0C170513DB00BB722C /* FTLCompile.h in Headers */,
</span><span class="cx">                          0F9D4C0D1C3E1C11006CD984 /* FTLExceptionTarget.h in Headers */,
</span><span class="cx">                          0F235BD417178E1C00690C7F /* FTLExitArgument.h in Headers */,
</span><del>-                               FEF5B4232628A0EE0016E776 /* HashMapImplInlines.h in Headers */,
</del><span class="cx">                           0F235BD617178E1C00690C7F /* FTLExitArgumentForOperand.h in Headers */,
</span><span class="cx">                          0F2B9CF519D0BAC100B1D1B5 /* FTLExitPropertyValue.h in Headers */,
</span><span class="cx">                          0F2B9CF719D0BAC100B1D1B5 /* FTLExitTimeObjectMaterialization.h in Headers */,
</span><span class="lines">@@ -9832,7 +9822,6 @@
</span><span class="cx">                          2A83638A18D7D0FE0000EBCC /* FullGCActivityCallback.h in Headers */,
</span><span class="cx">                          52EED7942492B870008F4C93 /* FunctionAllowlist.h in Headers */,
</span><span class="cx">                          14AD910D1DCA92940014F9FE /* FunctionCodeBlock.h in Headers */,
</span><del>-                               FEF5B42C2628CBC80016E776 /* VMTrapsInlines.h in Headers */,
</del><span class="cx">                           BC18C4040E16F5CD00B34460 /* FunctionConstructor.h in Headers */,
</span><span class="cx">                          147341D81DC02F9900AA29BA /* FunctionExecutable.h in Headers */,
</span><span class="cx">                          0FF0F1A016B72A1A005DF95B /* FunctionExecutableDump.h in Headers */,
</span><span class="lines">@@ -9911,6 +9900,7 @@
</span><span class="cx">                          142E3136134FF0A600AFADB5 /* HandleSet.h in Headers */,
</span><span class="cx">                          1478297B1379E8A800A7C2A3 /* HandleTypes.h in Headers */,
</span><span class="cx">                          79A090801D768465008B889B /* HashMapImpl.h in Headers */,
</span><ins>+                               FEF5B4232628A0EE0016E776 /* HashMapImplInlines.h in Headers */,
</ins><span class="cx">                           79DFCBDB1D88C59600527D03 /* HasOwnPropertyCache.h in Headers */,
</span><span class="cx">                          14BA7A9813AADFF8005B7C2C /* Heap.h in Headers */,
</span><span class="cx">                          9177A1DC22F958D500B34CA2 /* HeapAnalyzer.h in Headers */,
</span><span class="lines">@@ -10062,6 +10052,8 @@
</span><span class="cx">                          FE476FF4207E85D50093CA2D /* JITCodeMap.h in Headers */,
</span><span class="cx">                          86D446EC25B2126000ECAE75 /* JITCompilation.h in Headers */,
</span><span class="cx">                          0F0776BF14FF002B00102332 /* JITCompilationEffort.h in Headers */,
</span><ins>+                               726B91BA2658263D008E6F82 /* JITCompilationKey.h in Headers */,
+                               726B91B326581653008E6F82 /* JITCompilationMode.h in Headers */,
</ins><span class="cx">                           0FAF7EFE165BA91F000C8455 /* JITDisassembler.h in Headers */,
</span><span class="cx">                          FE187A0D1C030D5C0038BBCA /* JITDivGenerator.h in Headers */,
</span><span class="cx">                          0F46808214BA572D00BFE272 /* JITExceptions.h in Headers */,
</span><span class="lines">@@ -10077,12 +10069,18 @@
</span><span class="cx">                          86D446EA25B2125300ECAE75 /* JITOpaqueByproducts.h in Headers */,
</span><span class="cx">                          E3CA3A4E2527AB2F004802BF /* JITOperationList.h in Headers */,
</span><span class="cx">                          0F24E54D17EE274900ABB217 /* JITOperations.h in Headers */,
</span><ins>+                               726B91B726581653008E6F82 /* JITPlan.h in Headers */,
+                               72131BFA26587EF2007114CF /* JITPlanStage.h in Headers */,
</ins><span class="cx">                           FE3A06C01C11041A00390FDD /* JITRightShiftGenerator.h in Headers */,
</span><ins>+                               72131BF926587EF2007114CF /* JITSafepoint.h in Headers */,
+                               72131BF826587EF2007114CF /* JITScannable.h in Headers */,
</ins><span class="cx">                           0F766D3115AA8112008F363E /* JITStubRoutine.h in Headers */,
</span><span class="cx">                          0F766D2C15A8CC3A008F363E /* JITStubRoutineSet.h in Headers */,
</span><span class="cx">                          0F5EF91F16878F7D003E5C25 /* JITThunks.h in Headers */,
</span><span class="cx">                          0FC712E317CD8793008CC93C /* JITToDFGDeferredCompilationCallback.h in Headers */,
</span><span class="cx">                          DC0184191D10C1890057B053 /* JITWorklist.h in Headers */,
</span><ins>+                               72131BFC26587EFA007114CF /* JITWorklistInlines.h in Headers */,
+                               726B91B026581653008E6F82 /* JITWorklistThread.h in Headers */,
</ins><span class="cx">                           53C4F66B21B1A409002FD009 /* JSAPIGlobalObject.h in Headers */,
</span><span class="cx">                          840480131021A1D9008E7F01 /* JSAPIValueWrapper.h in Headers */,
</span><span class="cx">                          C2CF39C216E15A8100DD69BE /* JSAPIWrapperObject.h in Headers */,
</span><span class="lines">@@ -10184,6 +10182,7 @@
</span><span class="cx">                          C25D709C16DE99F400FCA6BC /* JSManagedValue.h in Headers */,
</span><span class="cx">                          2A4BB7F318A41179008A0FCD /* JSManagedValueInternal.h in Headers */,
</span><span class="cx">                          A700874217CBE8EB00C3E643 /* JSMap.h in Headers */,
</span><ins>+                               FEF5B4252628A8500016E776 /* JSMapInlines.h in Headers */,
</ins><span class="cx">                           A74DEF96182D991400522C22 /* JSMapIterator.h in Headers */,
</span><span class="cx">                          0F0B286D1EB8E6D5000EB5D2 /* JSMarkingConstraintPrivate.h in Headers */,
</span><span class="cx">                          7013CA8C1B491A9400CAE613 /* JSMicrotask.h in Headers */,
</span><span class="lines">@@ -10219,6 +10218,7 @@
</span><span class="cx">                          14D01A7721FB351F00BC54E9 /* JSScriptSourceProvider.h in Headers */,
</span><span class="cx">                          0F919D11157F332C004A4E7D /* JSSegmentedVariableObject.h in Headers */,
</span><span class="cx">                          A7299D9E17D12837005F5FF9 /* JSSet.h in Headers */,
</span><ins>+                               FEF5B4292628B5240016E776 /* JSSetInlines.h in Headers */,
</ins><span class="cx">                           A790DD70182F499700588807 /* JSSetIterator.h in Headers */,
</span><span class="cx">                          BDFCB2BBE90F41349E1B0BED /* JSSourceCode.h in Headers */,
</span><span class="cx">                          BC18C4270E16F5CD00B34460 /* JSString.h in Headers */,
</span><span class="lines">@@ -10247,12 +10247,12 @@
</span><span class="cx">                          86E3C612167BABD7006D760A /* JSValue.h in Headers */,
</span><span class="cx">                          86E3C61B167BABEE006D760A /* JSValueInternal.h in Headers */,
</span><span class="cx">                          53E1F8F82154715A0001DDBC /* JSValuePrivate.h in Headers */,
</span><del>-                               FE8C0312264A6911001A44AD /* SlowPathFunction.h in Headers */,
</del><span class="cx">                           BC18C42C0E16F5CD00B34460 /* JSValueRef.h in Headers */,
</span><span class="cx">                          86E3C615167BABD7006D760A /* JSVirtualMachine.h in Headers */,
</span><span class="cx">                          86E3C61D167BABEE006D760A /* JSVirtualMachineInternal.h in Headers */,
</span><span class="cx">                          795AC61820A2355E0052C76C /* JSVirtualMachinePrivate.h in Headers */,
</span><span class="cx">                          A7CA3AE817DA41AE006538AF /* JSWeakMap.h in Headers */,
</span><ins>+                               FEF5B4272628ABD90016E776 /* JSWeakMapInlines.h in Headers */,
</ins><span class="cx">                           A7482E93116A7CAD003B0712 /* JSWeakObjectMapRefInternal.h in Headers */,
</span><span class="cx">                          A7482B9311671147003B0712 /* JSWeakObjectMapRefPrivate.h in Headers */,
</span><span class="cx">                          539BFBB022AD3CDC0023F4C0 /* JSWeakObjectRef.h in Headers */,
</span><span class="lines">@@ -10531,6 +10531,7 @@
</span><span class="cx">                          C2160FE715F7E95E00942DFC /* SlotVisitorInlines.h in Headers */,
</span><span class="cx">                          FE041553252EC0730091EB5D /* SlotVisitorMacros.h in Headers */,
</span><span class="cx">                          A709F2F017A0AC0400512E98 /* SlowPathCall.h in Headers */,
</span><ins>+                               FE8C0312264A6911001A44AD /* SlowPathFunction.h in Headers */,
</ins><span class="cx">                           0F5B4A331C84F0D600F1B17E /* SlowPathReturnType.h in Headers */,
</span><span class="cx">                          933040040E6A749400786E6A /* SmallStrings.h in Headers */,
</span><span class="cx">                          E3F23A821ECF13FE00978D99 /* Snippet.h in Headers */,
</span><span class="lines">@@ -10568,7 +10569,6 @@
</span><span class="cx">                          BCDE3AB80E6C82F5001453A7 /* Structure.h in Headers */,
</span><span class="cx">                          7986943B1F8C0ACC009232AE /* StructureCache.h in Headers */,
</span><span class="cx">                          7E4EE7090EBB7963005934AA /* StructureChain.h in Headers */,
</span><del>-                               FEF5B4252628A8500016E776 /* JSMapInlines.h in Headers */,
</del><span class="cx">                           2AAAA31218BD49D100394CC8 /* StructureIDBlob.h in Headers */,
</span><span class="cx">                          2AF7382D18BBBF92008A5A37 /* StructureIDTable.h in Headers */,
</span><span class="cx">                          0FD2C92416D01EE900C7803F /* StructureInlines.h in Headers */,
</span><span class="lines">@@ -10661,6 +10661,7 @@
</span><span class="cx">                          FE3022D71E42857300BAC493 /* VMInspector.h in Headers */,
</span><span class="cx">                          FEC5797323105B5100BCA83F /* VMInspectorInlines.h in Headers */,
</span><span class="cx">                          FE6F56DE1E64EAD600D17801 /* VMTraps.h in Headers */,
</span><ins>+                               FEF5B42C2628CBC80016E776 /* VMTrapsInlines.h in Headers */,
</ins><span class="cx">                           52847ADC21FFB8690061A9DB /* WasmAirIRGenerator.h in Headers */,
</span><span class="cx">                          53F40E931D5A4AB30099A1B6 /* WasmB3IRGenerator.h in Headers */,
</span><span class="cx">                          53CA730A1EA533D80076049D /* WasmBBQPlan.h in Headers */,
</span><span class="lines">@@ -10753,7 +10754,6 @@
</span><span class="cx">                          ADE8029A1E08F1DE0058DE78 /* WebAssemblyLinkErrorConstructor.h in Headers */,
</span><span class="cx">                          ADE8029C1E08F1DE0058DE78 /* WebAssemblyLinkErrorPrototype.h in Headers */,
</span><span class="cx">                          AD2FCBF51DB58DAD00B3E736 /* WebAssemblyMemoryConstructor.h in Headers */,
</span><del>-                               FEF5B430262A338B0016E776 /* ExceptionExpectation.h in Headers */,
</del><span class="cx">                           AD2FCC1A1DB59CB200B3E736 /* WebAssemblyMemoryConstructor.lut.h in Headers */,
</span><span class="cx">                          AD2FCBF71DB58DAD00B3E736 /* WebAssemblyMemoryPrototype.h in Headers */,
</span><span class="cx">                          AD2FCC1B1DB59CB200B3E736 /* WebAssemblyMemoryPrototype.lut.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreSourcestxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/Sources.txt (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/Sources.txt  2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/Sources.txt     2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><del>-// Copyright (C) 2017-2019 Apple Inc. All rights reserved.
</del><ins>+// Copyright (C) 2017-2021 Apple Inc. All rights reserved.
</ins><span class="cx"> //
</span><span class="cx"> // Redistribution and use in source and binary forms, with or without
</span><span class="cx"> // modification, are permitted provided that the following conditions
</span><span class="lines">@@ -341,8 +341,6 @@
</span><span class="cx"> dfg/DFGCombinedLiveness.cpp
</span><span class="cx"> dfg/DFGCommon.cpp
</span><span class="cx"> dfg/DFGCommonData.cpp
</span><del>-dfg/DFGCompilationKey.cpp
-dfg/DFGCompilationMode.cpp
</del><span class="cx"> dfg/DFGConstantFoldingPhase.cpp
</span><span class="cx"> dfg/DFGConstantHoistingPhase.cpp
</span><span class="cx"> dfg/DFGCriticalEdgeBreakingPhase.cpp
</span><span class="lines">@@ -416,7 +414,6 @@
</span><span class="cx"> dfg/DFGSSACalculator.cpp
</span><span class="cx"> dfg/DFGSSAConversionPhase.cpp
</span><span class="cx"> dfg/DFGSSALoweringPhase.cpp
</span><del>-dfg/DFGSafepoint.cpp
</del><span class="cx"> dfg/DFGSnippetParams.cpp
</span><span class="cx"> // These files take a long time to compile so we do them individually.
</span><span class="cx"> dfg/DFGSpeculativeJIT.cpp @no-unify
</span><span class="lines">@@ -428,7 +425,6 @@
</span><span class="cx"> dfg/DFGStoreBarrierInsertionPhase.cpp
</span><span class="cx"> dfg/DFGStrengthReductionPhase.cpp
</span><span class="cx"> dfg/DFGStructureAbstractValue.cpp
</span><del>-dfg/DFGThreadData.cpp
</del><span class="cx"> dfg/DFGThunks.cpp
</span><span class="cx"> dfg/DFGTierUpCheckInjectionPhase.cpp
</span><span class="cx"> dfg/DFGToFTLDeferredCompilationCallback.cpp
</span><span class="lines">@@ -448,7 +444,6 @@
</span><span class="cx"> dfg/DFGVariableEventStream.cpp
</span><span class="cx"> dfg/DFGVirtualRegisterAllocationPhase.cpp
</span><span class="cx"> dfg/DFGWatchpointCollectionPhase.cpp
</span><del>-dfg/DFGWorklist.cpp
</del><span class="cx"> 
</span><span class="cx"> disassembler/ARM64Disassembler.cpp
</span><span class="cx"> disassembler/CapstoneDisassembler.cpp
</span><span class="lines">@@ -624,6 +619,7 @@
</span><span class="cx"> interpreter/StackVisitor.cpp
</span><span class="cx"> 
</span><span class="cx"> jit/AssemblyHelpers.cpp
</span><ins>+jit/BaselineJITPlan.cpp
</ins><span class="cx"> jit/BinarySwitch.cpp
</span><span class="cx"> jit/CCallHelpers.cpp
</span><span class="cx"> jit/CachedRecovery.cpp
</span><span class="lines">@@ -648,6 +644,8 @@
</span><span class="cx"> jit/JITCall32_64.cpp
</span><span class="cx"> jit/JITCode.cpp
</span><span class="cx"> jit/JITCompilation.cpp
</span><ins>+jit/JITCompilationKey.cpp
+jit/JITCompilationMode.cpp
</ins><span class="cx"> jit/JITDisassembler.cpp
</span><span class="cx"> jit/JITDivGenerator.cpp
</span><span class="cx"> jit/JITExceptions.cpp
</span><span class="lines">@@ -659,14 +657,17 @@
</span><span class="cx"> jit/JITOpcodes.cpp
</span><span class="cx"> jit/JITOpcodes32_64.cpp
</span><span class="cx"> jit/JITOperations.cpp
</span><ins>+jit/JITPlan.cpp
</ins><span class="cx"> jit/JITPropertyAccess.cpp
</span><span class="cx"> jit/JITPropertyAccess32_64.cpp
</span><span class="cx"> jit/JITRightShiftGenerator.cpp
</span><ins>+jit/JITSafepoint.cpp
</ins><span class="cx"> jit/JITStubRoutine.cpp
</span><span class="cx"> jit/JITSubGenerator.cpp
</span><span class="cx"> jit/JITThunks.cpp
</span><span class="cx"> jit/JITToDFGDeferredCompilationCallback.cpp
</span><span class="cx"> jit/JITWorklist.cpp
</span><ins>+jit/JITWorklistThread.cpp
</ins><span class="cx"> jit/PCToCodeOriginMap.cpp
</span><span class="cx"> jit/PolymorphicCallStubRoutine.cpp
</span><span class="cx"> jit/Reg.cpp
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeCodeBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp       2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp  2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -43,7 +43,6 @@
</span><span class="cx"> #include "DFGCapabilities.h"
</span><span class="cx"> #include "DFGCommon.h"
</span><span class="cx"> #include "DFGJITCode.h"
</span><del>-#include "DFGWorklist.h"
</del><span class="cx"> #include "EvalCodeBlock.h"
</span><span class="cx"> #include "FullCodeOrigin.h"
</span><span class="cx"> #include "FunctionCodeBlock.h"
</span><span class="lines">@@ -55,6 +54,7 @@
</span><span class="cx"> #include "IsoCellSetInlines.h"
</span><span class="cx"> #include "JIT.h"
</span><span class="cx"> #include "JITMathIC.h"
</span><ins>+#include "JITWorklist.h"
</ins><span class="cx"> #include "JSCInlines.h"
</span><span class="cx"> #include "JSCJSValue.h"
</span><span class="cx"> #include "JSLexicalEnvironment.h"
</span><span class="lines">@@ -2598,9 +2598,8 @@
</span><span class="cx"> bool CodeBlock::checkIfOptimizationThresholdReached()
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(DFG_JIT)
</span><del>-    if (DFG::Worklist* worklist = DFG::existingGlobalDFGWorklistOrNull()) {
-        if (worklist->compilationState(DFG::CompilationKey(this, DFG::DFGMode))
-            == DFG::Worklist::Compiled) {
</del><ins>+    if (JITWorklist* worklist = JITWorklist::existingGlobalWorklistOrNull()) {
+        if (worklist->compilationState(JITCompilationKey(this, JITCompilationMode::DFG)) == JITWorklist::Compiled) {
</ins><span class="cx">             optimizeNextInvocation();
</span><span class="cx">             return true;
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGByteCodeParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp    2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp       2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -6970,7 +6970,7 @@
</span><span class="cx">                 NEXT_OPCODE(op_catch);
</span><span class="cx">             }
</span><span class="cx"> 
</span><del>-            if (m_graph.m_plan.mode() == FTLForOSREntryMode) {
</del><ins>+            if (m_graph.m_plan.mode() == JITCompilationMode::FTLForOSREntry) {
</ins><span class="cx">                 NEXT_OPCODE(op_catch);
</span><span class="cx">             }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGCommonh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGCommon.h (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGCommon.h      2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/dfg/DFGCommon.h 2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2011-2020 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2011-2021 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -25,7 +25,7 @@
</span><span class="cx"> 
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><del>-#include "DFGCompilationMode.h"
</del><ins>+#include "JITCompilationMode.h"
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(DFG_JIT)
</span><span class="cx"> 
</span><span class="lines">@@ -66,17 +66,17 @@
</span><span class="cx">     SwitchCell
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-inline bool verboseCompilationEnabled(CompilationMode mode = DFGMode)
</del><ins>+inline bool verboseCompilationEnabled(JITCompilationMode mode = JITCompilationMode::DFG)
</ins><span class="cx"> {
</span><span class="cx">     return Options::verboseCompilation() || Options::dumpGraphAtEachPhase() || (isFTL(mode) && Options::verboseFTLCompilation());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline bool logCompilationChanges(CompilationMode mode = DFGMode)
</del><ins>+inline bool logCompilationChanges(JITCompilationMode mode = JITCompilationMode::DFG)
</ins><span class="cx"> {
</span><span class="cx">     return verboseCompilationEnabled(mode) || Options::logCompilationChanges();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline bool shouldDumpGraphAtEachPhase(CompilationMode mode)
</del><ins>+inline bool shouldDumpGraphAtEachPhase(JITCompilationMode mode = JITCompilationMode::DFG)
</ins><span class="cx"> {
</span><span class="cx">     if (isFTL(mode))
</span><span class="cx">         return Options::dumpGraphAtEachPhase() || Options::dumpDFGFTLGraphAtEachPhase();
</span><span class="lines">@@ -359,7 +359,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // Unconditionally disable DFG disassembly support if the DFG is not compiled in.
</span><del>-inline bool shouldDumpDisassembly(CompilationMode mode = DFGMode)
</del><ins>+inline bool shouldDumpDisassembly(JITCompilationMode mode = JITCompilationMode::DFG)
</ins><span class="cx"> {
</span><span class="cx"> #if ENABLE(DFG_JIT)
</span><span class="cx">     return Options::dumpDisassembly() || Options::dumpDFGDisassembly() || (isFTL(mode) && Options::dumpFTLDisassembly());
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGCompilationKeycpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/JavaScriptCore/dfg/DFGCompilationKey.cpp (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGCompilationKey.cpp    2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/dfg/DFGCompilationKey.cpp       2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -1,47 +0,0 @@
</span><del>-/*
- * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#include "config.h"
-#include "DFGCompilationKey.h"
-
-#if ENABLE(DFG_JIT)
-
-#include "CodeBlock.h"
-
-namespace JSC { namespace DFG {
-
-void CompilationKey::dump(PrintStream& out) const
-{
-    if (!*this) {
-        out.print("<empty>");
-        return;
-    }
-    out.print("(Compile of ", *m_profiledBlock, " with ", m_mode, ")");
-}
-
-} } // namespace JSC::DFG
-
-
-#endif
</del></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGCompilationKeyh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/JavaScriptCore/dfg/DFGCompilationKey.h (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGCompilationKey.h      2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/dfg/DFGCompilationKey.h 2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -1,105 +0,0 @@
</span><del>-/*
- * Copyright (C) 2013-2019 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#pragma once
-
-#include "DFGCompilationMode.h"
-#include <wtf/HashMap.h>
-
-namespace JSC {
-
-class CodeBlock;
-class CodeBlockSet;
-
-namespace DFG {
-
-class CompilationKey {
-public:
-    CompilationKey()
-        : m_profiledBlock(nullptr)
-        , m_mode(InvalidCompilationMode)
-    {
-    }
-    
-    CompilationKey(WTF::HashTableDeletedValueType)
-        : m_profiledBlock(nullptr)
-        , m_mode(DFGMode)
-    {
-    }
-    
-    CompilationKey(CodeBlock* profiledBlock, CompilationMode mode)
-        : m_profiledBlock(profiledBlock)
-        , m_mode(mode)
-    {
-    }
-    
-    bool operator!() const
-    {
-        return !m_profiledBlock && m_mode == InvalidCompilationMode;
-    }
-    
-    bool isHashTableDeletedValue() const
-    {
-        return !m_profiledBlock && m_mode != InvalidCompilationMode;
-    }
-    
-    CodeBlock* profiledBlock() const { return m_profiledBlock; }
-    CompilationMode mode() const { return m_mode; }
-    
-    bool operator==(const CompilationKey& other) const
-    {
-        return m_profiledBlock == other.m_profiledBlock
-            && m_mode == other.m_mode;
-    }
-    
-    unsigned hash() const
-    {
-        return WTF::pairIntHash(WTF::PtrHash<CodeBlock*>::hash(m_profiledBlock), m_mode);
-    }
-    
-    void dump(PrintStream&) const;
-
-private:
-    CodeBlock* m_profiledBlock;
-    CompilationMode m_mode;
-};
-
-struct CompilationKeyHash {
-    static unsigned hash(const CompilationKey& key) { return key.hash(); }
-    static bool equal(const CompilationKey& a, const CompilationKey& b) { return a == b; }
-    static constexpr bool safeToCompareToEmptyOrDeleted = true;
-};
-
-} } // namespace JSC::DFG
-
-namespace WTF {
-
-template<typename T> struct DefaultHash;
-template<> struct DefaultHash<JSC::DFG::CompilationKey> : JSC::DFG::CompilationKeyHash { };
-
-template<typename T> struct HashTraits;
-template<> struct HashTraits<JSC::DFG::CompilationKey> : SimpleClassHashTraits<JSC::DFG::CompilationKey> { };
-
-} // namespace WTF
</del></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGCompilationModecpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/JavaScriptCore/dfg/DFGCompilationMode.cpp (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGCompilationMode.cpp   2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/dfg/DFGCompilationMode.cpp      2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -1,56 +0,0 @@
</span><del>-/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#include "config.h"
-#include "DFGCompilationMode.h"
-
-#if ENABLE(DFG_JIT)
-
-namespace WTF {
-
-using namespace JSC::DFG;
-
-void printInternal(PrintStream& out, CompilationMode mode)
-{
-    switch (mode) {
-    case InvalidCompilationMode:
-        out.print("InvalidCompilationMode");
-        return;
-    case DFGMode:
-        out.print("DFGMode");
-        return;
-    case FTLMode:
-        out.print("FTLMode");
-        return;
-    case FTLForOSREntryMode:
-        out.print("FTLForOSREntryMode");
-        return;
-    }
-    RELEASE_ASSERT_NOT_REACHED();
-}
-
-} // namespace WTF
-
-#endif
</del></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGCompilationModeh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/JavaScriptCore/dfg/DFGCompilationMode.h (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGCompilationMode.h     2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/dfg/DFGCompilationMode.h        2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -1,56 +0,0 @@
</span><del>-/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#pragma once
-
-#include <wtf/PrintStream.h>
-
-namespace JSC { namespace DFG {
-
-enum CompilationMode {
-    InvalidCompilationMode,
-    DFGMode,
-    FTLMode,
-    FTLForOSREntryMode
-};
-
-inline bool isFTL(CompilationMode mode)
-{
-    switch (mode) {
-    case FTLMode:
-    case FTLForOSREntryMode:
-        return true;
-    default:
-        return false;
-    }
-}
-
-} } // namespace JSC::DFG
-
-namespace WTF {
-
-void printInternal(PrintStream&, JSC::DFG::CompilationMode);
-
-} // namespace WTF
</del></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGDrivercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGDriver.cpp (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGDriver.cpp    2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/dfg/DFGDriver.cpp       2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2011-2017 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2011-2021 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -30,9 +30,9 @@
</span><span class="cx"> #include "DFGJITCode.h"
</span><span class="cx"> #include "DFGPlan.h"
</span><span class="cx"> #include "DFGThunks.h"
</span><del>-#include "DFGWorklist.h"
</del><span class="cx"> #include "FunctionAllowlist.h"
</span><span class="cx"> #include "JITCode.h"
</span><ins>+#include "JITWorklist.h"
</ins><span class="cx"> #include "Options.h"
</span><span class="cx"> #include "ThunkGenerators.h"
</span><span class="cx"> #include "TypeProfilerLog.h"
</span><span class="lines">@@ -60,7 +60,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static CompilationResult compileImpl(
</span><del>-    VM& vm, CodeBlock* codeBlock, CodeBlock* profiledDFGCodeBlock, CompilationMode mode,
</del><ins>+    VM& vm, CodeBlock* codeBlock, CodeBlock* profiledDFGCodeBlock, JITCompilationMode mode,
</ins><span class="cx">     BytecodeIndex osrEntryBytecodeIndex, const Operands<Optional<JSValue>>& mustHandleValues,
</span><span class="cx">     Ref<DeferredCompilationCallback>&& callback)
</span><span class="cx"> {
</span><span class="lines">@@ -85,20 +85,13 @@
</span><span class="cx">         *new Plan(codeBlock, profiledDFGCodeBlock, mode, osrEntryBytecodeIndex, mustHandleValues));
</span><span class="cx"> 
</span><span class="cx">     plan->setCallback(WTFMove(callback));
</span><del>-    if (Options::useConcurrentJIT()) {
-        Worklist& worklist = ensureGlobalWorklistFor(mode);
-        if (logCompilationChanges(mode))
-            dataLog("Deferring DFG compilation of ", *codeBlock, " with queue length ", worklist.queueLength(), ".\n");
-        worklist.enqueue(WTFMove(plan));
-        return CompilationDeferred;
-    }
-    
-    plan->compileInThread(nullptr);
-    return plan->finalizeWithoutNotifyingCallback();
</del><ins>+    JITWorklist& worklist = JITWorklist::ensureGlobalWorklist();
+    dataLogLnIf(Options::useConcurrentJIT() && logCompilationChanges(mode), "Deferring DFG compilation of ", *codeBlock, " with queue length ", worklist.queueLength(), ".\n");
+    return worklist.enqueue(WTFMove(plan));
</ins><span class="cx"> }
</span><span class="cx"> #else // ENABLE(DFG_JIT)
</span><span class="cx"> static CompilationResult compileImpl(
</span><del>-    VM&, CodeBlock*, CodeBlock*, CompilationMode, BytecodeIndex, const Operands<Optional<JSValue>>&,
</del><ins>+    VM&, CodeBlock*, CodeBlock*, JITCompilationMode, BytecodeIndex, const Operands<Optional<JSValue>>&,
</ins><span class="cx">     Ref<DeferredCompilationCallback>&&)
</span><span class="cx"> {
</span><span class="cx">     return CompilationFailed;
</span><span class="lines">@@ -106,7 +99,7 @@
</span><span class="cx"> #endif // ENABLE(DFG_JIT)
</span><span class="cx"> 
</span><span class="cx"> CompilationResult compile(
</span><del>-    VM& vm, CodeBlock* codeBlock, CodeBlock* profiledDFGCodeBlock, CompilationMode mode,
</del><ins>+    VM& vm, CodeBlock* codeBlock, CodeBlock* profiledDFGCodeBlock, JITCompilationMode mode,
</ins><span class="cx">     BytecodeIndex osrEntryBytecodeIndex, const Operands<Optional<JSValue>>& mustHandleValues,
</span><span class="cx">     Ref<DeferredCompilationCallback>&& callback)
</span><span class="cx"> {
</span><span class="lines">@@ -113,8 +106,6 @@
</span><span class="cx">     CompilationResult result = compileImpl(
</span><span class="cx">         vm, codeBlock, profiledDFGCodeBlock, mode, osrEntryBytecodeIndex, mustHandleValues,
</span><span class="cx">         callback.copyRef());
</span><del>-    if (result != CompilationDeferred)
-        callback->compilationDidComplete(codeBlock, profiledDFGCodeBlock, result);
</del><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGDriverh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGDriver.h (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGDriver.h      2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/dfg/DFGDriver.h 2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2011-2018 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2011-2021 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -25,7 +25,6 @@
</span><span class="cx"> 
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><del>-#include "DFGCompilationMode.h"
</del><span class="cx"> #include "DFGPlan.h"
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="lines">@@ -41,7 +40,7 @@
</span><span class="cx"> // If the worklist is non-null, we do a concurrent compile. Otherwise we do a synchronous
</span><span class="cx"> // compile. Even if we do a synchronous compile, we call the callback with the result.
</span><span class="cx"> CompilationResult compile(
</span><del>-    VM&, CodeBlock*, CodeBlock* profiledDFGCodeBlock, CompilationMode,
</del><ins>+    VM&, CodeBlock*, CodeBlock* profiledDFGCodeBlock, JITCompilationMode,
</ins><span class="cx">     BytecodeIndex osrEntryBytecodeIndex, const Operands<Optional<JSValue>>& mustHandleValues,
</span><span class="cx">     Ref<DeferredCompilationCallback>&&);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGGraphh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGGraph.h (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGGraph.h       2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/dfg/DFGGraph.h  2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -36,8 +36,8 @@
</span><span class="cx"> #include "DFGNode.h"
</span><span class="cx"> #include "DFGPlan.h"
</span><span class="cx"> #include "DFGPropertyTypeKey.h"
</span><del>-#include "DFGScannable.h"
</del><span class="cx"> #include "FullBytecodeLiveness.h"
</span><ins>+#include "JITScannable.h"
</ins><span class="cx"> #include "MethodOfGettingAValueProfile.h"
</span><span class="cx"> #include <wtf/BitVector.h>
</span><span class="cx"> #include <wtf/HashMap.h>
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGGraphSafepointh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGGraphSafepoint.h (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGGraphSafepoint.h      2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/dfg/DFGGraphSafepoint.h 2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2014 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2014-2021 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -27,7 +27,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(DFG_JIT)
</span><span class="cx"> 
</span><del>-#include "DFGSafepoint.h"
</del><ins>+#include "JITSafepoint.h"
</ins><span class="cx"> 
</span><span class="cx"> namespace JSC { namespace DFG {
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGOSRAvailabilityAnalysisPhasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGOSRAvailabilityAnalysisPhase.cpp (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGOSRAvailabilityAnalysisPhase.cpp      2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/dfg/DFGOSRAvailabilityAnalysisPhase.cpp 2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013-2015 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013-2021 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -166,7 +166,7 @@
</span><span class="cx">                         }
</span><span class="cx"> 
</span><span class="cx">                         // FIXME: It seems like we should be able to do at least some validation when OSR entering. https://bugs.webkit.org/show_bug.cgi?id=215511
</span><del>-                        if (m_graph.m_plan.mode() != FTLForOSREntryMode) {
</del><ins>+                        if (m_graph.m_plan.mode() != JITCompilationMode::FTLForOSREntry) {
</ins><span class="cx">                             for (size_t i = 0; i < availabilityMap.m_locals.size(); ++i) {
</span><span class="cx">                                 Operand operand = availabilityMap.m_locals.operandForIndex(i);
</span><span class="cx">                                 Availability availability = availabilityMap.m_locals[i];
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGOSREntrypointCreationPhasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGOSREntrypointCreationPhase.cpp (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGOSREntrypointCreationPhase.cpp        2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/dfg/DFGOSREntrypointCreationPhase.cpp   2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013-2021 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx">     
</span><span class="cx">     bool run()
</span><span class="cx">     {
</span><del>-        RELEASE_ASSERT(m_graph.m_plan.mode() == FTLForOSREntryMode);
</del><ins>+        RELEASE_ASSERT(m_graph.m_plan.mode() == JITCompilationMode::FTLForOSREntry);
</ins><span class="cx">         RELEASE_ASSERT(m_graph.m_form == ThreadedCPS);
</span><span class="cx"> 
</span><span class="cx">         BytecodeIndex bytecodeIndex = m_graph.m_plan.osrEntryBytecodeIndex();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGOperationscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp        2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp   2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -35,7 +35,6 @@
</span><span class="cx"> #include "DFGJITCode.h"
</span><span class="cx"> #include "DFGToFTLDeferredCompilationCallback.h"
</span><span class="cx"> #include "DFGToFTLForOSREntryDeferredCompilationCallback.h"
</span><del>-#include "DFGWorklist.h"
</del><span class="cx"> #include "DateInstance.h"
</span><span class="cx"> #include "DefinePropertyAttributes.h"
</span><span class="cx"> #include "DirectArguments.h"
</span><span class="lines">@@ -44,6 +43,7 @@
</span><span class="cx"> #include "FrameTracers.h"
</span><span class="cx"> #include "HasOwnPropertyCache.h"
</span><span class="cx"> #include "Interpreter.h"
</span><ins>+#include "JITWorklist.h"
</ins><span class="cx"> #include "JSArrayInlines.h"
</span><span class="cx"> #include "JSArrayIterator.h"
</span><span class="cx"> #include "JSAsyncGenerator.h"
</span><span class="lines">@@ -3701,14 +3701,10 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    Worklist::State worklistState;
-    if (Worklist* worklist = existingGlobalFTLWorklistOrNull()) {
-        worklistState = worklist->completeAllReadyPlansForVM(
-            vm, CompilationKey(codeBlock->baselineVersion(), FTLMode));
-    } else
-        worklistState = Worklist::NotKnown;
</del><ins>+    JITWorklist::State worklistState = JITWorklist::ensureGlobalWorklist().completeAllReadyPlansForVM(
+        vm, JITCompilationKey(codeBlock->baselineVersion(), JITCompilationMode::FTL));
</ins><span class="cx">     
</span><del>-    if (worklistState == Worklist::Compiling) {
</del><ins>+    if (worklistState == JITWorklist::Compiling) {
</ins><span class="cx">         CODEBLOCK_LOG_EVENT(codeBlock, "delayFTLCompile", ("still compiling"));
</span><span class="cx">         jitCode->setOptimizationThresholdBasedOnCompilationResult(
</span><span class="cx">             codeBlock, CompilationDeferred);
</span><span class="lines">@@ -3723,7 +3719,7 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    if (worklistState == Worklist::Compiled) {
</del><ins>+    if (worklistState == JITWorklist::Compiled) {
</ins><span class="cx">         CODEBLOCK_LOG_EVENT(codeBlock, "delayFTLCompile", ("compiled and failed"));
</span><span class="cx">         // This means that we finished compiling, but failed somehow; in that case the
</span><span class="cx">         // thresholds will be set appropriately.
</span><span class="lines">@@ -3734,7 +3730,7 @@
</span><span class="cx">     CODEBLOCK_LOG_EVENT(codeBlock, "triggerFTLReplacement", ());
</span><span class="cx">     // We need to compile the code.
</span><span class="cx">     compile(
</span><del>-        vm, codeBlock->newReplacement(), codeBlock, FTLMode, BytecodeIndex(),
</del><ins>+        vm, codeBlock->newReplacement(), codeBlock, JITCompilationMode::FTL, BytecodeIndex(),
</ins><span class="cx">         Operands<Optional<JSValue>>(), ToFTLDeferredCompilationCallback::create());
</span><span class="cx"> 
</span><span class="cx">     // If we reached here, the counter has not be reset. Do that now.
</span><span class="lines">@@ -3790,12 +3786,8 @@
</span><span class="cx">     CodeBlock* codeBlock = callFrame->codeBlock();
</span><span class="cx"> 
</span><span class="cx">     // Resolve any pending plan for OSR Enter on this function.
</span><del>-    Worklist::State worklistState;
-    if (Worklist* worklist = existingGlobalFTLWorklistOrNull()) {
-        worklistState = worklist->completeAllReadyPlansForVM(
-            vm, CompilationKey(codeBlock->baselineVersion(), FTLForOSREntryMode));
-    } else
-        worklistState = Worklist::NotKnown;
</del><ins>+    JITWorklist::State worklistState = JITWorklist::ensureGlobalWorklist().completeAllReadyPlansForVM(
+        vm, JITCompilationKey(codeBlock->baselineVersion(), JITCompilationMode::FTLForOSREntry));
</ins><span class="cx"> 
</span><span class="cx">     JITCode* jitCode = codeBlock->jitCode()->dfg();
</span><span class="cx">     
</span><span class="lines">@@ -3823,7 +3815,7 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (worklistState == Worklist::Compiling) {
</del><ins>+    if (worklistState == JITWorklist::Compiling) {
</ins><span class="cx">         CODEBLOCK_LOG_EVENT(codeBlock, "delayFTLCompile", ("still compiling"));
</span><span class="cx">         jitCode->setOptimizationThresholdBasedOnCompilationResult(codeBlock, CompilationDeferred);
</span><span class="cx">         return nullptr;
</span><span class="lines">@@ -3874,7 +3866,7 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (worklistState == Worklist::Compiled) {
</del><ins>+    if (worklistState == JITWorklist::Compiled) {
</ins><span class="cx">         CODEBLOCK_LOG_EVENT(codeBlock, "delayFTLCompile", ("compiled and failed"));
</span><span class="cx">         // This means that compilation failed and we already set the thresholds.
</span><span class="cx">         dataLogLnIf(Options::verboseOSR(), "Code block ", *codeBlock, " was compiled but it doesn't have an optimized replacement.");
</span><span class="lines">@@ -3985,7 +3977,7 @@
</span><span class="cx"> 
</span><span class="cx">     CODEBLOCK_LOG_EVENT(codeBlock, "triggerFTLOSR", ());
</span><span class="cx">     CompilationResult forEntryResult = compile(
</span><del>-        vm, replacementCodeBlock, codeBlock, FTLForOSREntryMode, originBytecodeIndex,
</del><ins>+        vm, replacementCodeBlock, codeBlock, JITCompilationMode::FTLForOSREntry, originBytecodeIndex,
</ins><span class="cx">         mustHandleValues, ToFTLForOSREntryDeferredCompilationCallback::create(triggerAddress));
</span><span class="cx"> 
</span><span class="cx">     if (jitCode->neverExecutedEntry)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGPlancpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGPlan.cpp (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGPlan.cpp      2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/dfg/DFGPlan.cpp 2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -88,15 +88,6 @@
</span><span class="cx"> #include "FTLState.h"
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-namespace JSC {
-
-extern Seconds totalDFGCompileTime;
-extern Seconds totalFTLCompileTime;
-extern Seconds totalFTLDFGCompileTime;
-extern Seconds totalFTLB3CompileTime;
-
-}
-
</del><span class="cx"> namespace JSC { namespace DFG {
</span><span class="cx"> 
</span><span class="cx"> namespace {
</span><span class="lines">@@ -113,17 +104,18 @@
</span><span class="cx">         validate(graph, modeForFinalValidate);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Profiler::CompilationKind profilerCompilationKindForMode(CompilationMode mode)
</del><ins>+Profiler::CompilationKind profilerCompilationKindForMode(JITCompilationMode mode)
</ins><span class="cx"> {
</span><span class="cx">     switch (mode) {
</span><del>-    case InvalidCompilationMode:
</del><ins>+    case JITCompilationMode::InvalidCompilation:
+    case JITCompilationMode::Baseline:
</ins><span class="cx">         RELEASE_ASSERT_NOT_REACHED();
</span><span class="cx">         return Profiler::DFG;
</span><del>-    case DFGMode:
</del><ins>+    case JITCompilationMode::DFG:
</ins><span class="cx">         return Profiler::DFG;
</span><del>-    case FTLMode:
</del><ins>+    case JITCompilationMode::FTL:
</ins><span class="cx">         return Profiler::FTL;
</span><del>-    case FTLForOSREntryMode:
</del><ins>+    case JITCompilationMode::FTLForOSREntry:
</ins><span class="cx">         return Profiler::FTLForOSREntry;
</span><span class="cx">     }
</span><span class="cx">     RELEASE_ASSERT_NOT_REACHED();
</span><span class="lines">@@ -133,20 +125,17 @@
</span><span class="cx"> } // anonymous namespace
</span><span class="cx"> 
</span><span class="cx"> Plan::Plan(CodeBlock* passedCodeBlock, CodeBlock* profiledDFGCodeBlock,
</span><del>-    CompilationMode mode, BytecodeIndex osrEntryBytecodeIndex,
</del><ins>+    JITCompilationMode mode, BytecodeIndex osrEntryBytecodeIndex,
</ins><span class="cx">     const Operands<Optional<JSValue>>& mustHandleValues)
</span><del>-    : m_mode(mode)
-    , m_vm(&passedCodeBlock->vm())
-    , m_codeBlock(passedCodeBlock)
-    , m_profiledDFGCodeBlock(profiledDFGCodeBlock)
-    , m_mustHandleValues(mustHandleValues)
-    , m_osrEntryBytecodeIndex(osrEntryBytecodeIndex)
-    , m_compilation(UNLIKELY(m_vm->m_perBytecodeProfiler) ? adoptRef(new Profiler::Compilation(m_vm->m_perBytecodeProfiler->ensureBytecodesFor(m_codeBlock), profilerCompilationKindForMode(mode))) : nullptr)
-    , m_inlineCallFrames(adoptRef(new InlineCallFrameSet()))
-    , m_identifiers(m_codeBlock)
-    , m_weakReferences(m_codeBlock)
-    , m_transitions(m_codeBlock)
-    , m_stage(Preparing)
</del><ins>+        : Base(mode, passedCodeBlock)
+        , m_profiledDFGCodeBlock(profiledDFGCodeBlock)
+        , m_mustHandleValues(mustHandleValues)
+        , m_osrEntryBytecodeIndex(osrEntryBytecodeIndex)
+        , m_compilation(UNLIKELY(m_vm->m_perBytecodeProfiler) ? adoptRef(new Profiler::Compilation(m_vm->m_perBytecodeProfiler->ensureBytecodesFor(m_codeBlock), profilerCompilationKindForMode(mode))) : nullptr)
+        , m_inlineCallFrames(adoptRef(new InlineCallFrameSet()))
+        , m_identifiers(m_codeBlock)
+        , m_weakReferences(m_codeBlock)
+        , m_transitions(m_codeBlock)
</ins><span class="cx"> {
</span><span class="cx">     RELEASE_ASSERT(m_codeBlock->alternative()->jitCode());
</span><span class="cx">     m_inlineCallFrames->disableThreadingChecks();
</span><span class="lines">@@ -156,84 +145,38 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool Plan::computeCompileTimes() const
</del><ins>+size_t Plan::codeSize() const
</ins><span class="cx"> {
</span><del>-    return reportCompileTimes()
-        || Options::reportTotalCompileTimes()
-        || (m_vm && m_vm->m_perBytecodeProfiler);
</del><ins>+    if (!m_finalizer)
+        return 0;
+    return m_finalizer->codeSize();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool Plan::reportCompileTimes() const
</del><ins>+void Plan::finalizeInGC()
</ins><span class="cx"> {
</span><del>-    return Options::reportCompileTimes()
-        || Options::reportDFGCompileTimes()
-        || (Options::reportFTLCompileTimes() && isFTL());
</del><ins>+    ASSERT(m_vm);
+    m_recordedStatuses.finalizeWithoutDeleting(*m_vm);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Plan::compileInThread(ThreadData* threadData)
</del><ins>+void Plan::notifyReady()
</ins><span class="cx"> {
</span><del>-    m_threadData = threadData;
</del><ins>+    Base::notifyReady();
+    m_callback->compilationDidBecomeReadyAsynchronously(m_codeBlock, m_profiledDFGCodeBlock);
+}
</ins><span class="cx"> 
</span><del>-    MonotonicTime before { };
-    CString codeBlockName;
-    if (UNLIKELY(computeCompileTimes()))
-        before = MonotonicTime::now();
-    if (UNLIKELY(reportCompileTimes()))
-        codeBlockName = toCString(*m_codeBlock);
-
-    CompilationScope compilationScope;
-
-    if (logCompilationChanges(m_mode) || Options::logPhaseTimes())
-        dataLog("DFG(Plan) compiling ", *m_codeBlock, " with ", m_mode, ", instructions size = ", m_codeBlock->instructionsSize(), "\n");
-
-    CompilationPath path = compileInThreadImpl();
-
-    RELEASE_ASSERT(path == CancelPath || m_finalizer);
-    RELEASE_ASSERT((path == CancelPath) == (m_stage == Cancelled));
-
-    MonotonicTime after { };
-    if (UNLIKELY(computeCompileTimes())) {
-        after = MonotonicTime::now();
-    
-        if (Options::reportTotalCompileTimes()) {
-            if (isFTL()) {
-                totalFTLCompileTime += after - before;
-                totalFTLDFGCompileTime += m_timeBeforeFTL - before;
-                totalFTLB3CompileTime += after - m_timeBeforeFTL;
-            } else
-                totalDFGCompileTime += after - before;
-        }
-    }
-    const char* pathName = nullptr;
-    switch (path) {
-    case FailPath:
-        pathName = "N/A (fail)";
-        break;
-    case DFGPath:
-        pathName = "DFG";
-        break;
-    case FTLPath:
-        pathName = "FTL";
-        break;
-    case CancelPath:
-        pathName = "Cancelled";
-        break;
-    default:
-        RELEASE_ASSERT_NOT_REACHED();
-        break;
-    }
-    if (m_codeBlock) { // m_codeBlock will be null if the compilation was cancelled.
-        if (path == FTLPath)
-            CODEBLOCK_LOG_EVENT(m_codeBlock, "ftlCompile", ("took ", (after - before).milliseconds(), " ms (DFG: ", (m_timeBeforeFTL - before).milliseconds(), ", B3: ", (after - m_timeBeforeFTL).milliseconds(), ") with ", pathName));
-        else
-            CODEBLOCK_LOG_EVENT(m_codeBlock, "dfgCompile", ("took ", (after - before).milliseconds(), " ms with ", pathName));
-    }
-    if (UNLIKELY(reportCompileTimes())) {
-        dataLog("Optimized ", codeBlockName, " using ", m_mode, " with ", pathName, " into ", m_finalizer ? m_finalizer->codeSize() : 0, " bytes in ", (after - before).milliseconds(), " ms");
-        if (path == FTLPath)
-            dataLog(" (DFG: ", (m_timeBeforeFTL - before).milliseconds(), ", B3: ", (after - m_timeBeforeFTL).milliseconds(), ")");
-        dataLog(".\n");
-    }
</del><ins>+void Plan::cancel()
+{
+    Base::cancel();
+    m_profiledDFGCodeBlock = nullptr;
+    m_mustHandleValues.clear();
+    m_compilation = nullptr;
+    m_finalizer = nullptr;
+    m_inlineCallFrames = nullptr;
+    m_watchpoints = DesiredWatchpoints();
+    m_identifiers = DesiredIdentifiers();
+    m_weakReferences = DesiredWeakReferences();
+    m_transitions = DesiredTransitions();
+    m_callback = nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Plan::CompilationPath Plan::compileInThreadImpl()
</span><span class="lines">@@ -300,7 +243,7 @@
</span><span class="cx">     
</span><span class="cx">     RUN_PHASE(performStaticExecutionCountEstimation);
</span><span class="cx"> 
</span><del>-    if (m_mode == FTLForOSREntryMode) {
</del><ins>+    if (m_mode == JITCompilationMode::FTLForOSREntry) {
</ins><span class="cx">         bool result = performOSREntrypointCreation(dfg);
</span><span class="cx">         if (!result) {
</span><span class="cx">             m_finalizer = makeUnique<FailedFinalizer>(*this);
</span><span class="lines">@@ -376,7 +319,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     switch (m_mode) {
</span><del>-    case DFGMode: {
</del><ins>+    case JITCompilationMode::DFG: {
</ins><span class="cx">         dfg.m_fixpointState = FixpointConverged;
</span><span class="cx"> 
</span><span class="cx">         RUN_PHASE(performTierUpCheckInjection);
</span><span class="lines">@@ -405,8 +348,8 @@
</span><span class="cx">         return DFGPath;
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    case FTLMode:
-    case FTLForOSREntryMode: {
</del><ins>+    case JITCompilationMode::FTL:
+    case JITCompilationMode::FTLForOSREntry: {
</ins><span class="cx"> #if ENABLE(FTL_JIT)
</span><span class="cx">         if (FTL::canCompile(dfg) == FTL::CannotCompile) {
</span><span class="cx">             m_finalizer = makeUnique<FailedFinalizer>(*this);
</span><span class="lines">@@ -581,23 +524,12 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Plan::notifyCompiling()
-{
-    m_stage = Compiling;
-}
-
-void Plan::notifyReady()
-{
-    m_callback->compilationDidBecomeReadyAsynchronously(m_codeBlock, m_profiledDFGCodeBlock);
-    m_stage = Ready;
-}
-
</del><span class="cx"> bool Plan::isStillValidOnMainThread()
</span><span class="cx"> {
</span><span class="cx">     return m_watchpoints.areStillValidOnMainThread(*m_vm, m_identifiers);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-CompilationResult Plan::finalizeWithoutNotifyingCallback()
</del><ins>+CompilationResult Plan::finalize()
</ins><span class="cx"> {
</span><span class="cx">     // We perform multiple stores before emitting a write-barrier. To ensure that no GC happens between store and write-barrier, we should ensure that
</span><span class="cx">     // GC is deferred when this function is called.
</span><span class="lines">@@ -654,24 +586,30 @@
</span><span class="cx"> 
</span><span class="cx">     // We will establish new references from the code block to things. So, we need a barrier.
</span><span class="cx">     m_vm->heap.writeBarrier(m_codeBlock);
</span><ins>+
+    m_callback->compilationDidComplete(m_codeBlock, m_profiledDFGCodeBlock, result);
+
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Plan::finalizeAndNotifyCallback()
</del><ins>+bool Plan::iterateCodeBlocksForGC(AbstractSlotVisitor& visitor, const Function<void(CodeBlock*)>& func)
</ins><span class="cx"> {
</span><del>-    m_callback->compilationDidComplete(m_codeBlock, m_profiledDFGCodeBlock, finalizeWithoutNotifyingCallback());
-}
</del><ins>+    if (!Base::iterateCodeBlocksForGC(visitor, func))
+        return false;
</ins><span class="cx"> 
</span><del>-CompilationKey Plan::key()
-{
-    return CompilationKey(m_codeBlock->alternative(), m_mode);
</del><ins>+    // Compilation writes lots of values to a CodeBlock without performing
+    // an explicit barrier. So, we need to be pessimistic and assume that
+    // all our CodeBlocks must be visited during GC.
+    func(m_codeBlock->alternative());
+    if (m_profiledDFGCodeBlock)
+        func(m_profiledDFGCodeBlock);
+    return true;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-template<typename Visitor>
-void Plan::checkLivenessAndVisitChildren(Visitor& visitor)
</del><ins>+bool Plan::checkLivenessAndVisitChildren(AbstractSlotVisitor& visitor)
</ins><span class="cx"> {
</span><del>-    if (!isKnownToBeLiveDuringGC(visitor))
-        return;
</del><ins>+    if (!Base::checkLivenessAndVisitChildren(visitor))
+        return false;
</ins><span class="cx"> 
</span><span class="cx">     cleanMustHandleValuesIfNecessary();
</span><span class="cx">     for (unsigned i = m_mustHandleValues.size(); i--;) {
</span><span class="lines">@@ -683,7 +621,6 @@
</span><span class="cx">     m_recordedStatuses.visitAggregate(visitor);
</span><span class="cx">     m_recordedStatuses.markIfCheap(visitor);
</span><span class="cx"> 
</span><del>-    visitor.appendUnbarriered(m_codeBlock);
</del><span class="cx">     visitor.appendUnbarriered(m_codeBlock->alternative());
</span><span class="cx">     visitor.appendUnbarriered(m_profiledDFGCodeBlock);
</span><span class="cx"> 
</span><span class="lines">@@ -696,24 +633,13 @@
</span><span class="cx"> 
</span><span class="cx">     m_weakReferences.visitChildren(visitor);
</span><span class="cx">     m_transitions.visitChildren(visitor);
</span><ins>+    return true;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-template void Plan::checkLivenessAndVisitChildren(AbstractSlotVisitor&);
-template void Plan::checkLivenessAndVisitChildren(SlotVisitor&);
-
-void Plan::finalizeInGC()
</del><ins>+bool Plan::isKnownToBeLiveDuringGC(AbstractSlotVisitor& visitor)
</ins><span class="cx"> {
</span><del>-    ASSERT(m_vm);
-    m_recordedStatuses.finalizeWithoutDeleting(*m_vm);
-}
-
-template<typename Visitor>
-bool Plan::isKnownToBeLiveDuringGC(Visitor& visitor)
-{
-    if (m_stage == Cancelled)
</del><ins>+    if (!Base::isKnownToBeLiveDuringGC(visitor))
</ins><span class="cx">         return false;
</span><del>-    if (!visitor.isMarked(m_codeBlock->ownerExecutable()))
-        return false;
</del><span class="cx">     if (!visitor.isMarked(m_codeBlock->alternative()))
</span><span class="cx">         return false;
</span><span class="cx">     if (!!m_profiledDFGCodeBlock && !visitor.isMarked(m_profiledDFGCodeBlock))
</span><span class="lines">@@ -721,15 +647,10 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-template bool Plan::isKnownToBeLiveDuringGC(AbstractSlotVisitor&);
-template bool Plan::isKnownToBeLiveDuringGC(SlotVisitor&);
-
</del><span class="cx"> bool Plan::isKnownToBeLiveAfterGC()
</span><span class="cx"> {
</span><del>-    if (m_stage == Cancelled)
</del><ins>+    if (!Base::isKnownToBeLiveAfterGC())
</ins><span class="cx">         return false;
</span><del>-    if (!m_vm->heap.isMarked(m_codeBlock->ownerExecutable()))
-        return false;
</del><span class="cx">     if (!m_vm->heap.isMarked(m_codeBlock->alternative()))
</span><span class="cx">         return false;
</span><span class="cx">     if (!!m_profiledDFGCodeBlock && !m_vm->heap.isMarked(m_profiledDFGCodeBlock))
</span><span class="lines">@@ -737,26 +658,6 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Plan::cancel()
-{
-    RELEASE_ASSERT(m_stage != Cancelled);
-    ASSERT(m_vm);
-    m_vm = nullptr;
-
-    m_codeBlock = nullptr;
-    m_profiledDFGCodeBlock = nullptr;
-    m_mustHandleValues.clear();
-    m_compilation = nullptr;
-    m_finalizer = nullptr;
-    m_inlineCallFrames = nullptr;
-    m_watchpoints = DesiredWatchpoints();
-    m_identifiers = DesiredIdentifiers();
-    m_weakReferences = DesiredWeakReferences();
-    m_transitions = DesiredTransitions();
-    m_callback = nullptr;
-    m_stage = Cancelled;
-}
-
</del><span class="cx"> void Plan::cleanMustHandleValuesIfNecessary()
</span><span class="cx"> {
</span><span class="cx">     Locker locker { m_mustHandleValueCleaningLock };
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGPlanh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGPlan.h (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGPlan.h        2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/dfg/DFGPlan.h   2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -26,8 +26,6 @@
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><span class="cx"> #include "CompilationResult.h"
</span><del>-#include "DFGCompilationKey.h"
-#include "DFGCompilationMode.h"
</del><span class="cx"> #include "DFGDesiredGlobalProperties.h"
</span><span class="cx"> #include "DFGDesiredIdentifiers.h"
</span><span class="cx"> #include "DFGDesiredTransitions.h"
</span><span class="lines">@@ -35,6 +33,7 @@
</span><span class="cx"> #include "DFGDesiredWeakReferences.h"
</span><span class="cx"> #include "DFGFinalizer.h"
</span><span class="cx"> #include "DeferredCompilationCallback.h"
</span><ins>+#include "JITPlan.h"
</ins><span class="cx"> #include "Operands.h"
</span><span class="cx"> #include "ProfilerCompilation.h"
</span><span class="cx"> #include "RecordedStatuses.h"
</span><span class="lines">@@ -52,45 +51,35 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(DFG_JIT)
</span><span class="cx"> 
</span><del>-class Plan : public ThreadSafeRefCounted<Plan> {
</del><ins>+class Plan final : public JITPlan {
+    using Base = JITPlan;
+
</ins><span class="cx"> public:
</span><span class="cx">     Plan(
</span><span class="cx">         CodeBlock* codeBlockToCompile, CodeBlock* profiledDFGCodeBlock,
</span><del>-        CompilationMode, BytecodeIndex osrEntryBytecodeIndex,
</del><ins>+        JITCompilationMode, BytecodeIndex osrEntryBytecodeIndex,
</ins><span class="cx">         const Operands<Optional<JSValue>>& mustHandleValues);
</span><span class="cx">     ~Plan();
</span><span class="cx"> 
</span><del>-    void compileInThread(ThreadData*);
-    
-    CompilationResult finalizeWithoutNotifyingCallback();
-    void finalizeAndNotifyCallback();
-    
-    void notifyCompiling();
-    void notifyReady();
-    
-    CompilationKey key();
-    
-    template<typename Func, typename Visitor>
-    void iterateCodeBlocksForGC(Visitor&, const Func&);
-    template<typename Visitor> void checkLivenessAndVisitChildren(Visitor&);
-    template<typename Visitor> bool isKnownToBeLiveDuringGC(Visitor&);
-    bool isKnownToBeLiveAfterGC();
-    void finalizeInGC();
-    void cancel();
</del><ins>+    size_t codeSize() const final;
+    void finalizeInGC() final;
+    CompilationResult finalize() override;
</ins><span class="cx"> 
</span><ins>+    void notifyReady() final;
+    void cancel() final;
+
+    bool isKnownToBeLiveAfterGC() final;
+    bool isKnownToBeLiveDuringGC(AbstractSlotVisitor&) final;
+    bool iterateCodeBlocksForGC(AbstractSlotVisitor&, const Function<void(CodeBlock*)>&) final;
+    bool checkLivenessAndVisitChildren(AbstractSlotVisitor&) final;
+
+
</ins><span class="cx">     bool canTierUpAndOSREnter() const { return !m_tierUpAndOSREnterBytecodes.isEmpty(); }
</span><span class="cx"> 
</span><span class="cx">     void cleanMustHandleValuesIfNecessary();
</span><span class="cx"> 
</span><del>-    VM* vm() const { return m_vm; }
-
-    CodeBlock* codeBlock() { return m_codeBlock; }
-
-    bool isFTL() const { return DFG::isFTL(m_mode); }
-    CompilationMode mode() const { return m_mode; }
</del><span class="cx">     BytecodeIndex osrEntryBytecodeIndex() const { return m_osrEntryBytecodeIndex; }
</span><span class="cx">     const Operands<Optional<JSValue>>& mustHandleValues() const { return m_mustHandleValues; }
</span><del>-    ThreadData* threadData() const { return m_threadData; }
</del><span class="cx">     Profiler::Compilation* compilation() const { return m_compilation.get(); }
</span><span class="cx"> 
</span><span class="cx">     Finalizer* finalizer() const { return m_finalizer.get(); }
</span><span class="lines">@@ -109,32 +98,17 @@
</span><span class="cx">     HashMap<BytecodeIndex, FixedVector<BytecodeIndex>>& tierUpInLoopHierarchy() { return m_tierUpInLoopHierarchy; }
</span><span class="cx">     Vector<BytecodeIndex>& tierUpAndOSREnterBytecodes() { return m_tierUpAndOSREnterBytecodes; }
</span><span class="cx"> 
</span><del>-    enum Stage { Preparing, Compiling, Ready, Cancelled };
-    Stage stage() const { return m_stage; }
-
</del><span class="cx">     DeferredCompilationCallback* callback() const { return m_callback.get(); }
</span><span class="cx">     void setCallback(Ref<DeferredCompilationCallback>&& callback) { m_callback = WTFMove(callback); }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    bool computeCompileTimes() const;
-    bool reportCompileTimes() const;
</del><ins>+    CompilationPath compileInThreadImpl() override;
</ins><span class="cx">     
</span><del>-    enum CompilationPath { FailPath, DFGPath, FTLPath, CancelPath };
-    CompilationPath compileInThreadImpl();
-    
</del><span class="cx">     bool isStillValidOnMainThread();
</span><span class="cx">     bool isStillValid();
</span><span class="cx">     void reallyAdd(CommonData*);
</span><span class="cx"> 
</span><del>-    // Warning: pretty much all of the pointer fields in this object get nulled by cancel(). So, if
-    // you're writing code that is callable on the cancel path, be sure to null check everything!
-
-    CompilationMode m_mode;
-
-    VM* m_vm;
-
</del><span class="cx">     // These can be raw pointers because we visit them during every GC in checkLivenessAndVisitChildren.
</span><del>-    CodeBlock* m_codeBlock;
</del><span class="cx">     CodeBlock* m_profiledDFGCodeBlock;
</span><span class="cx"> 
</span><span class="cx">     Operands<Optional<JSValue>> m_mustHandleValues;
</span><span class="lines">@@ -145,8 +119,6 @@
</span><span class="cx"> 
</span><span class="cx">     const BytecodeIndex m_osrEntryBytecodeIndex;
</span><span class="cx"> 
</span><del>-    ThreadData* m_threadData;
-
</del><span class="cx">     RefPtr<Profiler::Compilation> m_compilation;
</span><span class="cx"> 
</span><span class="cx">     std::unique_ptr<Finalizer> m_finalizer;
</span><span class="lines">@@ -161,11 +133,7 @@
</span><span class="cx">     HashMap<BytecodeIndex, FixedVector<BytecodeIndex>> m_tierUpInLoopHierarchy;
</span><span class="cx">     Vector<BytecodeIndex> m_tierUpAndOSREnterBytecodes;
</span><span class="cx"> 
</span><del>-    Stage m_stage;
-
</del><span class="cx">     RefPtr<DeferredCompilationCallback> m_callback;
</span><del>-
-    MonotonicTime m_timeBeforeFTL;
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(DFG_JIT)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGPlanInlinesh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/JavaScriptCore/dfg/DFGPlanInlines.h (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGPlanInlines.h 2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/dfg/DFGPlanInlines.h    2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -1,53 +0,0 @@
</span><del>-/*
- * Copyright (C) 2017-2021 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#pragma once
-
-#include "DFGPlan.h"
-
-namespace JSC { namespace DFG {
-
-#if ENABLE(DFG_JIT)
-
-template<typename Func, typename Visitor>
-void Plan::iterateCodeBlocksForGC(Visitor& visitor, const Func& func)
-{
-    if (!isKnownToBeLiveDuringGC(visitor))
-        return;
-    
-    // Compilation writes lots of values to a CodeBlock without performing
-    // an explicit barrier. So, we need to be pessimistic and assume that
-    // all our CodeBlocks must be visited during GC.
-
-    func(m_codeBlock);
-    func(m_codeBlock->alternative());
-    if (m_profiledDFGCodeBlock)
-        func(m_profiledDFGCodeBlock);
-}
-
-#endif // ENABLE(DFG_JIT)
-
-} } // namespace JSC::DFG
-
</del></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGSafepointcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/JavaScriptCore/dfg/DFGSafepoint.cpp (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGSafepoint.cpp 2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/dfg/DFGSafepoint.cpp    2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -1,146 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014-2021 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#include "config.h"
-#include "DFGSafepoint.h"
-
-#if ENABLE(DFG_JIT)
-
-#include "DFGPlan.h"
-#include "DFGScannable.h"
-#include "DFGThreadData.h"
-
-namespace JSC { namespace DFG {
-
-Safepoint::Result::~Result()
-{
-    RELEASE_ASSERT(m_wasChecked);
-}
-
-bool Safepoint::Result::didGetCancelled()
-{
-    m_wasChecked = true;
-    return m_didGetCancelled;
-}
-
-Safepoint::Safepoint(Plan& plan, Result& result)
-    : m_vm(plan.vm())
-    , m_plan(plan)
-    , m_didCallBegin(false)
-    , m_result(result)
-{
-    RELEASE_ASSERT(result.m_wasChecked);
-    result.m_wasChecked = false;
-    result.m_didGetCancelled = false;
-}
-
-Safepoint::~Safepoint()
-{
-    RELEASE_ASSERT(m_didCallBegin);
-    if (ThreadData* data = m_plan.threadData()) {
-        RELEASE_ASSERT(data->m_safepoint == this);
-        data->m_rightToRun.lock();
-        data->m_safepoint = nullptr;
-    }
-}
-
-void Safepoint::add(Scannable* scannable)
-{
-    RELEASE_ASSERT(!m_didCallBegin);
-    m_scannables.append(scannable);
-}
-
-void Safepoint::begin()
-{
-    RELEASE_ASSERT(!m_didCallBegin);
-    m_didCallBegin = true;
-    if (ThreadData* data = m_plan.threadData()) {
-        RELEASE_ASSERT(!data->m_safepoint);
-        data->m_safepoint = this;
-        data->m_rightToRun.unlockFairly();
-    }
-}
-
-template<typename Visitor>
-void Safepoint::checkLivenessAndVisitChildren(Visitor& visitor)
-{
-    RELEASE_ASSERT(m_didCallBegin);
-
-    if (m_result.m_didGetCancelled)
-        return; // We were cancelled during a previous GC!
-    
-    if (!isKnownToBeLiveDuringGC(visitor))
-        return;
-    
-    for (unsigned i = m_scannables.size(); i--;)
-        m_scannables[i]->visitChildren(visitor);
-}
-
-template void Safepoint::checkLivenessAndVisitChildren(AbstractSlotVisitor&);
-template void Safepoint::checkLivenessAndVisitChildren(SlotVisitor&);
-
-template<typename Visitor>
-bool Safepoint::isKnownToBeLiveDuringGC(Visitor& visitor)
-{
-    RELEASE_ASSERT(m_didCallBegin);
-    
-    if (m_result.m_didGetCancelled)
-        return true; // We were cancelled during a previous GC, so let's not mess with it this time around - pretend it's live and move on.
-    
-    return m_plan.isKnownToBeLiveDuringGC(visitor);
-}
-
-template bool Safepoint::isKnownToBeLiveDuringGC(AbstractSlotVisitor&);
-template bool Safepoint::isKnownToBeLiveDuringGC(SlotVisitor&);
-
-bool Safepoint::isKnownToBeLiveAfterGC()
-{
-    RELEASE_ASSERT(m_didCallBegin);
-    
-    if (m_result.m_didGetCancelled)
-        return true; // We were cancelled during a previous GC, so let's not mess with it this time around - pretend it's live and move on.
-    
-    return m_plan.isKnownToBeLiveAfterGC();
-}
-
-void Safepoint::cancel()
-{
-    RELEASE_ASSERT(m_didCallBegin);
-    RELEASE_ASSERT(!m_result.m_didGetCancelled); // We cannot get cancelled twice because subsequent GCs will think that we're alive and they will not do anything to us.
-    
-    RELEASE_ASSERT(m_plan.stage() == Plan::Cancelled);
-    m_result.m_didGetCancelled = true;
-    m_vm = nullptr;
-}
-
-VM* Safepoint::vm() const
-{
-    return m_vm;
-}
-
-} } // namespace JSC::DFG
-
-#endif // ENABLE(DFG_JIT)
-
</del></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGSafepointh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/JavaScriptCore/dfg/DFGSafepoint.h (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGSafepoint.h   2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/dfg/DFGSafepoint.h      2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -1,86 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014-2021 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#pragma once
-
-#if ENABLE(DFG_JIT)
-
-#include <wtf/Vector.h>
-
-namespace JSC {
-
-class VM;
-
-namespace DFG {
-
-class Plan;
-class Scannable;
-
-class Safepoint {
-public:
-    class Result {
-    public:
-        Result()
-            : m_didGetCancelled(false)
-            , m_wasChecked(true)
-        {
-        }
-        
-        ~Result();
-        
-        bool didGetCancelled();
-        
-    private:
-        friend class Safepoint;
-        
-        bool m_didGetCancelled;
-        bool m_wasChecked;
-    };
-    
-    Safepoint(Plan&, Result&);
-    ~Safepoint();
-    
-    void add(Scannable*);
-    
-    void begin();
-
-    template<typename Visitor> void checkLivenessAndVisitChildren(Visitor&);
-    template<typename Visitor> bool isKnownToBeLiveDuringGC(Visitor&);
-    bool isKnownToBeLiveAfterGC();
-    void cancel();
-    
-    VM* vm() const; // May return null if we've been cancelled.
-
-private:
-    VM* m_vm;
-    Plan& m_plan;
-    Vector<Scannable*> m_scannables;
-    bool m_didCallBegin;
-    Result& m_result;
-};
-
-} } // namespace JSC::DFG
-
-#endif // ENABLE(DFG_JIT)
</del></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGScannableh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/JavaScriptCore/dfg/DFGScannable.h (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGScannable.h   2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/dfg/DFGScannable.h      2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -1,48 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014-2021 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#pragma once
-
-#if ENABLE(DFG_JIT)
-
-namespace JSC {
-
-class AbstractSlotVisitor;
-class SlotVisitor;
-
-namespace DFG {
-
-class Scannable {
-public:
-    Scannable() { }
-    virtual ~Scannable() { }
-
-    virtual void visitChildren(AbstractSlotVisitor&) = 0;
-    virtual void visitChildren(SlotVisitor&) = 0;
-};
-
-} } // namespace JSC::DFG
-
-#endif // ENABLE(DFG_JIT)
</del></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGThreadDatacpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/JavaScriptCore/dfg/DFGThreadData.cpp (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGThreadData.cpp        2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/dfg/DFGThreadData.cpp   2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -1,46 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#include "config.h"
-#include "DFGThreadData.h"
-
-#if ENABLE(DFG_JIT)
-
-namespace JSC { namespace DFG {
-
-ThreadData::ThreadData(Worklist* worklist)
-    : m_worklist(worklist)
-    , m_safepoint(nullptr)
-{
-}
-
-ThreadData::~ThreadData()
-{
-}
-
-} } // namespace JSC::DFG
-
-#endif // ENABLE(DFG_JIT)
-
</del></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGThreadDatah"></a>
<div class="delfile"><h4>Deleted: trunk/Source/JavaScriptCore/dfg/DFGThreadData.h (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGThreadData.h  2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/dfg/DFGThreadData.h     2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -1,56 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014-2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#pragma once
-
-#if ENABLE(DFG_JIT)
-
-#include <wtf/AutomaticThread.h>
-#include <wtf/Lock.h>
-
-namespace JSC { namespace DFG {
-
-class Safepoint;
-class Worklist;
-
-class ThreadData {
-    WTF_MAKE_FAST_ALLOCATED;
-public:
-    ThreadData(Worklist*);
-    ~ThreadData();
-    
-private:
-    friend class Safepoint;
-    friend class Worklist;
-    
-    Worklist* m_worklist;
-    RefPtr<AutomaticThread> m_thread;
-    UncheckedLock m_rightToRun;
-    Safepoint* m_safepoint;
-};
-
-} } // namespace JSC::DFG
-
-#endif // ENABLE(DFG_JIT)
</del></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGTierUpCheckInjectionPhasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGTierUpCheckInjectionPhase.cpp (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGTierUpCheckInjectionPhase.cpp 2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/dfg/DFGTierUpCheckInjectionPhase.cpp    2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013-2021 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -61,7 +61,7 @@
</span><span class="cx">     
</span><span class="cx">     bool run()
</span><span class="cx">     {
</span><del>-        RELEASE_ASSERT(m_graph.m_plan.mode() == DFGMode);
</del><ins>+        RELEASE_ASSERT(m_graph.m_plan.mode() == JITCompilationMode::DFG);
</ins><span class="cx"> 
</span><span class="cx">         if (!Options::useFTLJIT())
</span><span class="cx">             return false;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGWorklistcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/JavaScriptCore/dfg/DFGWorklist.cpp (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGWorklist.cpp  2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/dfg/DFGWorklist.cpp     2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -1,669 +0,0 @@
</span><del>-/*
- * Copyright (C) 2013-2021 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#include "config.h"
-#include "DFGWorklist.h"
-
-#include "DFGSafepoint.h"
-#include "DeferGC.h"
-#include "JSCellInlines.h"
-#include "ReleaseHeapAccessScope.h"
-#include <mutex>
-#include <wtf/CompilationThread.h>
-
-namespace JSC { namespace DFG {
-
-#if ENABLE(DFG_JIT)
-
-class Worklist::ThreadBody final : public AutomaticThread {
-public:
-    ThreadBody(const AbstractLocker& locker, Worklist& worklist, ThreadData& data, Box<UncheckedLock> lock, Ref<AutomaticThreadCondition>&& condition, int relativePriority)
-        : AutomaticThread(locker, lock, WTFMove(condition), ThreadType::Compiler)
-        , m_worklist(worklist)
-        , m_data(data)
-        , m_relativePriority(relativePriority)
-    {
-    }
-
-    const char* name() const final
-    {
-        return m_worklist.m_threadName.data();
-    }
-
-private:
-    PollResult poll(const AbstractLocker& locker) final
-    {
-        if (m_worklist.m_queue.isEmpty())
-            return PollResult::Wait;
-        
-        m_plan = m_worklist.m_queue.takeFirst();
-        if (!m_plan) {
-            if (Options::verboseCompilationQueue()) {
-                m_worklist.dump(locker, WTF::dataFile());
-                dataLog(": Thread shutting down\n");
-            }
-            return PollResult::Stop;
-        }
-        RELEASE_ASSERT(m_plan->stage() == Plan::Preparing);
-        m_worklist.m_numberOfActiveThreads++;
-        return PollResult::Work;
-    }
-    
-    class WorkScope;
-    friend class WorkScope;
-    class WorkScope final {
-    public:
-        WorkScope(ThreadBody& thread)
-            : m_thread(thread)
-        {
-            RELEASE_ASSERT(m_thread.m_plan);
-            RELEASE_ASSERT(m_thread.m_worklist.m_numberOfActiveThreads);
-        }
-        
-        ~WorkScope()
-        {
-            Locker locker { *m_thread.m_worklist.m_lock };
-            m_thread.m_plan = nullptr;
-            m_thread.m_worklist.m_numberOfActiveThreads--;
-        }
-        
-    private:
-        ThreadBody& m_thread;
-    };
-    
-    WorkResult work() final
-    {
-        WorkScope workScope(*this);
-
-        Locker locker { m_data.m_rightToRun };
-        {
-            Locker locker { *m_worklist.m_lock };
-            if (m_plan->stage() == Plan::Cancelled)
-                return WorkResult::Continue;
-            m_plan->notifyCompiling();
-        }
-        
-        dataLogLnIf(Options::verboseCompilationQueue(), m_worklist, ": Compiling ", m_plan->key(), " asynchronously");
-        
-        // There's no way for the GC to be safepointing since we own rightToRun.
-        if (m_plan->vm()->heap.worldIsStopped()) {
-            dataLog("Heap is stopped but here we are! (1)\n");
-            RELEASE_ASSERT_NOT_REACHED();
-        }
-        m_plan->compileInThread(&m_data);
-        if (m_plan->stage() != Plan::Cancelled) {
-            if (m_plan->vm()->heap.worldIsStopped()) {
-                dataLog("Heap is stopped but here we are! (2)\n");
-                RELEASE_ASSERT_NOT_REACHED();
-            }
-        }
-        
-        {
-            Locker locker { *m_worklist.m_lock };
-            if (m_plan->stage() == Plan::Cancelled)
-                return WorkResult::Continue;
-            
-            m_plan->notifyReady();
-            
-            if (Options::verboseCompilationQueue()) {
-                m_worklist.dump(locker, WTF::dataFile());
-                dataLog(": Compiled ", m_plan->key(), " asynchronously\n");
-            }
-            
-            RELEASE_ASSERT(!m_plan->vm()->heap.worldIsStopped());
-            m_worklist.m_readyPlans.append(WTFMove(m_plan));
-            m_worklist.m_planCompiled.notifyAll();
-        }
-        
-        return WorkResult::Continue;
-    }
-    
-    void threadDidStart() final
-    {
-        dataLogLnIf(Options::verboseCompilationQueue(), m_worklist, ": Thread started");
-        
-        if (m_relativePriority)
-            Thread::current().changePriority(m_relativePriority);
-        
-        m_compilationScope = makeUnique<CompilationScope>();
-    }
-    
-    void threadIsStopping(const AbstractLocker&) final
-    {
-        // We're holding the Worklist::m_lock, so we should be careful not to deadlock.
-        
-        dataLogLnIf(Options::verboseCompilationQueue(), m_worklist, ": Thread will stop");
-        
-        ASSERT(!m_plan);
-        
-        m_compilationScope = nullptr;
-        m_plan = nullptr;
-    }
-
-    Worklist& m_worklist;
-    ThreadData& m_data;
-    int m_relativePriority;
-    std::unique_ptr<CompilationScope> m_compilationScope;
-    RefPtr<Plan> m_plan;
-};
-
-static CString createWorklistName(CString&& tierName)
-{
-#if OS(LINUX)
-    return toCString(WTFMove(tierName), "Worker");
-#else
-    return toCString(WTFMove(tierName), " Worklist Worker Thread");
-#endif
-}
-
-Worklist::Worklist(CString&& tierName)
-    : m_threadName(createWorklistName(WTFMove(tierName)))
-    , m_planEnqueued(AutomaticThreadCondition::create())
-    , m_lock(Box<UncheckedLock>::create())
-{
-}
-
-Worklist::~Worklist()
-{
-    {
-        Locker locker { *m_lock };
-        for (unsigned i = m_threads.size(); i--;)
-            m_queue.append(nullptr); // Use null plan to indicate that we want the thread to terminate.
-        m_planEnqueued->notifyAll(locker);
-    }
-    for (unsigned i = m_threads.size(); i--;)
-        m_threads[i]->m_thread->join();
-    ASSERT(!m_numberOfActiveThreads);
-}
-
-void Worklist::finishCreation(unsigned numberOfThreads, int relativePriority)
-{
-    RELEASE_ASSERT(numberOfThreads);
-    Locker locker { *m_lock };
-    for (unsigned i = numberOfThreads; i--;) {
-        createNewThread(locker, relativePriority);
-    }
-}
-
-void Worklist::createNewThread(const AbstractLocker& locker, int relativePriority)
-{
-    std::unique_ptr<ThreadData> data = makeUnique<ThreadData>(this);
-    data->m_thread = adoptRef(new ThreadBody(locker, *this, *data, m_lock, m_planEnqueued.copyRef(), relativePriority));
-    m_threads.append(WTFMove(data));
-}
-
-Ref<Worklist> Worklist::create(CString&& tierName, unsigned numberOfThreads, int relativePriority)
-{
-    Ref<Worklist> result = adoptRef(*new Worklist(WTFMove(tierName)));
-    result->finishCreation(numberOfThreads, relativePriority);
-    return result;
-}
-
-bool Worklist::isActiveForVM(VM& vm) const
-{
-    Locker locker { *m_lock };
-    PlanMap::const_iterator end = m_plans.end();
-    for (PlanMap::const_iterator iter = m_plans.begin(); iter != end; ++iter) {
-        if (iter->value->vm() == &vm)
-            return true;
-    }
-    return false;
-}
-
-void Worklist::enqueue(Ref<Plan>&& plan)
-{
-    Locker locker { *m_lock };
-    if (Options::verboseCompilationQueue()) {
-        dump(locker, WTF::dataFile());
-        dataLog(": Enqueueing plan to optimize ", plan->key(), "\n");
-    }
-    ASSERT(m_plans.find(plan->key()) == m_plans.end());
-    m_plans.add(plan->key(), plan.copyRef());
-    m_queue.append(WTFMove(plan));
-    m_planEnqueued->notifyOne(locker);
-}
-
-Worklist::State Worklist::compilationState(CompilationKey key)
-{
-    Locker locker { *m_lock };
-    PlanMap::iterator iter = m_plans.find(key);
-    if (iter == m_plans.end())
-        return NotKnown;
-    return iter->value->stage() == Plan::Ready ? Compiled : Compiling;
-}
-
-void Worklist::waitUntilAllPlansForVMAreReady(VM& vm)
-{
-    DeferGC deferGC(vm.heap);
-    
-    // While we are waiting for the compiler to finish, the collector might have already suspended
-    // the compiler and then it will be waiting for us to stop. That's a deadlock. We avoid that
-    // deadlock by relinquishing our heap access, so that the collector pretends that we are stopped
-    // even if we aren't.
-    ReleaseHeapAccessScope releaseHeapAccessScope(vm.heap);
-    
-    // Wait for all of the plans for the given VM to complete. The idea here
-    // is that we want all of the caller VM's plans to be done. We don't care
-    // about any other VM's plans, and we won't attempt to wait on those.
-    // After we release this lock, we know that although other VMs may still
-    // be adding plans, our VM will not be.
-    
-    Locker locker { *m_lock };
-    
-    if (Options::verboseCompilationQueue()) {
-        dump(locker, WTF::dataFile());
-        dataLog(": Waiting for all in VM to complete.\n");
-    }
-    
-    for (;;) {
-        bool allAreCompiled = true;
-        PlanMap::iterator end = m_plans.end();
-        for (PlanMap::iterator iter = m_plans.begin(); iter != end; ++iter) {
-            if (iter->value->vm() != &vm)
-                continue;
-            if (iter->value->stage() != Plan::Ready) {
-                allAreCompiled = false;
-                break;
-            }
-        }
-        
-        if (allAreCompiled)
-            break;
-        
-        m_planCompiled.wait(*m_lock);
-    }
-}
-
-void Worklist::removeAllReadyPlansForVM(VM& vm, Vector<RefPtr<Plan>, 8>& myReadyPlans)
-{
-    DeferGC deferGC(vm.heap);
-    Locker locker { *m_lock };
-    for (size_t i = 0; i < m_readyPlans.size(); ++i) {
-        RefPtr<Plan> plan = m_readyPlans[i];
-        if (plan->vm() != &vm)
-            continue;
-        if (plan->stage() != Plan::Ready)
-            continue;
-        myReadyPlans.append(plan);
-        m_readyPlans[i--] = m_readyPlans.last();
-        m_readyPlans.removeLast();
-        m_plans.remove(plan->key());
-    }
-}
-
-void Worklist::removeAllReadyPlansForVM(VM& vm)
-{
-    Vector<RefPtr<Plan>, 8> myReadyPlans;
-    removeAllReadyPlansForVM(vm, myReadyPlans);
-}
-
-Worklist::State Worklist::completeAllReadyPlansForVM(VM& vm, CompilationKey requestedKey)
-{
-    DeferGC deferGC(vm.heap);
-    Vector<RefPtr<Plan>, 8> myReadyPlans;
-    
-    removeAllReadyPlansForVM(vm, myReadyPlans);
-    
-    State resultingState = NotKnown;
-
-    while (!myReadyPlans.isEmpty()) {
-        RefPtr<Plan> plan = myReadyPlans.takeLast();
-        CompilationKey currentKey = plan->key();
-        
-        dataLogLnIf(Options::verboseCompilationQueue(), *this, ": Completing ", currentKey);
-
-        RELEASE_ASSERT(plan->stage() == Plan::Ready);
-
-        plan->finalizeAndNotifyCallback();
-        
-        if (currentKey == requestedKey)
-            resultingState = Compiled;
-    }
-    
-    if (!!requestedKey && resultingState == NotKnown) {
-        Locker locker { *m_lock };
-        if (m_plans.contains(requestedKey))
-            resultingState = Compiling;
-    }
-    
-    return resultingState;
-}
-
-void Worklist::completeAllPlansForVM(VM& vm)
-{
-    DeferGC deferGC(vm.heap);
-    waitUntilAllPlansForVMAreReady(vm);
-    completeAllReadyPlansForVM(vm);
-}
-
-void Worklist::suspendAllThreads()
-{
-    m_suspensionLock.lock();
-    for (unsigned i = m_threads.size(); i--;)
-        m_threads[i]->m_rightToRun.lock();
-}
-
-void Worklist::resumeAllThreads()
-{
-    for (unsigned i = m_threads.size(); i--;)
-        m_threads[i]->m_rightToRun.unlock();
-    m_suspensionLock.unlock();
-}
-
-template<typename Visitor>
-void Worklist::visitWeakReferences(Visitor& visitor)
-{
-    VM* vm = &visitor.heap()->vm();
-    {
-        Locker locker { *m_lock };
-        for (PlanMap::iterator iter = m_plans.begin(); iter != m_plans.end(); ++iter) {
-            Plan* plan = iter->value.get();
-            if (plan->vm() != vm)
-                continue;
-            plan->checkLivenessAndVisitChildren(visitor);
-        }
-    }
-    // This loop doesn't need locking because:
-    // (1) no new threads can be added to m_threads. Hence, it is immutable and needs no locks.
-    // (2) ThreadData::m_safepoint is protected by that thread's m_rightToRun which we must be
-    //     holding here because of a prior call to suspendAllThreads().
-    for (unsigned i = m_threads.size(); i--;) {
-        ThreadData* data = m_threads[i].get();
-        Safepoint* safepoint = data->m_safepoint;
-        if (safepoint && safepoint->vm() == vm)
-            safepoint->checkLivenessAndVisitChildren(visitor);
-    }
-}
-
-template void Worklist::visitWeakReferences(AbstractSlotVisitor&);
-template void Worklist::visitWeakReferences(SlotVisitor&);
-
-void Worklist::removeDeadPlans(VM& vm)
-{
-    {
-        Locker locker { *m_lock };
-        HashSet<CompilationKey> deadPlanKeys;
-        for (PlanMap::iterator iter = m_plans.begin(); iter != m_plans.end(); ++iter) {
-            Plan* plan = iter->value.get();
-            if (plan->vm() != &vm)
-                continue;
-            if (plan->isKnownToBeLiveAfterGC()) {
-                plan->finalizeInGC();
-                continue;
-            }
-            RELEASE_ASSERT(plan->stage() != Plan::Cancelled); // Should not be cancelled, yet.
-            ASSERT(!deadPlanKeys.contains(plan->key()));
-            deadPlanKeys.add(plan->key());
-        }
-        if (!deadPlanKeys.isEmpty()) {
-            for (HashSet<CompilationKey>::iterator iter = deadPlanKeys.begin(); iter != deadPlanKeys.end(); ++iter)
-                m_plans.take(*iter)->cancel();
-            Deque<RefPtr<Plan>> newQueue;
-            while (!m_queue.isEmpty()) {
-                RefPtr<Plan> plan = m_queue.takeFirst();
-                if (plan->stage() != Plan::Cancelled)
-                    newQueue.append(plan);
-            }
-            m_queue.swap(newQueue);
-            for (unsigned i = 0; i < m_readyPlans.size(); ++i) {
-                if (m_readyPlans[i]->stage() != Plan::Cancelled)
-                    continue;
-                m_readyPlans[i--] = m_readyPlans.last();
-                m_readyPlans.removeLast();
-            }
-        }
-    }
-    
-    // No locking needed for this part, see comment in visitWeakReferences().
-    for (unsigned i = m_threads.size(); i--;) {
-        ThreadData* data = m_threads[i].get();
-        Safepoint* safepoint = data->m_safepoint;
-        if (!safepoint)
-            continue;
-        if (safepoint->vm() != &vm)
-            continue;
-        if (safepoint->isKnownToBeLiveAfterGC())
-            continue;
-        safepoint->cancel();
-    }
-}
-
-void Worklist::removeNonCompilingPlansForVM(VM& vm)
-{
-    Locker locker { *m_lock };
-    HashSet<CompilationKey> deadPlanKeys;
-    Vector<RefPtr<Plan>> deadPlans;
-    for (auto& entry : m_plans) {
-        Plan* plan = entry.value.get();
-        if (plan->vm() != &vm)
-            continue;
-        if (plan->stage() == Plan::Compiling)
-            continue;
-        deadPlanKeys.add(plan->key());
-        deadPlans.append(plan);
-    }
-    for (CompilationKey key : deadPlanKeys)
-        m_plans.remove(key);
-    Deque<RefPtr<Plan>> newQueue;
-    while (!m_queue.isEmpty()) {
-        RefPtr<Plan> plan = m_queue.takeFirst();
-        if (!deadPlanKeys.contains(plan->key()))
-            newQueue.append(WTFMove(plan));
-    }
-    m_queue = WTFMove(newQueue);
-    m_readyPlans.removeAllMatching(
-        [&] (RefPtr<Plan>& plan) -> bool {
-            return deadPlanKeys.contains(plan->key());
-        });
-    for (auto& plan : deadPlans)
-        plan->cancel();
-}
-
-size_t Worklist::queueLength()
-{
-    Locker locker { *m_lock };
-    return m_queue.size();
-}
-
-void Worklist::dump(PrintStream& out) const
-{
-    Locker locker { *m_lock };
-    dump(locker, out);
-}
-
-void Worklist::dump(const AbstractLocker&, PrintStream& out) const
-{
-    out.print(
-        "Worklist(", RawPointer(this), ")[Queue Length = ", m_queue.size(),
-        ", Map Size = ", m_plans.size(), ", Num Ready = ", m_readyPlans.size(),
-        ", Num Active Threads = ", m_numberOfActiveThreads, "/", m_threads.size(), "]");
-}
-
-unsigned Worklist::setNumberOfThreads(unsigned numberOfThreads, int relativePriority)
-{
-    Locker locker { m_suspensionLock };
-    auto currentNumberOfThreads = m_threads.size();
-    if (numberOfThreads < currentNumberOfThreads) {
-        {
-            Locker locker { *m_lock };
-            for (unsigned i = currentNumberOfThreads; i-- > numberOfThreads;) {
-                if (m_threads[i]->m_thread->hasUnderlyingThread(locker)) {
-                    m_queue.append(nullptr);
-                    m_threads[i]->m_thread->notify(locker);
-                }
-            }
-        }
-        for (unsigned i = currentNumberOfThreads; i-- > numberOfThreads;) {
-            bool isStopped = false;
-            {
-                Locker locker { *m_lock };
-                isStopped = m_threads[i]->m_thread->tryStop(locker);
-            }
-            if (!isStopped)
-                m_threads[i]->m_thread->join();
-            m_threads.remove(i);
-        }
-        m_threads.shrinkToFit();
-        ASSERT(m_numberOfActiveThreads <= numberOfThreads);
-    } else if (numberOfThreads > currentNumberOfThreads) {
-        Locker locker { *m_lock };
-        for (unsigned i = currentNumberOfThreads; i < numberOfThreads; i++)
-            createNewThread(locker, relativePriority);
-    }
-    return currentNumberOfThreads;
-}
-
-static Worklist* theGlobalDFGWorklist;
-static unsigned numberOfDFGCompilerThreads;
-static unsigned numberOfFTLCompilerThreads;
-
-static unsigned getNumberOfDFGCompilerThreads()
-{
-    return numberOfDFGCompilerThreads ? numberOfDFGCompilerThreads : Options::numberOfDFGCompilerThreads();
-}
-
-static unsigned getNumberOfFTLCompilerThreads()
-{
-    return numberOfFTLCompilerThreads ? numberOfFTLCompilerThreads : Options::numberOfFTLCompilerThreads();
-}
-
-unsigned setNumberOfDFGCompilerThreads(unsigned numberOfThreads)
-{
-    auto previousNumberOfThreads = getNumberOfDFGCompilerThreads();
-    numberOfDFGCompilerThreads = numberOfThreads;
-    return previousNumberOfThreads;
-}
-
-unsigned setNumberOfFTLCompilerThreads(unsigned numberOfThreads)
-{
-    auto previousNumberOfThreads = getNumberOfFTLCompilerThreads();
-    numberOfFTLCompilerThreads = numberOfThreads;
-    return previousNumberOfThreads;
-}
-
-Worklist& ensureGlobalDFGWorklist()
-{
-    static std::once_flag initializeGlobalWorklistOnceFlag;
-    std::call_once(initializeGlobalWorklistOnceFlag, [] {
-        Worklist* worklist = &Worklist::create("DFG", getNumberOfDFGCompilerThreads(), Options::priorityDeltaOfDFGCompilerThreads()).leakRef();
-        WTF::storeStoreFence();
-        theGlobalDFGWorklist = worklist;
-    });
-    return *theGlobalDFGWorklist;
-}
-
-Worklist* existingGlobalDFGWorklistOrNull()
-{
-    return theGlobalDFGWorklist;
-}
-
-static Worklist* theGlobalFTLWorklist;
-
-Worklist& ensureGlobalFTLWorklist()
-{
-    static std::once_flag initializeGlobalWorklistOnceFlag;
-    std::call_once(initializeGlobalWorklistOnceFlag, [] {
-        Worklist* worklist = &Worklist::create("FTL", getNumberOfFTLCompilerThreads(), Options::priorityDeltaOfFTLCompilerThreads()).leakRef();
-        WTF::storeStoreFence();
-        theGlobalFTLWorklist = worklist;
-    });
-    return *theGlobalFTLWorklist;
-}
-
-Worklist* existingGlobalFTLWorklistOrNull()
-{
-    return theGlobalFTLWorklist;
-}
-
-Worklist& ensureGlobalWorklistFor(CompilationMode mode)
-{
-    switch (mode) {
-    case InvalidCompilationMode:
-        RELEASE_ASSERT_NOT_REACHED();
-        return ensureGlobalDFGWorklist();
-    case DFGMode:
-        return ensureGlobalDFGWorklist();
-    case FTLMode:
-    case FTLForOSREntryMode:
-        return ensureGlobalFTLWorklist();
-    }
-    RELEASE_ASSERT_NOT_REACHED();
-    return ensureGlobalDFGWorklist();
-}
-
-unsigned numberOfWorklists() { return 2; }
-
-Worklist& ensureWorklistForIndex(unsigned index)
-{
-    switch (index) {
-    case 0:
-        return ensureGlobalDFGWorklist();
-    case 1:
-        return ensureGlobalFTLWorklist();
-    default:
-        RELEASE_ASSERT_NOT_REACHED();
-        return ensureGlobalDFGWorklist();
-    }
-}
-
-Worklist* existingWorklistForIndexOrNull(unsigned index)
-{
-    switch (index) {
-    case 0:
-        return existingGlobalDFGWorklistOrNull();
-    case 1:
-        return existingGlobalFTLWorklistOrNull();
-    default:
-        RELEASE_ASSERT_NOT_REACHED();
-        return nullptr;
-    }
-}
-
-Worklist& existingWorklistForIndex(unsigned index)
-{
-    Worklist* result = existingWorklistForIndexOrNull(index);
-    RELEASE_ASSERT(result);
-    return *result;
-}
-
-void completeAllPlansForVM(VM& vm)
-{
-    for (unsigned i = DFG::numberOfWorklists(); i--;) {
-        if (DFG::Worklist* worklist = DFG::existingWorklistForIndexOrNull(i))
-            worklist->completeAllPlansForVM(vm);
-    }
-}
-
-#else // ENABLE(DFG_JIT)
-
-void completeAllPlansForVM(VM&)
-{
-}
-
-#endif // ENABLE(DFG_JIT)
-
-} } // namespace JSC::DFG
-
-
</del></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGWorklisth"></a>
<div class="delfile"><h4>Deleted: trunk/Source/JavaScriptCore/dfg/DFGWorklist.h (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGWorklist.h    2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/dfg/DFGWorklist.h       2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -1,146 +0,0 @@
</span><del>-/*
- * Copyright (C) 2013-2021 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#pragma once
-
-#include "DFGPlan.h"
-#include "DFGThreadData.h"
-#include <wtf/AutomaticThread.h>
-#include <wtf/Condition.h>
-#include <wtf/Deque.h>
-#include <wtf/HashMap.h>
-#include <wtf/Lock.h>
-
-namespace JSC { namespace DFG {
-
-#if ENABLE(DFG_JIT)
-
-class Worklist : public RefCounted<Worklist> {
-public:
-    enum State { NotKnown, Compiling, Compiled };
-
-    ~Worklist();
-    
-    static Ref<Worklist> create(CString&& tierName, unsigned numberOfThreads, int relativePriority = 0);
-    
-    void enqueue(Ref<Plan>&&);
-    
-    // This is equivalent to:
-    // worklist->waitUntilAllPlansForVMAreReady(vm);
-    // worklist->completeAllReadyPlansForVM(vm);
-    void completeAllPlansForVM(VM&);
-
-    template<typename Func, typename Visitor>
-    void iterateCodeBlocksForGC(Visitor&, VM&, const Func&);
-
-    void waitUntilAllPlansForVMAreReady(VM&);
-    State completeAllReadyPlansForVM(VM&, CompilationKey = CompilationKey());
-    void removeAllReadyPlansForVM(VM&);
-    
-    State compilationState(CompilationKey);
-    
-    size_t queueLength();
-    
-    void suspendAllThreads();
-    void resumeAllThreads();
-    
-    bool isActiveForVM(VM&) const;
-    
-    // Only called on the main thread after suspending all threads.
-    template<typename Visitor> void visitWeakReferences(Visitor&);
-    void removeDeadPlans(VM&);
-    
-    void removeNonCompilingPlansForVM(VM&);
-    
-    void dump(PrintStream&) const;
-    unsigned setNumberOfThreads(unsigned, int);
-    
-private:
-    Worklist(CString&& tierName);
-    void finishCreation(unsigned numberOfThreads, int);
-    void createNewThread(const AbstractLocker&, int);
-    
-    class ThreadBody;
-    friend class ThreadBody;
-    
-    void runThread(ThreadData*);
-    static void threadFunction(void* argument);
-    
-    void removeAllReadyPlansForVM(VM&, Vector<RefPtr<Plan>, 8>&);
-
-    void dump(const AbstractLocker&, PrintStream&) const;
-    
-    unsigned m_numberOfActiveThreads { 0 };
-    CString m_threadName;
-    Vector<std::unique_ptr<ThreadData>> m_threads;
-    
-    // Used to inform the thread about what work there is left to do.
-    Deque<RefPtr<Plan>> m_queue;
-    
-    // Used to answer questions about the current state of a code block. This
-    // is particularly great for the cti_optimize OSR slow path, which wants
-    // to know: did I get here because a better version of me just got
-    // compiled?
-    typedef HashMap<CompilationKey, RefPtr<Plan>> PlanMap;
-    PlanMap m_plans;
-    
-    // Used to quickly find which plans have been compiled and are ready to
-    // be completed.
-    Vector<RefPtr<Plan>, 16> m_readyPlans;
-    Ref<AutomaticThreadCondition> m_planEnqueued;
-    UncheckedCondition m_planCompiled;
-
-    UncheckedLock m_suspensionLock;
-    Box<UncheckedLock> m_lock;
-};
-
-JS_EXPORT_PRIVATE unsigned setNumberOfDFGCompilerThreads(unsigned);
-JS_EXPORT_PRIVATE unsigned setNumberOfFTLCompilerThreads(unsigned);
-
-// For DFGMode compilations.
-JS_EXPORT_PRIVATE Worklist& ensureGlobalDFGWorklist();
-JS_EXPORT_PRIVATE Worklist* existingGlobalDFGWorklistOrNull();
-
-// For FTLMode and FTLForOSREntryMode compilations.
-JS_EXPORT_PRIVATE Worklist& ensureGlobalFTLWorklist();
-JS_EXPORT_PRIVATE Worklist* existingGlobalFTLWorklistOrNull();
-
-Worklist& ensureGlobalWorklistFor(CompilationMode);
-
-// Simplify doing things for all worklists.
-unsigned numberOfWorklists();
-Worklist& ensureWorklistForIndex(unsigned index);
-Worklist* existingWorklistForIndexOrNull(unsigned index);
-Worklist& existingWorklistForIndex(unsigned index);
-
-#endif // ENABLE(DFG_JIT)
-
-void completeAllPlansForVM(VM&);
-
-template<typename Func, typename Visitor>
-void iterateCodeBlocksForGC(Visitor&, VM&, const Func&);
-
-} } // namespace JSC::DFG
-
</del></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGWorklistInlinesh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/JavaScriptCore/dfg/DFGWorklistInlines.h (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGWorklistInlines.h     2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/dfg/DFGWorklistInlines.h        2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -1,66 +0,0 @@
</span><del>-/*
- * Copyright (C) 2017-2021 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#pragma once
-
-#include "DFGPlanInlines.h"
-#include "DFGWorklist.h"
-
-namespace JSC { namespace DFG {
-
-#if ENABLE(DFG_JIT)
-
-template<typename Func, typename Visitor>
-void iterateCodeBlocksForGC(Visitor& visitor, VM& vm, const Func& func)
-{
-    for (unsigned i = DFG::numberOfWorklists(); i--;) {
-        if (DFG::Worklist* worklist = DFG::existingWorklistForIndexOrNull(i))
-            worklist->iterateCodeBlocksForGC(visitor, vm, func);
-    }
-}
-
-template<typename Func, typename Visitor>
-void Worklist::iterateCodeBlocksForGC(Visitor& visitor, VM& vm, const Func& func)
-{
-    Locker locker { *m_lock };
-    for (PlanMap::iterator iter = m_plans.begin(); iter != m_plans.end(); ++iter) {
-        Plan* plan = iter->value.get();
-        if (plan->vm() != &vm)
-            continue;
-        plan->iterateCodeBlocksForGC(visitor, func);
-    }
-}
-
-#else // ENABLE(DFG_JIT)
-
-template<typename Func, typename Visitor>
-void iterateCodeBlocksForGC(Visitor&, VM&, const Func&)
-{
-}
-
-#endif // ENABLE(DFG_JIT)
-
-} } // namespace JSC::DFG
-
</del></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLCompileh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLCompile.h (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLCompile.h     2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/ftl/FTLCompile.h        2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013-2020 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013-2021 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -27,14 +27,14 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(FTL_JIT)
</span><span class="cx"> 
</span><del>-#include "DFGSafepoint.h"
</del><span class="cx"> #include "FTLState.h"
</span><ins>+#include "JITSafepoint.h"
</ins><span class="cx"> 
</span><span class="cx"> namespace JSC { namespace FTL {
</span><span class="cx"> 
</span><span class="cx"> extern const char* const tierName;
</span><span class="cx"> 
</span><del>-void compile(State&, DFG::Safepoint::Result&);
</del><ins>+void compile(State&, Safepoint::Result&);
</ins><span class="cx"> 
</span><span class="cx"> } } // namespace JSC::FTL
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLLinkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLLink.cpp (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLLink.cpp      2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/ftl/FTLLink.cpp 2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -129,7 +129,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     switch (graph.m_plan.mode()) {
</span><del>-    case FTLMode: {
</del><ins>+    case JITCompilationMode::FTL: {
</ins><span class="cx">         bool requiresArityFixup = codeBlock->numParameters() != 1;
</span><span class="cx">         if (codeBlock->codeType() == FunctionCode && requiresArityFixup) {
</span><span class="cx">             CCallHelpers::JumpList mainPathJumps;
</span><span class="lines">@@ -191,7 +191,7 @@
</span><span class="cx">         break;
</span><span class="cx">     }
</span><span class="cx">         
</span><del>-    case FTLForOSREntryMode: {
</del><ins>+    case JITCompilationMode::FTLForOSREntry: {
</ins><span class="cx">         // We jump to here straight from DFG code, after having boxed up all of the
</span><span class="cx">         // values into the scratch buffer. Everything should be good to go - at this
</span><span class="cx">         // point we've even done the stack check. Basically we just have to make the
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLLowerDFGToB3cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp      2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp 2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -359,7 +359,7 @@
</span><span class="cx">                     Availability(FlushedAt(FlushedJSValue, virtualRegisterForArgumentIncludingThis(i)));
</span><span class="cx">             }
</span><span class="cx"> 
</span><del>-            if (m_graph.m_plan.mode() == FTLForOSREntryMode) {
</del><ins>+            if (m_graph.m_plan.mode() == JITCompilationMode::FTLForOSREntry) {
</ins><span class="cx">                 auto* jitCode = m_ftlState.jitCode->ftlForOSREntry();
</span><span class="cx">                 FixedVector<DFG::FlushFormat> argumentFlushFormats(codeBlock()->numParameters());
</span><span class="cx">                 for (unsigned i = 0; i < codeBlock()->numParameters(); ++i)
</span><span class="lines">@@ -19467,7 +19467,7 @@
</span><span class="cx">             
</span><span class="cx">             // FIXME: It seems like we should be able to do at least some validation when OSR entering. https://bugs.webkit.org/show_bug.cgi?id=215511
</span><span class="cx">             if (Options::validateFTLOSRExitLiveness()
</span><del>-                && m_graph.m_plan.mode() != FTLForOSREntryMode) {
</del><ins>+                && m_graph.m_plan.mode() != JITCompilationMode::FTLForOSREntry) {
</ins><span class="cx"> 
</span><span class="cx">                 if (availability.isDead() && m_graph.isLiveInBytecode(operand, exitOrigin))
</span><span class="cx">                     DFG_CRASH(m_graph, m_node, toCString("Live bytecode local not available: operand = ", operand, ", availability = ", availability, ", origin = ", exitOrigin).data());
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLStatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLState.cpp (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLState.cpp     2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/ftl/FTLState.cpp        2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013-2020 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013-2021 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -42,11 +42,11 @@
</span><span class="cx">     : graph(graph)
</span><span class="cx"> {
</span><span class="cx">     switch (graph.m_plan.mode()) {
</span><del>-    case FTLMode: {
</del><ins>+    case JITCompilationMode::FTL: {
</ins><span class="cx">         jitCode = adoptRef(new JITCode());
</span><span class="cx">         break;
</span><span class="cx">     }
</span><del>-    case FTLForOSREntryMode: {
</del><ins>+    case JITCompilationMode::FTLForOSREntry: {
</ins><span class="cx">         RefPtr<ForOSREntryJITCode> code = adoptRef(new ForOSREntryJITCode());
</span><span class="cx">         code->initializeEntryBuffer(graph.m_vm, graph.m_profiledBlock->numCalleeLocals());
</span><span class="cx">         code->setBytecodeIndex(graph.m_plan.osrEntryBytecodeIndex());
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLStateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLState.h (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLState.h       2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/ftl/FTLState.h  2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013-2021 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -50,12 +50,12 @@
</span><span class="cx"> 
</span><span class="cx"> inline bool verboseCompilationEnabled()
</span><span class="cx"> {
</span><del>-    return DFG::verboseCompilationEnabled(DFG::FTLMode);
</del><ins>+    return DFG::verboseCompilationEnabled(JITCompilationMode::FTL);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> inline bool shouldDumpDisassembly()
</span><span class="cx"> {
</span><del>-    return DFG::shouldDumpDisassembly(DFG::FTLMode);
</del><ins>+    return DFG::shouldDumpDisassembly(JITCompilationMode::FTL);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> class State {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapHeapcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/Heap.cpp (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/Heap.cpp        2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/heap/Heap.cpp   2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -26,7 +26,6 @@
</span><span class="cx"> #include "CodeBlockSetInlines.h"
</span><span class="cx"> #include "CollectingScope.h"
</span><span class="cx"> #include "ConservativeRoots.h"
</span><del>-#include "DFGWorklistInlines.h"
</del><span class="cx"> #include "EdenGCActivityCallback.h"
</span><span class="cx"> #include "Exception.h"
</span><span class="cx"> #include "FullGCActivityCallback.h"
</span><span class="lines">@@ -46,7 +45,7 @@
</span><span class="cx"> #include "Interpreter.h"
</span><span class="cx"> #include "IsoCellSetInlines.h"
</span><span class="cx"> #include "JITStubRoutineSet.h"
</span><del>-#include "JITWorklist.h"
</del><ins>+#include "JITWorklistInlines.h"
</ins><span class="cx"> #include "JSFinalizationRegistry.h"
</span><span class="cx"> #include "JSVirtualMachineInternal.h"
</span><span class="cx"> #include "JSWeakMap.h"
</span><span class="lines">@@ -639,17 +638,19 @@
</span><span class="cx">     if (!Options::useJIT())
</span><span class="cx">         return;
</span><span class="cx"> #if ENABLE(JIT)
</span><del>-    JITWorklist::ensureGlobalWorklist().completeAllForVM(m_vm);
</del><ins>+    JITWorklist::ensureGlobalWorklist().completeAllPlansForVM(m_vm);
</ins><span class="cx"> #endif // ENABLE(JIT)
</span><del>-    DFG::completeAllPlansForVM(m_vm);
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-template<typename Func, typename Visitor>
-void Heap::iterateExecutingAndCompilingCodeBlocks(Visitor& visitor, const Func& func)
</del><ins>+template<typename Visitor>
+void Heap::iterateExecutingAndCompilingCodeBlocks(Visitor& visitor, const Function<void(CodeBlock*)>& func)
</ins><span class="cx"> {
</span><span class="cx">     m_codeBlocks->iterateCurrentlyExecuting(func);
</span><del>-    if (Options::useJIT())
-        DFG::iterateCodeBlocksForGC(visitor, m_vm, func);
</del><ins>+#if ENABLE(JIT)
+    JITWorklist::ensureGlobalWorklist().iterateCodeBlocksForGC(visitor, m_vm, func);
+#else
+    UNUSED_PARAM(visitor);
+#endif // ENABLE(JIT)
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template<typename Func, typename Visitor>
</span><span class="lines">@@ -726,12 +727,11 @@
</span><span class="cx"> 
</span><span class="cx"> void Heap::removeDeadCompilerWorklistEntries()
</span><span class="cx"> {
</span><del>-#if ENABLE(DFG_JIT)
</del><span class="cx">     if (!Options::useJIT())
</span><span class="cx">         return;
</span><del>-    for (unsigned i = DFG::numberOfWorklists(); i--;)
-        DFG::existingWorklistForIndex(i).removeDeadPlans(m_vm);
-#endif
</del><ins>+#if ENABLE(JIT)
+    JITWorklist::ensureGlobalWorklist().removeDeadPlans(m_vm);
+#endif // ENABLE(JIT)
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> struct GatherExtraHeapData : MarkedBlock::CountFunctor {
</span><span class="lines">@@ -1653,14 +1653,6 @@
</span><span class="cx">             visitor.updateMutatorIsStopped(NoLockingNecessary);
</span><span class="cx">         });
</span><span class="cx"> 
</span><del>-#if ENABLE(JIT)
-    if (Options::useJIT()) {
-        DeferGCForAWhile awhile(*this);
-        if (JITWorklist::ensureGlobalWorklist().completeAllForVM(m_vm)
-            && conn == GCConductor::Collector)
-            setGCDidJIT();
-    }
-#endif // ENABLE(JIT)
</del><span class="cx">     UNUSED_PARAM(conn);
</span><span class="cx">     
</span><span class="cx">     if (auto* shadowChicken = vm().shadowChicken())
</span><span class="lines">@@ -1806,7 +1798,6 @@
</span><span class="cx">     RELEASE_ASSERT(m_worldState.load() & hasAccessBit);
</span><span class="cx">     RELEASE_ASSERT(!(m_worldState.load() & stoppedBit));
</span><span class="cx">     
</span><del>-    handleGCDidJIT();
</del><span class="cx">     handleNeedFinalize();
</span><span class="cx">     m_mutatorDidRun = true;
</span><span class="cx"> }
</span><span class="lines">@@ -1923,7 +1914,6 @@
</span><span class="cx">         RELEASE_ASSERT(!(oldState & stoppedBit));
</span><span class="cx">         unsigned newState = oldState | hasAccessBit;
</span><span class="cx">         if (m_worldState.compareExchangeWeak(oldState, newState)) {
</span><del>-            handleGCDidJIT();
</del><span class="cx">             handleNeedFinalize();
</span><span class="cx">             m_mutatorDidRun = true;
</span><span class="cx">             stopIfNecessary();
</span><span class="lines">@@ -2003,18 +1993,6 @@
</span><span class="cx">     while (relinquishConn(m_worldState.load())) { }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool Heap::handleGCDidJIT(unsigned oldState)
-{
-    RELEASE_ASSERT(oldState & hasAccessBit);
-    if (!(oldState & gcDidJITBit))
-        return false;
-    if (m_worldState.compareExchangeWeak(oldState, oldState & ~gcDidJITBit)) {
-        WTF::crossModifyingCodeFence();
-        return true;
-    }
-    return true;
-}
-
</del><span class="cx"> NEVER_INLINE bool Heap::handleNeedFinalize(unsigned oldState)
</span><span class="cx"> {
</span><span class="cx">     RELEASE_ASSERT(oldState & hasAccessBit);
</span><span class="lines">@@ -2032,26 +2010,11 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Heap::handleGCDidJIT()
-{
-    while (handleGCDidJIT(m_worldState.load())) { }
-}
-
</del><span class="cx"> void Heap::handleNeedFinalize()
</span><span class="cx"> {
</span><span class="cx">     while (handleNeedFinalize(m_worldState.load())) { }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Heap::setGCDidJIT()
-{
-    m_worldState.transaction(
-        [&] (unsigned& state) -> bool {
-            RELEASE_ASSERT(state & stoppedBit);
-            state |= gcDidJITBit;
-            return true;
-        });
-}
-
</del><span class="cx"> void Heap::setNeedFinalize()
</span><span class="cx"> {
</span><span class="cx">     m_worldState.exchangeOr(needFinalizeBit);
</span><span class="lines">@@ -2167,14 +2130,13 @@
</span><span class="cx"> 
</span><span class="cx"> void Heap::suspendCompilerThreads()
</span><span class="cx"> {
</span><del>-#if ENABLE(DFG_JIT)
</del><ins>+#if ENABLE(JIT)
</ins><span class="cx">     // We ensure the worklists so that it's not possible for the mutator to start a new worklist
</span><span class="cx">     // after we have suspended the ones that he had started before. That's not very expensive since
</span><span class="cx">     // the worklists use AutomaticThreads anyway.
</span><span class="cx">     if (!Options::useJIT())
</span><span class="cx">         return;
</span><del>-    for (unsigned i = DFG::numberOfWorklists(); i--;)
-        DFG::ensureWorklistForIndex(i).suspendAllThreads();
</del><ins>+    JITWorklist::ensureGlobalWorklist().suspendAllThreads();
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2386,11 +2348,10 @@
</span><span class="cx"> 
</span><span class="cx"> void Heap::resumeCompilerThreads()
</span><span class="cx"> {
</span><del>-#if ENABLE(DFG_JIT)
</del><ins>+#if ENABLE(JIT)
</ins><span class="cx">     if (!Options::useJIT())
</span><span class="cx">         return;
</span><del>-    for (unsigned i = DFG::numberOfWorklists(); i--;)
-        DFG::existingWorklistForIndex(i).resumeAllThreads();
</del><ins>+    JITWorklist::ensureGlobalWorklist().resumeAllThreads();
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2902,19 +2863,18 @@
</span><span class="cx">         ConstraintVolatility::GreyedByMarking,
</span><span class="cx">         ConstraintParallelism::Parallel);
</span><span class="cx">     
</span><del>-#if ENABLE(DFG_JIT)
</del><ins>+#if ENABLE(JIT)
</ins><span class="cx">     if (Options::useJIT()) {
</span><span class="cx">         m_constraintSet->add(
</span><del>-            "Dw", "DFG Worklists",
</del><ins>+            "Jw", "JIT Worklist",
</ins><span class="cx">             MAKE_MARKING_CONSTRAINT_EXECUTOR_PAIR(([this] (auto& visitor) {
</span><del>-                SetRootMarkReasonScope rootScope(visitor, RootMarkReason::DFGWorkLists);
</del><ins>+                SetRootMarkReasonScope rootScope(visitor, RootMarkReason::JITWorkList);
</ins><span class="cx"> 
</span><del>-                for (unsigned i = DFG::numberOfWorklists(); i--;)
-                    DFG::existingWorklistForIndex(i).visitWeakReferences(visitor);
</del><ins>+                JITWorklist::ensureGlobalWorklist().visitWeakReferences(visitor);
</ins><span class="cx">                 
</span><span class="cx">                 // FIXME: This is almost certainly unnecessary.
</span><span class="cx">                 // https://bugs.webkit.org/show_bug.cgi?id=166829
</span><del>-                DFG::iterateCodeBlocksForGC(visitor,
</del><ins>+                JITWorklist::ensureGlobalWorklist().iterateCodeBlocksForGC(visitor,
</ins><span class="cx">                     m_vm,
</span><span class="cx">                     [&] (CodeBlock* codeBlock) {
</span><span class="cx">                         visitor.appendUnbarriered(codeBlock);
</span><span class="lines">@@ -2921,7 +2881,7 @@
</span><span class="cx">                     });
</span><span class="cx">                 
</span><span class="cx">                 if (Options::logGC() == GCLogging::Verbose)
</span><del>-                    dataLog("DFG Worklists:\n", visitor);
</del><ins>+                    dataLog("JIT Worklists:\n", visitor);
</ins><span class="cx">             })),
</span><span class="cx">             ConstraintVolatility::GreyedByMarking);
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapHeaph"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/Heap.h (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/Heap.h  2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/heap/Heap.h     2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -97,7 +97,6 @@
</span><span class="cx"> 
</span><span class="cx"> namespace DFG {
</span><span class="cx"> class SpeculativeJIT;
</span><del>-class Worklist;
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(DFG_JIT) && ASSERT_ENABLED
</span><span class="lines">@@ -495,9 +494,6 @@
</span><span class="cx">     JS_EXPORT_PRIVATE void acquireAccessSlow();
</span><span class="cx">     JS_EXPORT_PRIVATE void releaseAccessSlow();
</span><span class="cx">     
</span><del>-    bool handleGCDidJIT(unsigned);
-    void handleGCDidJIT();
-    
</del><span class="cx">     bool handleNeedFinalize(unsigned);
</span><span class="cx">     void handleNeedFinalize();
</span><span class="cx">     
</span><span class="lines">@@ -504,7 +500,6 @@
</span><span class="cx">     bool relinquishConn(unsigned);
</span><span class="cx">     void finishRelinquishingConn();
</span><span class="cx">     
</span><del>-    void setGCDidJIT();
</del><span class="cx">     void setNeedFinalize();
</span><span class="cx">     void waitWhileNeedFinalize();
</span><span class="cx">     
</span><span class="lines">@@ -579,8 +574,8 @@
</span><span class="cx"> 
</span><span class="cx">     bool overCriticalMemoryThreshold(MemoryThresholdCallType memoryThresholdCallType = MemoryThresholdCallType::Cached);
</span><span class="cx">     
</span><del>-    template<typename Func, typename Visitor>
-    void iterateExecutingAndCompilingCodeBlocks(Visitor&, const Func&);
</del><ins>+    template<typename Visitor>
+    void iterateExecutingAndCompilingCodeBlocks(Visitor&, const Function<void(CodeBlock*)>&);
</ins><span class="cx">     
</span><span class="cx">     template<typename Func, typename Visitor>
</span><span class="cx">     void iterateExecutingAndCompilingCodeBlocksWithoutHoldingLocks(Visitor&, const Func&);
</span><span class="lines">@@ -716,9 +711,8 @@
</span><span class="cx">     static constexpr unsigned mutatorHasConnBit = 1u << 0u; // Must also be protected by threadLock.
</span><span class="cx">     static constexpr unsigned stoppedBit = 1u << 1u; // Only set when !hasAccessBit
</span><span class="cx">     static constexpr unsigned hasAccessBit = 1u << 2u;
</span><del>-    static constexpr unsigned gcDidJITBit = 1u << 3u; // Set when the GC did some JITing, so on resume we need to cpuid.
-    static constexpr unsigned needFinalizeBit = 1u << 4u;
-    static constexpr unsigned mutatorWaitingBit = 1u << 5u; // Allows the mutator to use this as a condition variable.
</del><ins>+    static constexpr unsigned needFinalizeBit = 1u << 3u;
+    static constexpr unsigned mutatorWaitingBit = 1u << 4u; // Allows the mutator to use this as a condition variable.
</ins><span class="cx">     Atomic<unsigned> m_worldState;
</span><span class="cx">     bool m_worldIsStopped { false };
</span><span class="cx">     Lock m_visitRaceLock;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapRootMarkReasonh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/RootMarkReason.h (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/RootMarkReason.h        2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/heap/RootMarkReason.h   2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -43,7 +43,7 @@
</span><span class="cx">     v(WeakMapSpace) \
</span><span class="cx">     v(WeakSets) \
</span><span class="cx">     v(Output) \
</span><del>-    v(DFGWorkLists) \
</del><ins>+    v(JITWorkList) \
</ins><span class="cx">     v(CodeBlocks) \
</span><span class="cx">     v(DOMGCOutput)
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitBaselineJITPlancppfromrev278081trunkSourceJavaScriptCoreftlFTLStatecpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/JavaScriptCore/jit/BaselineJITPlan.cpp (from rev 278081, trunk/Source/JavaScriptCore/ftl/FTLState.cpp) (0 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/BaselineJITPlan.cpp                              (rev 0)
+++ trunk/Source/JavaScriptCore/jit/BaselineJITPlan.cpp 2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -0,0 +1,77 @@
</span><ins>+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "BaselineJITPlan.h"
+
+#if ENABLE(JIT)
+
+namespace JSC {
+
+BaselineJITPlan::BaselineJITPlan(CodeBlock* codeBlock, BytecodeIndex loopOSREntryBytecodeIndex)
+    : JITPlan(JITCompilationMode::Baseline, codeBlock)
+    , m_jit(codeBlock->vm(), codeBlock, loopOSREntryBytecodeIndex)
+{
+    m_jit.doMainThreadPreparationBeforeCompile();
+}
+
+auto BaselineJITPlan::compileInThreadImpl() -> CompilationPath
+{
+    m_jit.compileAndLinkWithoutFinalizing(JITCompilationCanFail);
+    return BaselinePath;
+}
+
+size_t BaselineJITPlan::codeSize() const
+{
+    return m_jit.codeSize();
+}
+
+CompilationResult BaselineJITPlan::finalize()
+{
+    CompilationResult result = m_jit.finalizeOnMainThread();
+    switch (result) {
+    case CompilationFailed:
+        CODEBLOCK_LOG_EVENT(m_codeBlock, "delayJITCompile", ("compilation failed"));
+        dataLogLnIf(Options::verboseOSR(), "    JIT compilation failed.");
+        m_codeBlock->dontJITAnytimeSoon();
+        m_codeBlock->m_didFailJITCompilation = true;
+        break;
+    case CompilationSuccessful:
+        WTF::crossModifyingCodeFence();
+        dataLogLnIf(Options::verboseOSR(), "    JIT compilation successful.");
+        m_codeBlock->ownerExecutable()->installCode(m_codeBlock);
+        m_codeBlock->jitSoon();
+        break;
+    default:
+        RELEASE_ASSERT_NOT_REACHED();
+        break;
+    }
+
+    return result;
+}
+
+} // namespace JSC
+
+#endif // ENABLE(JIT)
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorejitBaselineJITPlanhfromrev278081trunkSourceJavaScriptCoredfgDFGScannableh"></a>
<div class="copfile"><h4>Copied: trunk/Source/JavaScriptCore/jit/BaselineJITPlan.h (from rev 278081, trunk/Source/JavaScriptCore/dfg/DFGScannable.h) (0 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/BaselineJITPlan.h                                (rev 0)
+++ trunk/Source/JavaScriptCore/jit/BaselineJITPlan.h   2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -0,0 +1,52 @@
</span><ins>+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "JITPlan.h"
+
+#if ENABLE(JIT)
+
+#include "JIT.h"
+
+namespace JSC {
+
+class BaselineJITPlan final : public JITPlan {
+    using Base = JITPlan;
+
+public:
+    BaselineJITPlan(CodeBlock*, BytecodeIndex loopOSREntryBytecodeIndex);
+
+    CompilationPath compileInThreadImpl() final;
+    size_t codeSize() const final;
+    CompilationResult finalize() override;
+
+private:
+    JIT m_jit;
+};
+
+} // namespace JSC
+
+#endif // ENABLE(JIT)
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JIT.cpp (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JIT.cpp  2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/jit/JIT.cpp     2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -662,10 +662,6 @@
</span><span class="cx"> 
</span><span class="cx"> void JIT::compileAndLinkWithoutFinalizing(JITCompilationEffort effort)
</span><span class="cx"> {
</span><del>-    MonotonicTime before { };
-    if (UNLIKELY(computeCompileTimes()))
-        before = MonotonicTime::now();
-    
</del><span class="cx">     DFG::CapabilityLevel level = m_codeBlock->capabilityLevel();
</span><span class="cx">     switch (level) {
</span><span class="cx">     case DFG::CannotCompile:
</span><span class="lines">@@ -821,20 +817,6 @@
</span><span class="cx">     m_pcToCodeOriginMapBuilder.appendItem(label(), PCToCodeOriginMapBuilder::defaultCodeOrigin());
</span><span class="cx"> 
</span><span class="cx">     m_linkBuffer = std::unique_ptr<LinkBuffer>(new LinkBuffer(*this, m_codeBlock, LinkBuffer::Profile::BaselineJIT, effort));
</span><del>-
-    MonotonicTime after { };
-    if (UNLIKELY(computeCompileTimes())) {
-        after = MonotonicTime::now();
-
-        if (Options::reportTotalCompileTimes())
-            totalBaselineCompileTime += after - before;
-    }
-    if (UNLIKELY(reportCompileTimes())) {
-        CString codeBlockName = toCString(*m_codeBlock);
-        
-        dataLog("Optimized ", codeBlockName, " with Baseline JIT into ", m_linkBuffer->size(), " bytes in ", (after - before).milliseconds(), " ms.\n");
-    }
-
</del><span class="cx">     link();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1018,6 +1000,13 @@
</span><span class="cx">     return CompilationSuccessful;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+size_t JIT::codeSize() const
+{
+    if (!m_linkBuffer)
+        return 0;
+    return m_linkBuffer->size();
+}
+
</ins><span class="cx"> CompilationResult JIT::privateCompile(JITCompilationEffort effort)
</span><span class="cx"> {
</span><span class="cx">     doMainThreadPreparationBeforeCompile();
</span><span class="lines">@@ -1074,21 +1063,11 @@
</span><span class="cx">     return virtualRegisterForLocal(frameRegisterCountFor(codeBlock) - 1).offset();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool JIT::reportCompileTimes()
-{
-    return Options::reportCompileTimes() || Options::reportBaselineCompileTimes();
-}
-
-bool JIT::computeCompileTimes()
-{
-    return reportCompileTimes() || Options::reportTotalCompileTimes();
-}
-
</del><span class="cx"> HashMap<CString, Seconds> JIT::compileTimeStats()
</span><span class="cx"> {
</span><span class="cx">     HashMap<CString, Seconds> result;
</span><span class="cx">     if (Options::reportTotalCompileTimes()) {
</span><del>-        result.add("Total Compile Time", totalBaselineCompileTime + totalDFGCompileTime + totalFTLCompileTime);
</del><ins>+        result.add("Total Compile Time", totalCompileTime());
</ins><span class="cx">         result.add("Baseline Compile Time", totalBaselineCompileTime);
</span><span class="cx"> #if ENABLE(DFG_JIT)
</span><span class="cx">         result.add("DFG Compile Time", totalDFGCompileTime);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JIT.h (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JIT.h    2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/jit/JIT.h       2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -216,6 +216,7 @@
</span><span class="cx"> 
</span><span class="cx">         void compileAndLinkWithoutFinalizing(JITCompilationEffort);
</span><span class="cx">         CompilationResult finalizeOnMainThread();
</span><ins>+        size_t codeSize() const;
</ins><span class="cx"> 
</span><span class="cx">         void doMainThreadPreparationBeforeCompile();
</span><span class="cx">         
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITCompilationKeycppfromrev278081trunkSourceJavaScriptCoredfgDFGCompilationKeycpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/JavaScriptCore/jit/JITCompilationKey.cpp (from rev 278081, trunk/Source/JavaScriptCore/dfg/DFGCompilationKey.cpp) (0 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITCompilationKey.cpp                            (rev 0)
+++ trunk/Source/JavaScriptCore/jit/JITCompilationKey.cpp       2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -0,0 +1,47 @@
</span><ins>+/*
+ * Copyright (C) 2013-2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "JITCompilationKey.h"
+
+#if ENABLE(JIT)
+
+#include "CodeBlock.h"
+
+namespace JSC {
+
+void JITCompilationKey::dump(PrintStream& out) const
+{
+    if (!*this) {
+        out.print("<empty>");
+        return;
+    }
+    out.print("(Compile of ", *m_profiledBlock, " with ", m_mode, ")");
+}
+
+} // namespace JSC
+
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITCompilationKeyhfromrev278081trunkSourceJavaScriptCoredfgDFGCompilationKeyh"></a>
<div class="copfile"><h4>Copied: trunk/Source/JavaScriptCore/jit/JITCompilationKey.h (from rev 278081, trunk/Source/JavaScriptCore/dfg/DFGCompilationKey.h) (0 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITCompilationKey.h                              (rev 0)
+++ trunk/Source/JavaScriptCore/jit/JITCompilationKey.h 2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -0,0 +1,103 @@
</span><ins>+/*
+ * Copyright (C) 2013-2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#pragma once
+
+#include "JITCompilationMode.h"
+#include <wtf/HashMap.h>
+
+namespace JSC {
+
+class CodeBlock;
+class CodeBlockSet;
+
+class JITCompilationKey {
+public:
+    JITCompilationKey()
+        : m_profiledBlock(nullptr)
+        , m_mode(JITCompilationMode::InvalidCompilation)
+    {
+    }
+    
+    JITCompilationKey(WTF::HashTableDeletedValueType)
+        : m_profiledBlock(nullptr)
+        , m_mode(JITCompilationMode::DFG)
+    {
+    }
+    
+    JITCompilationKey(CodeBlock* profiledBlock, JITCompilationMode mode)
+        : m_profiledBlock(profiledBlock)
+        , m_mode(mode)
+    {
+    }
+    
+    bool operator!() const
+    {
+        return !m_profiledBlock && m_mode == JITCompilationMode::InvalidCompilation;
+    }
+    
+    bool isHashTableDeletedValue() const
+    {
+        return !m_profiledBlock && m_mode != JITCompilationMode::InvalidCompilation;
+    }
+    
+    CodeBlock* profiledBlock() const { return m_profiledBlock; }
+    JITCompilationMode mode() const { return m_mode; }
+    
+    bool operator==(const JITCompilationKey& other) const
+    {
+        return m_profiledBlock == other.m_profiledBlock
+            && m_mode == other.m_mode;
+    }
+    
+    unsigned hash() const
+    {
+        return WTF::pairIntHash(WTF::PtrHash<CodeBlock*>::hash(m_profiledBlock), static_cast<std::underlying_type<JITCompilationMode>::type>(m_mode));
+    }
+    
+    void dump(PrintStream&) const;
+
+private:
+    CodeBlock* m_profiledBlock;
+    JITCompilationMode m_mode;
+};
+
+struct JITCompilationKeyHash {
+    static unsigned hash(const JITCompilationKey& key) { return key.hash(); }
+    static bool equal(const JITCompilationKey& a, const JITCompilationKey& b) { return a == b; }
+    static constexpr bool safeToCompareToEmptyOrDeleted = true;
+};
+
+} // namespace JSC
+
+namespace WTF {
+
+template<typename T> struct DefaultHash;
+template<> struct DefaultHash<JSC::JITCompilationKey> : JSC::JITCompilationKeyHash { };
+
+template<typename T> struct HashTraits;
+template<> struct HashTraits<JSC::JITCompilationKey> : SimpleClassHashTraits<JSC::JITCompilationKey> { };
+
+} // namespace WTF
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITCompilationModecppfromrev278081trunkSourceJavaScriptCoredfgDFGCompilationModecpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/JavaScriptCore/jit/JITCompilationMode.cpp (from rev 278081, trunk/Source/JavaScriptCore/dfg/DFGCompilationMode.cpp) (0 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITCompilationMode.cpp                           (rev 0)
+++ trunk/Source/JavaScriptCore/jit/JITCompilationMode.cpp      2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -0,0 +1,59 @@
</span><ins>+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "JITCompilationMode.h"
+
+#if ENABLE(JIT)
+
+namespace WTF {
+
+using namespace JSC;
+
+void printInternal(PrintStream& out, JITCompilationMode mode)
+{
+    switch (mode) {
+    case JITCompilationMode::InvalidCompilation:
+        out.print("InvalidCompilationMode");
+        return;
+    case JITCompilationMode::Baseline:
+        out.print("BaselineMode");
+        return;
+    case JITCompilationMode::DFG:
+        out.print("DFGMode");
+        return;
+    case JITCompilationMode::FTL:
+        out.print("FTLMode");
+        return;
+    case JITCompilationMode::FTLForOSREntry:
+        out.print("FTLForOSREntryMode");
+        return;
+    }
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+} // namespace WTF
+
+#endif // ENABLE(JIT)
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITCompilationModehfromrev278081trunkSourceJavaScriptCoredfgDFGCompilationModeh"></a>
<div class="copfile"><h4>Copied: trunk/Source/JavaScriptCore/jit/JITCompilationMode.h (from rev 278081, trunk/Source/JavaScriptCore/dfg/DFGCompilationMode.h) (0 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITCompilationMode.h                             (rev 0)
+++ trunk/Source/JavaScriptCore/jit/JITCompilationMode.h        2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -0,0 +1,57 @@
</span><ins>+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#pragma once
+
+#include <wtf/PrintStream.h>
+
+namespace JSC {
+
+enum class JITCompilationMode {
+    InvalidCompilation,
+    Baseline,
+    DFG,
+    FTL,
+    FTLForOSREntry
+};
+
+inline bool isFTL(JITCompilationMode mode)
+{
+    switch (mode) {
+    case JITCompilationMode::FTL:
+    case JITCompilationMode::FTLForOSREntry:
+        return true;
+    default:
+        return false;
+    }
+}
+
+} // namespace JSC
+
+namespace WTF {
+
+void printInternal(PrintStream&, JSC::JITCompilationMode);
+
+} // namespace WTF
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITOperationscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JITOperations.cpp (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITOperations.cpp        2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/jit/JITOperations.cpp   2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -32,11 +32,9 @@
</span><span class="cx"> #include "ArrayConstructor.h"
</span><span class="cx"> #include "CacheableIdentifierInlines.h"
</span><span class="cx"> #include "CommonSlowPathsInlines.h"
</span><del>-#include "DFGCompilationMode.h"
</del><span class="cx"> #include "DFGDriver.h"
</span><span class="cx"> #include "DFGOSREntry.h"
</span><span class="cx"> #include "DFGThunks.h"
</span><del>-#include "DFGWorklist.h"
</del><span class="cx"> #include "Debugger.h"
</span><span class="cx"> #include "ExceptionFuzz.h"
</span><span class="cx"> #include "FrameTracers.h"
</span><span class="lines">@@ -46,6 +44,7 @@
</span><span class="cx"> #include "JIT.h"
</span><span class="cx"> #include "JITExceptions.h"
</span><span class="cx"> #include "JITToDFGDeferredCompilationCallback.h"
</span><ins>+#include "JITWorklist.h"
</ins><span class="cx"> #include "JSAsyncFunction.h"
</span><span class="cx"> #include "JSAsyncGenerator.h"
</span><span class="cx"> #include "JSAsyncGeneratorFunction.h"
</span><span class="lines">@@ -1898,40 +1897,28 @@
</span><span class="cx">         return encodeResult(nullptr, nullptr);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // We cannot be in the process of asynchronous compilation and also have an optimized
-    // replacement.
-    DFG::Worklist* worklist = DFG::existingGlobalDFGWorklistOrNull();
-    ASSERT(
-        !worklist
-        || !(worklist->compilationState(DFG::CompilationKey(codeBlock, DFG::DFGMode)) != DFG::Worklist::NotKnown
-        && codeBlock->hasOptimizedReplacement()));
</del><ins>+    // The call to JITWorklist::completeAllReadyPlansForVM() will complete all ready
+    // (i.e. compiled) code blocks. But if it completes ours, we also need to know
+    // what the result was so that we don't plow ahead and attempt OSR or immediate
+    // reoptimization. This will have already also set the appropriate JIT execution
+    // count threshold depending on what happened, so if the compilation was anything
+    // but successful we just want to return early. See the case for worklistState ==
+    // JITWorklist::Compiled, below.
</ins><span class="cx"> 
</span><del>-    DFG::Worklist::State worklistState;
-    if (worklist) {
-        // The call to DFG::Worklist::completeAllReadyPlansForVM() will complete all ready
-        // (i.e. compiled) code blocks. But if it completes ours, we also need to know
-        // what the result was so that we don't plow ahead and attempt OSR or immediate
-        // reoptimization. This will have already also set the appropriate JIT execution
-        // count threshold depending on what happened, so if the compilation was anything
-        // but successful we just want to return early. See the case for worklistState ==
-        // DFG::Worklist::Compiled, below.
-        
-        // Note that we could have alternatively just called Worklist::compilationState()
-        // here, and if it returned Compiled, we could have then called
-        // completeAndScheduleOSR() below. But that would have meant that it could take
-        // longer for code blocks to be completed: they would only complete when *their*
-        // execution count trigger fired; but that could take a while since the firing is
-        // racy. It could also mean that code blocks that never run again after being
-        // compiled would sit on the worklist until next GC. That's fine, but it's
-        // probably a waste of memory. Our goal here is to complete code blocks as soon as
-        // possible in order to minimize the chances of us executing baseline code after
-        // optimized code is already available.
-        worklistState = worklist->completeAllReadyPlansForVM(
-            vm, DFG::CompilationKey(codeBlock, DFG::DFGMode));
-    } else
-        worklistState = DFG::Worklist::NotKnown;
</del><ins>+    // Note that we could have alternatively just called Worklist::compilationState()
+    // here, and if it returned Compiled, we could have then called
+    // completeAndScheduleOSR() below. But that would have meant that it could take
+    // longer for code blocks to be completed: they would only complete when *their*
+    // execution count trigger fired; but that could take a while since the firing is
+    // racy. It could also mean that code blocks that never run again after being
+    // compiled would sit on the worklist until next GC. That's fine, but it's
+    // probably a waste of memory. Our goal here is to complete code blocks as soon as
+    // possible in order to minimize the chances of us executing baseline code after
+    // optimized code is already available.
+    JITWorklist::State worklistState = JITWorklist::ensureGlobalWorklist().completeAllReadyPlansForVM(
+        vm, JITCompilationKey(codeBlock, JITCompilationMode::DFG));
</ins><span class="cx"> 
</span><del>-    if (worklistState == DFG::Worklist::Compiling) {
</del><ins>+    if (worklistState == JITWorklist::Compiling) {
</ins><span class="cx">         CODEBLOCK_LOG_EVENT(codeBlock, "delayOptimizeToDFG", ("compiling"));
</span><span class="cx">         // We cannot be in the process of asynchronous compilation and also have an optimized
</span><span class="cx">         // replacement.
</span><span class="lines">@@ -1940,7 +1927,7 @@
</span><span class="cx">         return encodeResult(nullptr, nullptr);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (worklistState == DFG::Worklist::Compiled) {
</del><ins>+    if (worklistState == JITWorklist::Compiled) {
</ins><span class="cx">         // If we don't have an optimized replacement but we did just get compiled, then
</span><span class="cx">         // the compilation failed or was invalidated, in which case the execution count
</span><span class="cx">         // thresholds have already been set appropriately by
</span><span class="lines">@@ -2003,7 +1990,7 @@
</span><span class="cx"> 
</span><span class="cx">         CodeBlock* replacementCodeBlock = codeBlock->newReplacement();
</span><span class="cx">         CompilationResult result = DFG::compile(
</span><del>-            vm, replacementCodeBlock, nullptr, DFG::DFGMode, bytecodeIndex,
</del><ins>+            vm, replacementCodeBlock, nullptr, JITCompilationMode::DFG, bytecodeIndex,
</ins><span class="cx">             mustHandleValues, JITToDFGDeferredCompilationCallback::create());
</span><span class="cx">         
</span><span class="cx">         if (result != CompilationSuccessful) {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITPlancpp"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/jit/JITPlan.cpp (0 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITPlan.cpp                              (rev 0)
+++ trunk/Source/JavaScriptCore/jit/JITPlan.cpp 2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -0,0 +1,216 @@
</span><ins>+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JITPlan.h"
+
+#if ENABLE(JIT)
+
+#include "AbstractSlotVisitor.h"
+#include "CodeBlock.h"
+#include <wtf/CompilationThread.h>
+
+namespace JSC {
+
+extern Seconds totalBaselineCompileTime;
+extern Seconds totalDFGCompileTime;
+extern Seconds totalFTLCompileTime;
+extern Seconds totalFTLDFGCompileTime;
+extern Seconds totalFTLB3CompileTime;
+
+JITPlan::JITPlan(JITCompilationMode mode, CodeBlock* codeBlock)
+    : m_mode(mode)
+    , m_vm(&codeBlock->vm())
+    , m_codeBlock(codeBlock)
+{
+}
+
+void JITPlan::cancel()
+{
+    RELEASE_ASSERT(m_stage != JITPlanStage::Canceled);
+    ASSERT(m_vm);
+    m_stage = JITPlanStage::Canceled;
+    m_vm = nullptr;
+    m_codeBlock = nullptr;
+}
+
+void JITPlan::notifyCompiling()
+{
+    m_stage = JITPlanStage::Compiling;
+}
+
+void JITPlan::notifyReady()
+{
+    m_stage = JITPlanStage::Ready;
+}
+
+auto JITPlan::tier() const -> Tier
+{
+    switch (m_mode) {
+    case JITCompilationMode::InvalidCompilation:
+        RELEASE_ASSERT_NOT_REACHED();
+        return Tier::Baseline;
+    case JITCompilationMode::Baseline:
+        return Tier::Baseline;
+    case JITCompilationMode::DFG:
+        return Tier::DFG;
+    case JITCompilationMode::FTL:
+    case JITCompilationMode::FTLForOSREntry:
+        return Tier::FTL;
+    }
+}
+
+JITCompilationKey JITPlan::key()
+{
+    return JITCompilationKey(m_codeBlock->baselineAlternative(), m_mode);
+}
+
+bool JITPlan::isKnownToBeLiveAfterGC()
+{
+    if (m_stage == JITPlanStage::Canceled)
+        return false;
+    if (!m_vm->heap.isMarked(m_codeBlock->ownerExecutable()))
+        return false;
+    return true;
+}
+
+bool JITPlan::isKnownToBeLiveDuringGC(AbstractSlotVisitor& visitor)
+{
+    if (m_stage == JITPlanStage::Canceled)
+        return false;
+    if (!visitor.isMarked(m_codeBlock->ownerExecutable()))
+        return false;
+    return true;
+}
+
+bool JITPlan::iterateCodeBlocksForGC(AbstractSlotVisitor& visitor, const Function<void(CodeBlock*)>& func)
+{
+    if (!isKnownToBeLiveDuringGC(visitor))
+        return false;
+
+    // Compilation writes lots of values to a CodeBlock without performing
+    // an explicit barrier. So, we need to be pessimistic and assume that
+    // all our CodeBlocks must be visited during GC.
+    func(m_codeBlock);
+    return true;
+}
+
+bool JITPlan::checkLivenessAndVisitChildren(AbstractSlotVisitor& visitor)
+{
+    if (!isKnownToBeLiveDuringGC(visitor))
+        return false;
+
+    visitor.appendUnbarriered(m_codeBlock);
+    return true;
+}
+
+bool JITPlan::computeCompileTimes() const
+{
+    return reportCompileTimes()
+        || Options::reportTotalCompileTimes()
+        || (m_vm && m_vm->m_perBytecodeProfiler);
+}
+
+bool JITPlan::reportCompileTimes() const
+{
+    return Options::reportCompileTimes()
+        || (Options::reportBaselineCompileTimes() && m_mode == JITCompilationMode::Baseline)
+        || (Options::reportDFGCompileTimes() && m_mode == JITCompilationMode::DFG)
+        || (Options::reportFTLCompileTimes() && isFTL());
+}
+
+void JITPlan::compileInThread(JITWorklistThread* thread)
+{
+    m_thread = thread;
+
+    MonotonicTime before;
+    CString codeBlockName;
+    if (UNLIKELY(computeCompileTimes()))
+        before = MonotonicTime::now();
+    if (UNLIKELY(reportCompileTimes()))
+        codeBlockName = toCString(*m_codeBlock);
+
+    CompilationScope compilationScope;
+
+    if (DFG::logCompilationChanges(m_mode) || Options::logPhaseTimes())
+        dataLog("DFG(Plan) compiling ", *m_codeBlock, " with ", m_mode, ", instructions size = ", m_codeBlock->instructionsSize(), "\n");
+
+    CompilationPath path = compileInThreadImpl();
+
+    RELEASE_ASSERT((path == CancelPath) == (m_stage == JITPlanStage::Canceled));
+
+    MonotonicTime after;
+    if (UNLIKELY(computeCompileTimes())) {
+        after = MonotonicTime::now();
+
+        if (Options::reportTotalCompileTimes()) {
+            if (isFTL()) {
+                totalFTLCompileTime += after - before;
+                totalFTLDFGCompileTime += m_timeBeforeFTL - before;
+                totalFTLB3CompileTime += after - m_timeBeforeFTL;
+            } else if (mode() == JITCompilationMode::Baseline)
+                totalBaselineCompileTime += after - before;
+            else
+                totalDFGCompileTime += after - before;
+        }
+    }
+    const char* pathName = nullptr;
+    switch (path) {
+    case FailPath:
+        pathName = "N/A (fail)";
+        break;
+    case BaselinePath:
+        pathName = "Baseline";
+        break;
+    case DFGPath:
+        pathName = "DFG";
+        break;
+    case FTLPath:
+        pathName = "FTL";
+        break;
+    case CancelPath:
+        pathName = "Canceled";
+        break;
+    default:
+        RELEASE_ASSERT_NOT_REACHED();
+        break;
+    }
+    if (m_codeBlock) { // m_codeBlock will be null if the compilation was cancelled.
+        if (path == FTLPath)
+            CODEBLOCK_LOG_EVENT(m_codeBlock, "ftlCompile", ("took ", (after - before).milliseconds(), " ms (DFG: ", (m_timeBeforeFTL - before).milliseconds(), ", B3: ", (after - m_timeBeforeFTL).milliseconds(), ") with ", pathName));
+        else
+            CODEBLOCK_LOG_EVENT(m_codeBlock, "dfgCompile", ("took ", (after - before).milliseconds(), " ms with ", pathName));
+    }
+    if (UNLIKELY(reportCompileTimes())) {
+        dataLog("Optimized ", codeBlockName, " using ", m_mode, " with ", pathName, " into ", codeSize(), " bytes in ", (after - before).milliseconds(), " ms");
+        if (path == FTLPath)
+            dataLog(" (DFG: ", (m_timeBeforeFTL - before).milliseconds(), ", B3: ", (after - m_timeBeforeFTL).milliseconds(), ")");
+        dataLog(".\n");
+    }
+}
+
+} // namespace JSC
+
+#endif // ENABLE(DFG_JIT)
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITPlanh"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/jit/JITPlan.h (0 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITPlan.h                                (rev 0)
+++ trunk/Source/JavaScriptCore/jit/JITPlan.h   2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -0,0 +1,100 @@
</span><ins>+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(JIT)
+
+#include "CompilationResult.h"
+#include "JITCompilationKey.h"
+#include "JITCompilationMode.h"
+#include "JITPlanStage.h"
+#include "ReleaseHeapAccessScope.h"
+#include <wtf/MonotonicTime.h>
+#include <wtf/ThreadSafeRefCounted.h>
+
+namespace JSC {
+
+class AbstractSlotVisitor;
+class CodeBlock;
+class JITWorklistThread;
+class VM;
+
+class JITPlan : public ThreadSafeRefCounted<JITPlan> {
+protected:
+    JITPlan(JITCompilationMode, CodeBlock*);
+
+public:
+    virtual ~JITPlan() { }
+
+    VM* vm() const { return m_vm; }
+    CodeBlock* codeBlock() const { return m_codeBlock; }
+    JITWorklistThread* thread() const { return m_thread; }
+
+    JITCompilationMode mode() const { return m_mode; }
+
+    JITPlanStage stage() const { return m_stage; }
+    bool isFTL() const { return ::JSC::isFTL(m_mode); }
+
+    enum class Tier { Baseline = 0, DFG = 1, FTL = 2, Count = 3 };
+    Tier tier() const;
+
+    JITCompilationKey key();
+
+    void compileInThread(JITWorklistThread*);
+
+    virtual size_t codeSize() const = 0;
+
+    virtual CompilationResult finalize() = 0;
+
+    virtual void finalizeInGC() { }
+
+    void notifyCompiling();
+    virtual void notifyReady();
+    virtual void cancel();
+
+    virtual bool isKnownToBeLiveAfterGC();
+    virtual bool isKnownToBeLiveDuringGC(AbstractSlotVisitor&);
+    virtual bool iterateCodeBlocksForGC(AbstractSlotVisitor&, const Function<void(CodeBlock*)>&);
+    virtual bool checkLivenessAndVisitChildren(AbstractSlotVisitor&);
+
+protected:
+    bool computeCompileTimes() const;
+    bool reportCompileTimes() const;
+
+    enum CompilationPath { FailPath, BaselinePath, DFGPath, FTLPath, CancelPath };
+    virtual CompilationPath compileInThreadImpl() = 0;
+
+    JITPlanStage m_stage { JITPlanStage::Preparing };
+    JITCompilationMode m_mode;
+    MonotonicTime m_timeBeforeFTL;
+    VM* m_vm;
+    CodeBlock* m_codeBlock;
+    JITWorklistThread* m_thread { nullptr };
+};
+
+} // namespace JSC
+
+#endif // ENABLE(JIT)
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITPlanStagehfromrev278081trunkSourceJavaScriptCoredfgDFGThreadDatacpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/JavaScriptCore/jit/JITPlanStage.h (from rev 278081, trunk/Source/JavaScriptCore/dfg/DFGThreadData.cpp) (0 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITPlanStage.h                           (rev 0)
+++ trunk/Source/JavaScriptCore/jit/JITPlanStage.h      2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#pragma once
+
+namespace JSC {
+
+enum class JITPlanStage {
+    Preparing,
+    Compiling,
+    Ready,
+    Canceled,
+};
+
+
+} // namespace JSC
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITSafepointcppfromrev278081trunkSourceJavaScriptCoredfgDFGSafepointcpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/JavaScriptCore/jit/JITSafepoint.cpp (from rev 278081, trunk/Source/JavaScriptCore/dfg/DFGSafepoint.cpp) (0 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITSafepoint.cpp                         (rev 0)
+++ trunk/Source/JavaScriptCore/jit/JITSafepoint.cpp    2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -0,0 +1,147 @@
</span><ins>+/*
+ * Copyright (C) 2014-2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "JITSafepoint.h"
+
+#if ENABLE(JIT)
+
+#include "JITPlan.h"
+#include "JITScannable.h"
+#include "JITWorklistThread.h"
+#include "SlotVisitor.h"
+
+namespace JSC {
+
+Safepoint::Result::~Result()
+{
+    RELEASE_ASSERT(m_wasChecked);
+}
+
+bool Safepoint::Result::didGetCancelled()
+{
+    m_wasChecked = true;
+    return m_didGetCancelled;
+}
+
+Safepoint::Safepoint(JITPlan& plan, Result& result)
+    : m_vm(plan.vm())
+    , m_plan(plan)
+    , m_didCallBegin(false)
+    , m_result(result)
+{
+    RELEASE_ASSERT(result.m_wasChecked);
+    result.m_wasChecked = false;
+    result.m_didGetCancelled = false;
+}
+
+Safepoint::~Safepoint()
+{
+    RELEASE_ASSERT(m_didCallBegin);
+    if (JITWorklistThread* thread = m_plan.thread()) {
+        RELEASE_ASSERT(thread->m_safepoint == this);
+        thread->m_rightToRun.lock();
+        thread->m_safepoint = nullptr;
+    }
+}
+
+void Safepoint::add(Scannable* scannable)
+{
+    RELEASE_ASSERT(!m_didCallBegin);
+    m_scannables.append(scannable);
+}
+
+void Safepoint::begin()
+{
+    RELEASE_ASSERT(!m_didCallBegin);
+    m_didCallBegin = true;
+    if (JITWorklistThread* data = m_plan.thread()) {
+        RELEASE_ASSERT(!data->m_safepoint);
+        data->m_safepoint = this;
+        data->m_rightToRun.unlockFairly();
+    }
+}
+
+template<typename Visitor>
+void Safepoint::checkLivenessAndVisitChildren(Visitor& visitor)
+{
+    RELEASE_ASSERT(m_didCallBegin);
+
+    if (m_result.m_didGetCancelled)
+        return; // We were cancelled during a previous GC!
+    
+    if (!isKnownToBeLiveDuringGC(visitor))
+        return;
+    
+    for (unsigned i = m_scannables.size(); i--;)
+        m_scannables[i]->visitChildren(visitor);
+}
+
+template void Safepoint::checkLivenessAndVisitChildren(AbstractSlotVisitor&);
+template void Safepoint::checkLivenessAndVisitChildren(SlotVisitor&);
+
+template<typename Visitor>
+bool Safepoint::isKnownToBeLiveDuringGC(Visitor& visitor)
+{
+    RELEASE_ASSERT(m_didCallBegin);
+    
+    if (m_result.m_didGetCancelled)
+        return true; // We were cancelled during a previous GC, so let's not mess with it this time around - pretend it's live and move on.
+    
+    return m_plan.isKnownToBeLiveDuringGC(visitor);
+}
+
+template bool Safepoint::isKnownToBeLiveDuringGC(AbstractSlotVisitor&);
+template bool Safepoint::isKnownToBeLiveDuringGC(SlotVisitor&);
+
+bool Safepoint::isKnownToBeLiveAfterGC()
+{
+    RELEASE_ASSERT(m_didCallBegin);
+    
+    if (m_result.m_didGetCancelled)
+        return true; // We were cancelled during a previous GC, so let's not mess with it this time around - pretend it's live and move on.
+    
+    return m_plan.isKnownToBeLiveAfterGC();
+}
+
+void Safepoint::cancel()
+{
+    RELEASE_ASSERT(m_didCallBegin);
+    RELEASE_ASSERT(!m_result.m_didGetCancelled); // We cannot get cancelled twice because subsequent GCs will think that we're alive and they will not do anything to us.
+    
+    RELEASE_ASSERT(m_plan.stage() == JITPlanStage::Canceled);
+    m_result.m_didGetCancelled = true;
+    m_vm = nullptr;
+}
+
+VM* Safepoint::vm() const
+{
+    return m_vm;
+}
+
+} // namespace JSC
+
+#endif // ENABLE(JIT)
+
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITSafepointhfromrev278081trunkSourceJavaScriptCoredfgDFGSafepointh"></a>
<div class="copfile"><h4>Copied: trunk/Source/JavaScriptCore/jit/JITSafepoint.h (from rev 278081, trunk/Source/JavaScriptCore/dfg/DFGSafepoint.h) (0 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITSafepoint.h                           (rev 0)
+++ trunk/Source/JavaScriptCore/jit/JITSafepoint.h      2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -0,0 +1,83 @@
</span><ins>+/*
+ * Copyright (C) 2014-2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#pragma once
+
+#if ENABLE(JIT)
+
+#include <wtf/Vector.h>
+
+namespace JSC {
+
+class JITPlan;
+class Scannable;
+class VM;
+
+class Safepoint {
+public:
+    class Result {
+    public:
+        Result()
+            : m_didGetCancelled(false)
+            , m_wasChecked(true)
+        {
+        }
+        
+        ~Result();
+        
+        bool didGetCancelled();
+        
+    private:
+        friend class Safepoint;
+        
+        bool m_didGetCancelled;
+        bool m_wasChecked;
+    };
+    
+    Safepoint(JITPlan&, Result&);
+    ~Safepoint();
+    
+    void add(Scannable*);
+    
+    void begin();
+
+    template<typename Visitor> void checkLivenessAndVisitChildren(Visitor&);
+    template<typename Visitor> bool isKnownToBeLiveDuringGC(Visitor&);
+    bool isKnownToBeLiveAfterGC();
+    void cancel();
+    
+    VM* vm() const; // May return null if we've been cancelled.
+
+private:
+    VM* m_vm;
+    JITPlan& m_plan;
+    Vector<Scannable*> m_scannables;
+    bool m_didCallBegin;
+    Result& m_result;
+};
+
+} // namespace JSC
+
+#endif // ENABLE(JIT)
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITScannablehfromrev278081trunkSourceJavaScriptCoredfgDFGScannableh"></a>
<div class="copfile"><h4>Copied: trunk/Source/JavaScriptCore/jit/JITScannable.h (from rev 278081, trunk/Source/JavaScriptCore/dfg/DFGScannable.h) (0 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITScannable.h                           (rev 0)
+++ trunk/Source/JavaScriptCore/jit/JITScannable.h      2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+/*
+ * Copyright (C) 2014-2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#pragma once
+
+#if ENABLE(JIT)
+
+namespace JSC {
+
+class AbstractSlotVisitor;
+class SlotVisitor;
+
+class Scannable {
+public:
+    Scannable() { }
+    virtual ~Scannable() { }
+
+    virtual void visitChildren(AbstractSlotVisitor&) = 0;
+    virtual void visitChildren(SlotVisitor&) = 0;
+};
+
+} // namespace JSC
+
+#endif // ENABLE(DFG_JIT)
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITWorklistcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JITWorklist.cpp (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITWorklist.cpp  2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/jit/JITWorklist.cpp     2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2016-2020 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2016-2021 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -28,296 +28,324 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(JIT)
</span><span class="cx"> 
</span><del>-#include "JIT.h"
</del><ins>+#include "JITSafepoint.h"
+#include "JITWorklistThread.h"
+#include "SlotVisitor.h"
</ins><span class="cx"> #include "VMInlines.h"
</span><span class="cx"> #include <wtf/CompilationThread.h>
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><del>-class JITWorklist::Plan : public ThreadSafeRefCounted<JITWorklist::Plan> {
-public:
-    Plan(CodeBlock* codeBlock, BytecodeIndex loopOSREntryBytecodeIndex)
-        : m_codeBlock(codeBlock)
-        , m_jit(codeBlock->vm(), codeBlock, loopOSREntryBytecodeIndex)
-    {
-        m_jit.doMainThreadPreparationBeforeCompile();
-    }
-    
-    void compileInThread()
-    {
-        m_jit.compileAndLinkWithoutFinalizing(JITCompilationCanFail);
-        
-        Locker locker { m_lock };
-        m_isFinishedCompiling = true;
-    }
-    
-    void finalize(bool needsFence)
-    {
-        CompilationResult result = m_jit.finalizeOnMainThread();
-        switch (result) {
-        case CompilationFailed:
-            CODEBLOCK_LOG_EVENT(m_codeBlock, "delayJITCompile", ("compilation failed"));
-            dataLogLnIf(Options::verboseOSR(), "    JIT compilation failed.");
-            m_codeBlock->dontJITAnytimeSoon();
-            m_codeBlock->m_didFailJITCompilation = true;
-            return;
-        case CompilationSuccessful:
-            if (needsFence)
-                WTF::crossModifyingCodeFence();
-            dataLogLnIf(Options::verboseOSR(), "    JIT compilation successful.");
-            m_codeBlock->ownerExecutable()->installCode(m_codeBlock);
-            m_codeBlock->jitSoon();
-            return;
-        default:
-            RELEASE_ASSERT_NOT_REACHED();
-            return;
-        }
-    }
-    
-    CodeBlock* codeBlock() { return m_codeBlock; }
-    VM& vm() { return m_codeBlock->vm(); }
-    
-    bool isFinishedCompiling()
-    {
-        Locker locker { m_lock };
-        return m_isFinishedCompiling;
-    }
-    
-    static void compileOnMainThreadNow(CodeBlock* codeBlock, BytecodeIndex loopOSREntryBytecodeIndex)
-    {
-        Plan plan(codeBlock, loopOSREntryBytecodeIndex);
-        plan.compileInThread();
-        plan.finalize(false);
-    }
-    
-private:
-    CodeBlock* m_codeBlock;
-    JIT m_jit;
-    Lock m_lock;
-    bool m_isFinishedCompiling { false };
-};
</del><ins>+JITWorklist::JITWorklist()
+    : m_lock(Box<UncheckedLock>::create())
+    , m_planEnqueued(AutomaticThreadCondition::create())
+{
+    m_maximumNumberOfConcurrentCompilationsPerTier = {
+        Options::numberOfWorklistThreads(),
+        Options::numberOfDFGCompilerThreads(),
+        Options::numberOfFTLCompilerThreads(),
+    };
</ins><span class="cx"> 
</span><del>-class JITWorklist::Thread final : public AutomaticThread {
-public:
-    Thread(const AbstractLocker& locker, JITWorklist& worklist)
-        : AutomaticThread(locker, worklist.m_lock, worklist.m_condition.copyRef())
-        , m_worklist(worklist)
-    {
-        m_worklist.m_numAvailableThreads++;
-    }
</del><ins>+    Locker locker { *m_lock };
+    for (unsigned i = 0; i < Options::numberOfWorklistThreads(); ++i)
+        m_threads.append(new JITWorklistThread(locker, *this));
+}
</ins><span class="cx"> 
</span><del>-    const char* name() const final
-    {
-#if OS(LINUX)
-        return "JITWorker";
-#else
-        return "JIT Worklist Helper Thread";
-#endif
</del><ins>+JITWorklist::~JITWorklist()
+{
+    UNREACHABLE_FOR_PLATFORM();
+}
+
+static JITWorklist* theGlobalJITWorklist { nullptr };
+
+JITWorklist* JITWorklist::existingGlobalWorklistOrNull()
+{
+    return theGlobalJITWorklist;
+}
+
+JITWorklist& JITWorklist::ensureGlobalWorklist()
+{
+    static std::once_flag once;
+    std::call_once(
+        once,
+        [] {
+            auto* worklist = new JITWorklist();
+            WTF::storeStoreFence();
+            theGlobalJITWorklist = worklist;
+        });
+    return *theGlobalJITWorklist;
+}
+
+CompilationResult JITWorklist::enqueue(Ref<JITPlan> plan)
+{
+    if (!Options::useConcurrentJIT()) {
+        plan->compileInThread(nullptr);
+        return plan->finalize();
</ins><span class="cx">     }
</span><del>-    
-private:
-    PollResult poll(const AbstractLocker&) final
-    {
-        RELEASE_ASSERT(m_worklist.m_numAvailableThreads);
-        
-        if (m_worklist.m_queue.isEmpty())
-            return PollResult::Wait;
-        
-        m_myPlans = WTFMove(m_worklist.m_queue);
-        m_worklist.m_numAvailableThreads--;
-        return PollResult::Work;
-    }
-    
-    WorkResult work() final
-    {
-        RELEASE_ASSERT(!m_myPlans.isEmpty());
-        
-        for (RefPtr<Plan>& plan : m_myPlans) {
-            plan->compileInThread();
-            plan = nullptr;
-            
-            // Make sure that the main thread realizes that we just compiled something. Notifying
-            // a condition is basically free if nobody is waiting.
-            Locker locker { *m_worklist.m_lock };
-            m_worklist.m_condition->notifyAll(locker);
-        }
-        
-        m_myPlans.clear();
-        
-        Locker locker { *m_worklist.m_lock };
-        m_worklist.m_numAvailableThreads++;
-        return WorkResult::Continue;
-    }
</del><span class="cx"> 
</span><del>-    void threadDidStart() final
-    {
-        m_compilationScope = makeUnique<CompilationScope>();
</del><ins>+    Locker locker { *m_lock };
+    if (Options::verboseCompilationQueue()) {
+        dump(locker, WTF::dataFile());
+        dataLog(": Enqueueing plan to optimize ", plan->key(), "\n");
</ins><span class="cx">     }
</span><del>-    
-    void threadIsStopping(const AbstractLocker&) final
-    {
-        m_compilationScope = nullptr;
-    }
</del><ins>+    ASSERT(m_plans.find(plan->key()) == m_plans.end());
+    m_plans.add(plan->key(), plan.copyRef());
+    m_queues[static_cast<unsigned>(plan->tier())].append(WTFMove(plan));
+    m_planEnqueued->notifyOne(locker);
+    return CompilationDeferred;
+}
</ins><span class="cx"> 
</span><del>-    JITWorklist& m_worklist;
-    Plans m_myPlans;
-    std::unique_ptr<CompilationScope> m_compilationScope;
-};
</del><ins>+size_t JITWorklist::queueLength() const
+{
+    Locker locker { *m_lock };
+    return queueLength(locker);
+}
</ins><span class="cx"> 
</span><del>-JITWorklist::JITWorklist()
-    : m_lock(Box<UncheckedLock>::create())
-    , m_condition(AutomaticThreadCondition::create())
</del><ins>+size_t JITWorklist::queueLength(const AbstractLocker&) const
</ins><span class="cx"> {
</span><ins>+    size_t queueLength = 0;
+    for (unsigned i = 0; i < static_cast<unsigned>(JITPlan::Tier::Count); ++i)
+        queueLength += m_queues[i].size();
+    return queueLength;
+}
+
+void JITWorklist::suspendAllThreads()
+{
+    m_suspensionLock.lock();
+    for (unsigned i = m_threads.size(); i--;)
+        m_threads[i]->m_rightToRun.lock();
+}
+
+void JITWorklist::resumeAllThreads()
+{
+    for (unsigned i = m_threads.size(); i--;)
+        m_threads[i]->m_rightToRun.unlock();
+    m_suspensionLock.unlock();
+}
+
+auto JITWorklist::compilationState(JITCompilationKey key) -> State
+{
</ins><span class="cx">     Locker locker { *m_lock };
</span><del>-    m_thread = new Thread(locker, *this);
</del><ins>+    const auto& iter = m_plans.find(key);
+    if (iter == m_plans.end())
+        return NotKnown;
+    return iter->value->stage() == JITPlanStage::Ready ? Compiled : Compiling;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-JITWorklist::~JITWorklist()
</del><ins>+auto JITWorklist::completeAllReadyPlansForVM(VM& vm, JITCompilationKey requestedKey) -> State
</ins><span class="cx"> {
</span><del>-    UNREACHABLE_FOR_PLATFORM();
</del><ins>+    DeferGC deferGC(vm.heap);
+
+    Vector<RefPtr<JITPlan>, 8> myReadyPlans;
+    removeAllReadyPlansForVM(vm, myReadyPlans);
+
+    State resultingState = NotKnown;
+    while (!myReadyPlans.isEmpty()) {
+        RefPtr<JITPlan> plan = myReadyPlans.takeLast();
+        JITCompilationKey currentKey = plan->key();
+
+        dataLogLnIf(Options::verboseCompilationQueue(), *this, ": Completing ", currentKey);
+
+        RELEASE_ASSERT(plan->stage() == JITPlanStage::Ready);
+
+        plan->finalize();
+
+        if (currentKey == requestedKey)
+            resultingState = Compiled;
+    }
+
+    if (!!requestedKey && resultingState == NotKnown) {
+        Locker locker { *m_lock };
+        if (m_plans.contains(requestedKey))
+            resultingState = Compiling;
+    }
+
+    return resultingState;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool JITWorklist::completeAllForVM(VM& vm)
</del><ins>+
+void JITWorklist::waitUntilAllPlansForVMAreReady(VM& vm)
</ins><span class="cx"> {
</span><del>-    bool result = false;
</del><span class="cx">     DeferGC deferGC(vm.heap);
</span><ins>+
+    // While we are waiting for the compiler to finish, the collector might have already suspended
+    // the compiler and then it will be waiting for us to stop. That's a deadlock. We avoid that
+    // deadlock by relinquishing our heap access, so that the collector pretends that we are stopped
+    // even if we aren't.
+    ReleaseHeapAccessScope releaseHeapAccessScope(vm.heap);
+
+    // Wait for all of the plans for the given VM to complete. The idea here
+    // is that we want all of the caller VM's plans to be done. We don't care
+    // about any other VM's plans, and we won't attempt to wait on those.
+    // After we release this lock, we know that although other VMs may still
+    // be adding plans, our VM will not be.
+    Locker locker { *m_lock };
+
+    if (Options::verboseCompilationQueue()) {
+        dump(locker, WTF::dataFile());
+        dataLog(": Waiting for all in VM to complete.\n");
+    }
+
</ins><span class="cx">     for (;;) {
</span><del>-        Vector<RefPtr<Plan>, 32> myPlans;
-        {
-            Locker locker { *m_lock };
-            for (;;) {
-                bool didFindUnfinishedPlan = false;
-                m_plans.removeAllMatching(
-                    [&] (RefPtr<Plan>& plan) {
-                        if (&plan->vm() != &vm)
-                            return false;
-                        if (!plan->isFinishedCompiling()) {
-                            didFindUnfinishedPlan = true;
-                            return false;
-                        }
-                        myPlans.append(WTFMove(plan));
-                        return true;
-                    });
-                
-                // If we found plans then we should finalize them now.
-                if (!myPlans.isEmpty())
-                    break;
-                
-                // If we don't find plans, then we're either done or we need to wait, depending on
-                // whether we found some unfinished plans.
-                if (!didFindUnfinishedPlan)
-                    return result;
-                
-                m_condition->wait(*m_lock);
</del><ins>+        bool allAreCompiled = true;
+        for (const auto& entry : m_plans) {
+            if (entry.value->vm() != &vm)
+                continue;
+            if (entry.value->stage() != JITPlanStage::Ready) {
+                allAreCompiled = false;
+                break;
</ins><span class="cx">             }
</span><span class="cx">         }
</span><del>-        
-        RELEASE_ASSERT(!myPlans.isEmpty());
-        result = true;
-        finalizePlans(myPlans);
</del><ins>+
+        if (allAreCompiled)
+            break;
+
+        m_planCompiled.wait(*m_lock);
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void JITWorklist::poll(VM& vm)
</del><ins>+void JITWorklist::completeAllPlansForVM(VM& vm)
</ins><span class="cx"> {
</span><span class="cx">     DeferGC deferGC(vm.heap);
</span><del>-    Plans myPlans;
-    {
-        Locker locker { *m_lock };
-        m_plans.removeAllMatching(
-            [&] (RefPtr<Plan>& plan) {
-                if (&plan->vm() != &vm)
-                    return false;
-                if (!plan->isFinishedCompiling())
-                    return false;
-                myPlans.append(WTFMove(plan));
-                return true;
-            });
-    }
-    
-    finalizePlans(myPlans);
</del><ins>+    waitUntilAllPlansForVMAreReady(vm);
+    completeAllReadyPlansForVM(vm);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void JITWorklist::compileLater(CodeBlock* codeBlock, BytecodeIndex loopOSREntryBytecodeIndex)
</del><ins>+void JITWorklist::cancelAllPlansForVM(VM& vm)
</ins><span class="cx"> {
</span><del>-    DeferGC deferGC(codeBlock->vm().heap);
-    RELEASE_ASSERT(codeBlock->jitType() == JITType::InterpreterThunk);
-    
-    if (codeBlock->m_didFailJITCompilation) {
-        codeBlock->dontJITAnytimeSoon();
-        return;
</del><ins>+    removeMatchingPlansForVM(vm, [&](JITPlan& plan) {
+        return plan.stage() != JITPlanStage::Compiling;
+    });
+
+    waitUntilAllPlansForVMAreReady(vm);
+
+    Vector<RefPtr<JITPlan>, 8> myReadyPlans;
+    removeAllReadyPlansForVM(vm, myReadyPlans);
+}
+
+void JITWorklist::removeDeadPlans(VM& vm)
+{
+    removeMatchingPlansForVM(vm, [&](JITPlan& plan) {
+        if (!plan.isKnownToBeLiveAfterGC())
+            return true;
+        plan.finalizeInGC();
+        return false;
+    });
+
+    // No locking needed for this part, see comment in visitWeakReferences().
+    for (unsigned i = m_threads.size(); i--;) {
+        Safepoint* safepoint = m_threads[i].get()->m_safepoint;
+        if (!safepoint)
+            continue;
+        if (safepoint->vm() != &vm)
+            continue;
+        if (safepoint->isKnownToBeLiveAfterGC())
+            continue;
+        safepoint->cancel();
</ins><span class="cx">     }
</span><del>-    
-    if (!Options::useConcurrentJIT()) {
-        Plan::compileOnMainThreadNow(codeBlock, loopOSREntryBytecodeIndex);
-        return;
-    }
-    
-    codeBlock->jitSoon();
</del><ins>+}
</ins><span class="cx"> 
</span><ins>+unsigned JITWorklist::setMaximumNumberOfConcurrentDFGCompilations(unsigned n)
+{
+    unsigned oldValue = m_maximumNumberOfConcurrentCompilationsPerTier[static_cast<unsigned>(JITPlan::Tier::DFG)];
+    m_maximumNumberOfConcurrentCompilationsPerTier[static_cast<unsigned>(JITPlan::Tier::DFG)] = n;
+    return oldValue;
+}
+
+unsigned JITWorklist::setMaximumNumberOfConcurrentFTLCompilations(unsigned n)
+{
+    unsigned oldValue = m_maximumNumberOfConcurrentCompilationsPerTier[static_cast<unsigned>(JITPlan::Tier::FTL)];
+    m_maximumNumberOfConcurrentCompilationsPerTier[static_cast<unsigned>(JITPlan::Tier::FTL)] = n;
+    return oldValue;
+}
+
+template<typename Visitor>
+void JITWorklist::visitWeakReferences(Visitor& visitor)
+{
+    VM* vm = &visitor.heap()->vm();
</ins><span class="cx">     {
</span><span class="cx">         Locker locker { *m_lock };
</span><del>-        
-        if (m_planned.contains(codeBlock))
-            return;
-        
-        if (m_numAvailableThreads) {
-            m_planned.add(codeBlock);
-            RefPtr<Plan> plan = adoptRef(new Plan(codeBlock, loopOSREntryBytecodeIndex));
-            m_plans.append(plan);
-            m_queue.append(plan);
-            m_condition->notifyAll(locker);
-            return;
</del><ins>+        for (auto& entry : m_plans) {
+            if (entry.value->vm() != vm)
+                continue;
+            entry.value->checkLivenessAndVisitChildren(visitor);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><ins>+    // This loop doesn't need locking because:
+    // (1) no new threads can be added to m_threads. Hence, it is immutable and needs no locks.
+    // (2) JITWorklistThread::m_safepoint is protected by that thread's m_rightToRun which we must be
+    //     holding here because of a prior call to suspendAllThreads().
+    for (unsigned i = m_threads.size(); i--;) {
+        Safepoint* safepoint = m_threads[i]->m_safepoint;
+        if (safepoint && safepoint->vm() == vm)
+            safepoint->checkLivenessAndVisitChildren(visitor);
+    }
+}
+template void JITWorklist::visitWeakReferences(AbstractSlotVisitor&);
+template void JITWorklist::visitWeakReferences(SlotVisitor&);
</ins><span class="cx"> 
</span><del>-    // Compiling on the main thread if the helper thread isn't available is a defense against this
-    // pathology:
-    //
-    // 1) Do something that is allowed to take a while, like load a giant piece of initialization
-    //    code. This plans the compile of the init code, but doesn't finish it. It will take a
-    //    while.
-    //
-    // 2) Do something that is supposed to be quick. Now all baseline compiles, and so all DFG and
-    //    FTL compiles, of everything is blocked on the long-running baseline compile of that
-    //    initialization code.
-    //
-    // The single-threaded concurrent JIT has this tendency to convoy everything while at the same
-    // time postponing when it happens, which means that the convoy delays are less predictable.
-    // This works around the issue. If the concurrent JIT thread is convoyed, we revert to main
-    // thread compiles. This is probably not as good as if we had multiple JIT threads. Maybe we
-    // can do that someday.
-    Plan::compileOnMainThreadNow(codeBlock, loopOSREntryBytecodeIndex);
</del><ins>+void JITWorklist::dump(PrintStream& out) const
+{
+    Locker locker { *m_lock };
+    dump(locker, out);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void JITWorklist::finalizePlans(Plans& myPlans)
</del><ins>+void JITWorklist::dump(const AbstractLocker& locker, PrintStream& out) const
</ins><span class="cx"> {
</span><del>-    for (RefPtr<Plan>& plan : myPlans) {
-        plan->finalize(true);
-        
-        Locker locker { *m_lock };
-        m_planned.remove(plan->codeBlock());
-    }
</del><ins>+    out.print(
+        "JITWorklist(", RawPointer(this), ")[Queue Length = ", queueLength(locker),
+        ", Map Size = ", m_plans.size(), ", Num Ready = ", m_readyPlans.size(),
+        ", Num Active Threads = ", m_numberOfActiveThreads, "/", m_threads.size(), "]");
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static JITWorklist* theGlobalJITWorklist { nullptr };
-
-JITWorklist* JITWorklist::existingGlobalWorklistOrNull()
</del><ins>+void JITWorklist::removeAllReadyPlansForVM(VM& vm, Vector<RefPtr<JITPlan>, 8>& myReadyPlans)
</ins><span class="cx"> {
</span><del>-    return theGlobalJITWorklist;
</del><ins>+    DeferGC deferGC(vm.heap);
+    Locker locker { *m_lock };
+    for (size_t i = 0; i < m_readyPlans.size(); ++i) {
+        RefPtr<JITPlan> plan = m_readyPlans[i];
+        if (plan->vm() != &vm)
+            continue;
+        if (plan->stage() != JITPlanStage::Ready)
+            continue;
+        myReadyPlans.append(plan);
+        m_readyPlans[i--] = m_readyPlans.last();
+        m_readyPlans.removeLast();
+        m_plans.remove(plan->key());
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-JITWorklist& JITWorklist::ensureGlobalWorklist()
</del><ins>+template<typename MatchFunction>
+void JITWorklist::removeMatchingPlansForVM(VM& vm, const MatchFunction& matches)
</ins><span class="cx"> {
</span><del>-    static std::once_flag once;
-    std::call_once(
-        once,
-        [] {
-            auto* worklist = new JITWorklist();
-            WTF::storeStoreFence();
-            theGlobalJITWorklist = worklist;
-        });
-    return *theGlobalJITWorklist;
</del><ins>+    Locker locker { *m_lock };
+    HashSet<JITCompilationKey> deadPlanKeys;
+    for (auto& entry : m_plans) {
+        JITPlan* plan = entry.value.get();
+        if (plan->vm() != &vm)
+            continue;
+        if (!matches(*plan))
+            continue;
+        RELEASE_ASSERT(plan->stage() != JITPlanStage::Canceled);
+        deadPlanKeys.add(plan->key());
+    }
+    for (JITCompilationKey key : deadPlanKeys)
+        m_plans.take(key)->cancel();
+    for (auto& queue : m_queues) {
+        Deque<RefPtr<JITPlan>> newQueue;
+        while (!queue.isEmpty()) {
+            RefPtr<JITPlan> plan = queue.takeFirst();
+            if (plan->stage() != JITPlanStage::Canceled)
+                newQueue.append(plan);
+        }
+        queue.swap(newQueue);
+    }
+    for (unsigned i = 0; i < m_readyPlans.size(); ++i) {
+        if (m_readyPlans[i]->stage() != JITPlanStage::Canceled)
+            continue;
+        m_readyPlans[i--] = m_readyPlans.last();
+        m_readyPlans.removeLast();
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace JSC
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITWorklisth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JITWorklist.h (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITWorklist.h    2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/jit/JITWorklist.h       2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2016 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2016-2021 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -20,7 +20,7 @@
</span><span class="cx">  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
</span><span class="cx">  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
</span><span class="cx">  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
</span><del>- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
</del><ins>+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #pragma once
</span><span class="lines">@@ -27,10 +27,10 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(JIT)
</span><span class="cx"> 
</span><del>-#include "BytecodeIndex.h"
-#include <wtf/AutomaticThread.h>
</del><ins>+#include "JITPlan.h"
+#include "JITWorklistThread.h"
+#include <wtf/Deque.h>
</ins><span class="cx"> #include <wtf/FastMalloc.h>
</span><del>-#include <wtf/HashSet.h>
</del><span class="cx"> #include <wtf/Lock.h>
</span><span class="cx"> #include <wtf/Noncopyable.h>
</span><span class="cx"> #include <wtf/RefPtr.h>
</span><span class="lines">@@ -45,37 +45,84 @@
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(JITWorklist);
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> 
</span><del>-    class Plan;
-    typedef Vector<RefPtr<Plan>, 32> Plans;
-    
</del><ins>+    friend class JITWorklistThread;
+
</ins><span class="cx"> public:
</span><span class="cx">     ~JITWorklist();
</span><del>-    
-    bool completeAllForVM(VM&); // Return true if any JIT work happened.
-    void poll(VM&);
-    
-    void compileLater(CodeBlock*, BytecodeIndex loopOSREntryBytecodeIndex = BytecodeIndex(0));
-    
</del><ins>+
</ins><span class="cx">     static JITWorklist& ensureGlobalWorklist();
</span><span class="cx">     static JITWorklist* existingGlobalWorklistOrNull();
</span><del>-    
</del><ins>+
+    CompilationResult enqueue(Ref<JITPlan>);
+    size_t queueLength() const;
+
+    void suspendAllThreads();
+    void resumeAllThreads();
+
+    enum State { NotKnown, Compiling, Compiled };
+    State compilationState(JITCompilationKey);
+
+    State completeAllReadyPlansForVM(VM&, JITCompilationKey = JITCompilationKey());
+
+    void waitUntilAllPlansForVMAreReady(VM&);
+
+    // This is equivalent to:
+    // worklist->waitUntilAllPlansForVMAreReady(vm);
+    // worklist->completeAllReadyPlansForVM(vm);
+    void completeAllPlansForVM(VM&);
+
+    void cancelAllPlansForVM(VM&);
+
+    void removeDeadPlans(VM&);
+
+    unsigned setMaximumNumberOfConcurrentDFGCompilations(unsigned);
+    unsigned setMaximumNumberOfConcurrentFTLCompilations(unsigned);
+
+    // Only called on the main thread after suspending all threads.
+    template<typename Visitor>
+    void visitWeakReferences(Visitor&);
+
+    template<typename Visitor>
+    void iterateCodeBlocksForGC(Visitor&, VM&, const Function<void(CodeBlock*)>&);
+
+    void dump(PrintStream&) const;
+
</ins><span class="cx"> private:
</span><span class="cx">     JITWorklist();
</span><del>-    
-    class Thread;
-    friend class Thread;
-    
-    void finalizePlans(Plans&);
-    
-    Plans m_queue;
-    Plans m_plans;
-    HashSet<CodeBlock*> m_planned;
-    
</del><ins>+
+    size_t queueLength(const AbstractLocker&) const;
+
+    template<typename MatchFunction>
+    void removeMatchingPlansForVM(VM&, const MatchFunction&);
+
+    void removeAllReadyPlansForVM(VM&, Vector<RefPtr<JITPlan>, 8>&);
+
+    void dump(const AbstractLocker&, PrintStream&) const;
+
+    unsigned m_numberOfActiveThreads { 0 };
+    std::array<unsigned, static_cast<size_t>(JITPlan::Tier::Count)> m_ongoingCompilationsPerTier { 0, 0, 0 };
+    std::array<unsigned, static_cast<size_t>(JITPlan::Tier::Count)> m_maximumNumberOfConcurrentCompilationsPerTier;
+
+    Vector<RefPtr<JITWorklistThread>> m_threads;
+
+    // Used to inform the thread about what work there is left to do.
+    std::array<Deque<RefPtr<JITPlan>>, static_cast<size_t>(JITPlan::Tier::Count)> m_queues;
+
+    // Used to answer questions about the current state of a code block. This
+    // is particularly great for the cti_optimize OSR slow path, which wants
+    // to know: did I get here because a better version of me just got
+    // compiled?
+    HashMap<JITCompilationKey, RefPtr<JITPlan>> m_plans;
+
+    // Used to quickly find which plans have been compiled and are ready to
+    // be completed.
+    Vector<RefPtr<JITPlan>, 16> m_readyPlans;
+
+    UncheckedLock m_suspensionLock;
</ins><span class="cx">     Box<UncheckedLock> m_lock;
</span><del>-    Ref<AutomaticThreadCondition> m_condition; // We use One True Condition for everything because that's easier.
-    RefPtr<AutomaticThread> m_thread;
-    
-    unsigned m_numAvailableThreads { 0 };
</del><ins>+
+    Ref<AutomaticThreadCondition> m_planEnqueued;
+    UncheckedCondition m_planCompiled;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace JSC
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITWorklistInlineshfromrev278081trunkSourceJavaScriptCoredfgDFGScannableh"></a>
<div class="copfile"><h4>Copied: trunk/Source/JavaScriptCore/jit/JITWorklistInlines.h (from rev 278081, trunk/Source/JavaScriptCore/dfg/DFGScannable.h) (0 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITWorklistInlines.h                             (rev 0)
+++ trunk/Source/JavaScriptCore/jit/JITWorklistInlines.h        2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -0,0 +1,47 @@
</span><ins>+/*
+ * Copyright (C) 2017-2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#pragma once
+
+#include "JITWorklist.h"
+
+namespace JSC {
+
+#if ENABLE(JIT)
+
+template<typename Visitor>
+void JITWorklist::iterateCodeBlocksForGC(Visitor& visitor, VM& vm, const Function<void(CodeBlock*)>& func)
+{
+    Locker locker { *m_lock };
+    for (auto& entry : m_plans) {
+        if (entry.value->vm() != &vm)
+            continue;
+        entry.value->iterateCodeBlocksForGC(visitor, func);
+    }
+}
+
+#endif // ENABLE(JIT)
+
+} // namespace JSC
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITWorklistThreadcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/jit/JITWorklistThread.cpp (0 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITWorklistThread.cpp                            (rev 0)
+++ trunk/Source/JavaScriptCore/jit/JITWorklistThread.cpp       2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -0,0 +1,165 @@
</span><ins>+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JITWorklistThread.h"
+
+#if ENABLE(JIT)
+
+#include "JITWorklist.h"
+#include "VM.h"
+
+namespace JSC {
+
+class JITWorklistThread::WorkScope final {
+public:
+    WorkScope(JITWorklistThread& thread)
+        : m_thread(thread)
+        , m_tier(thread.m_plan->tier())
+    {
+        RELEASE_ASSERT(m_thread.m_plan);
+        RELEASE_ASSERT(m_thread.m_worklist.m_numberOfActiveThreads);
+    }
+
+    ~WorkScope()
+    {
+        Locker locker { *m_thread.m_worklist.m_lock };
+        m_thread.m_plan = nullptr;
+        m_thread.m_worklist.m_numberOfActiveThreads--;
+        m_thread.m_worklist.m_ongoingCompilationsPerTier[static_cast<unsigned>(m_tier)]--;
+    }
+
+private:
+    JITWorklistThread& m_thread;
+    JITPlan::Tier m_tier;
+};
+
+JITWorklistThread::JITWorklistThread(const AbstractLocker& locker, JITWorklist& worklist)
+    : AutomaticThread(locker, worklist.m_lock, worklist.m_planEnqueued.copyRef(), ThreadType::Compiler)
+    , m_worklist(worklist)
+{
+}
+const char* JITWorklistThread::name() const
+{
+#if OS(LINUX)
+    return "JITWorker";
+#else
+    return "JIT Worklist Helper Thread";
+#endif
+}
+
+auto JITWorklistThread::poll(const AbstractLocker& locker) -> PollResult
+{
+    for (unsigned i = 0; i < static_cast<unsigned>(JITPlan::Tier::Count); ++i) {
+        auto& queue = m_worklist.m_queues[i];
+        if (queue.isEmpty())
+            continue;
+
+
+        if (m_worklist.m_ongoingCompilationsPerTier[i] >= m_worklist.m_maximumNumberOfConcurrentCompilationsPerTier[i])
+            continue;
+
+        m_plan = queue.takeFirst();
+        if (UNLIKELY(!m_plan)) {
+            if (Options::verboseCompilationQueue()) {
+                m_worklist.dump(locker, WTF::dataFile());
+                dataLog(": Thread shutting down\n");
+            }
+            return PollResult::Stop;
+        }
+
+        RELEASE_ASSERT(m_plan->stage() == JITPlanStage::Preparing);
+        m_worklist.m_numberOfActiveThreads++;
+        m_worklist.m_ongoingCompilationsPerTier[i]++;
+        return PollResult::Work;
+    }
+
+    return PollResult::Wait;
+}
+
+auto JITWorklistThread::work() -> WorkResult
+{
+    WorkScope workScope(*this);
+
+    Locker locker { m_rightToRun };
+    {
+        Locker locker { *m_worklist.m_lock };
+        if (m_plan->stage() == JITPlanStage::Canceled)
+            return WorkResult::Continue;
+        m_plan->notifyCompiling();
+    }
+
+
+    dataLogLnIf(Options::verboseCompilationQueue(), m_worklist, ": Compiling ", m_plan->key(), " asynchronously");
+
+    // There's no way for the GC to be safepointing since we own rightToRun.
+    if (m_plan->vm()->heap.worldIsStopped()) {
+        dataLog("Heap is stopped but here we are! (1)\n");
+        RELEASE_ASSERT_NOT_REACHED();
+    }
+    m_plan->compileInThread(this);
+    if (m_plan->stage() != JITPlanStage::Canceled) {
+        if (m_plan->vm()->heap.worldIsStopped()) {
+            dataLog("Heap is stopped but here we are! (2)\n");
+            RELEASE_ASSERT_NOT_REACHED();
+        }
+    }
+
+    {
+        Locker locker { *m_worklist.m_lock };
+        if (m_plan->stage() == JITPlanStage::Canceled)
+            return WorkResult::Continue;
+
+        m_plan->notifyReady();
+
+        if (Options::verboseCompilationQueue()) {
+            m_worklist.dump(locker, WTF::dataFile());
+            dataLog(": Compiled ", m_plan->key(), " asynchronously\n");
+        }
+
+        RELEASE_ASSERT(!m_plan->vm()->heap.worldIsStopped());
+        m_worklist.m_readyPlans.append(WTFMove(m_plan));
+        m_worklist.m_planCompiled.notifyAll();
+    }
+
+    return WorkResult::Continue;
+}
+
+void JITWorklistThread::threadDidStart()
+{
+    dataLogLnIf(Options::verboseCompilationQueue(), m_worklist, ": Thread started");
+
+}
+
+void JITWorklistThread::threadIsStopping(const AbstractLocker&)
+{
+    dataLogLnIf(Options::verboseCompilationQueue(), m_worklist, ": Thread will stop");
+    ASSERT(!m_plan);
+    m_plan = nullptr;
+}
+
+} // namespace JSC
+
+#endif // ENABLE(JIT)
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITWorklistThreadhfromrev278081trunkSourceJavaScriptCoredfgDFGThreadDatah"></a>
<div class="copfile"><h4>Copied: trunk/Source/JavaScriptCore/jit/JITWorklistThread.h (from rev 278081, trunk/Source/JavaScriptCore/dfg/DFGThreadData.h) (0 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITWorklistThread.h                              (rev 0)
+++ trunk/Source/JavaScriptCore/jit/JITWorklistThread.h 2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -0,0 +1,66 @@
</span><ins>+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(JIT)
+
+#include "JITPlan.h"
+#include <wtf/AutomaticThread.h>
+
+namespace JSC {
+
+class JITWorklist;
+class Safepoint;
+
+class JITWorklistThread final : public AutomaticThread {
+    class WorkScope;
+
+    friend class Safepoint;
+    friend class WorkScope;
+    friend class JITWorklist;
+
+public:
+    JITWorklistThread(const AbstractLocker&, JITWorklist&);
+
+    const char* name() const final;
+
+private:
+    PollResult poll(const AbstractLocker&) final;
+    WorkResult work() final;
+
+    void threadDidStart() final;
+
+    void threadIsStopping(const AbstractLocker&) final;
+
+    UncheckedLock m_rightToRun;
+    JITWorklist& m_worklist;
+    RefPtr<JITPlan> m_plan { nullptr };
+    Safepoint* m_safepoint { nullptr };
+};
+
+} // namespace JSC
+
+#endif // ENABLE(JIT)
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCorellintLLIntSlowPathscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp     2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp        2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #include "LLIntSlowPaths.h"
</span><span class="cx"> 
</span><span class="cx"> #include "ArrayConstructor.h"
</span><ins>+#include "BaselineJITPlan.h"
</ins><span class="cx"> #include "BytecodeGenerator.h"
</span><span class="cx"> #include "BytecodeOperandsForCheckpoint.h"
</span><span class="cx"> #include "CallFrame.h"
</span><span class="lines">@@ -375,23 +376,21 @@
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    JITWorklist::ensureGlobalWorklist().poll(vm);
-    
-    switch (codeBlock->jitType()) {
-    case JITType::BaselineJIT: {
</del><ins>+    JITWorklist::State worklistState = JITWorklist::ensureGlobalWorklist().completeAllReadyPlansForVM(vm, JITCompilationKey(codeBlock, JITCompilationMode::Baseline));
+
+    if (codeBlock->jitType() == JITType::BaselineJIT || worklistState == JITWorklist::Compiled) {
</ins><span class="cx">         dataLogLnIf(Options::verboseOSR(), "    Code was already compiled.");
</span><span class="cx">         codeBlock->jitSoon();
</span><span class="cx">         return true;
</span><span class="cx">     }
</span><del>-    case JITType::InterpreterThunk: {
-        JITWorklist::ensureGlobalWorklist().compileLater(codeBlock, loopOSREntryBytecodeIndex);
</del><ins>+
+    if (worklistState == JITWorklist::NotKnown) {
+        Ref<BaselineJITPlan> plan = adoptRef(*new BaselineJITPlan(codeBlock, loopOSREntryBytecodeIndex));
+        JITWorklist::ensureGlobalWorklist().enqueue(WTFMove(plan));
</ins><span class="cx">         return codeBlock->jitType() == JITType::BaselineJIT;
</span><span class="cx">     }
</span><del>-    default:
-        dataLog("Unexpected code block in LLInt: ", *codeBlock, "\n");
-        RELEASE_ASSERT_NOT_REACHED();
-        return false;
-    }
</del><ins>+
+    return false;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static SlowPathReturnType entryOSR(CodeBlock* codeBlock, const char *name, EntryKind kind)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeOptionsListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/OptionsList.h (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/OptionsList.h        2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/runtime/OptionsList.h   2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -247,6 +247,7 @@
</span><span class="cx">     v(Unsigned, maxDFGNodesInBasicBlockForPreciseAnalysis, 20000, Normal, "Disable precise but costly analysis and give conservative results if the number of DFG nodes in a block exceeds this threshold") \
</span><span class="cx">     \
</span><span class="cx">     v(Bool, useConcurrentJIT, true, Normal, "allows the DFG / FTL compilation in threads other than the executing JS thread") \
</span><ins>+    v(Unsigned, numberOfWorklistThreads, computeNumberOfWorkerThreads(3, 2), Normal, nullptr) \
</ins><span class="cx">     v(Unsigned, numberOfDFGCompilerThreads, computeNumberOfWorkerThreads(3, 2) - 1, Normal, nullptr) \
</span><span class="cx">     v(Unsigned, numberOfFTLCompilerThreads, computeNumberOfWorkerThreads(MAXIMUM_NUMBER_OF_FTL_COMPILER_THREADS, 2) - 1, Normal, nullptr) \
</span><span class="cx">     v(Int32, priorityDeltaOfDFGCompilerThreads, computePriorityDeltaOfWorkerThreads(-1, 0), Normal, nullptr) \
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeVMcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/VM.cpp (278081 => 278082)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/VM.cpp       2021-05-26 14:23:15 UTC (rev 278081)
+++ trunk/Source/JavaScriptCore/runtime/VM.cpp  2021-05-26 15:15:22 UTC (rev 278082)
</span><span class="lines">@@ -43,7 +43,6 @@
</span><span class="cx"> #include "CommonIdentifiers.h"
</span><span class="cx"> #include "ControlFlowProfiler.h"
</span><span class="cx"> #include "CustomGetterSetter.h"
</span><del>-#include "DFGWorklist.h"
</del><span class="cx"> #include "DOMAttributeGetterSetter.h"
</span><span class="cx"> #include "DateInstance.h"
</span><span class="cx"> #include "DebuggerScope.h"
</span><span class="lines">@@ -613,20 +612,8 @@
</span><span class="cx">     
</span><span class="cx"> #if ENABLE(JIT)
</span><span class="cx">     if (JITWorklist* worklist = JITWorklist::existingGlobalWorklistOrNull())
</span><del>-        worklist->completeAllForVM(*this);
</del><ins>+        worklist->cancelAllPlansForVM(*this);
</ins><span class="cx"> #endif // ENABLE(JIT)
</span><del>-
-#if ENABLE(DFG_JIT)
-    // Make sure concurrent compilations are done, but don't install them, since there is
-    // no point to doing so.
-    for (unsigned i = DFG::numberOfWorklists(); i--;) {
-        if (DFG::Worklist* worklist = DFG::existingWorklistForIndexOrNull(i)) {
-            worklist->removeNonCompilingPlansForVM(*this);
-            worklist->waitUntilAllPlansForVMAreReady(*this);
-            worklist->removeAllReadyPlansForVM(*this);
-        }
-    }
-#endif // ENABLE(DFG_JIT)
</del><span class="cx">     
</span><span class="cx">     waitForAsynchronousDisassembly();
</span><span class="cx">     
</span></span></pre>
</div>
</div>

</body>
</html>