<!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>[211704] branches/safari-603-branch/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/211704">211704</a></dd>
<dt>Author</dt> <dd>matthew_hanson@apple.com</dd>
<dt>Date</dt> <dd>2017-02-05 22:17:09 -0800 (Sun, 05 Feb 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/211658">r211658</a>. rdar://problem/29144126</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari603branchSourceJavaScriptCoreChangeLog">branches/safari-603-branch/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#branchessafari603branchSourceJavaScriptCoredfgDFGJITCodeh">branches/safari-603-branch/Source/JavaScriptCore/dfg/DFGJITCode.h</a></li>
<li><a href="#branchessafari603branchSourceJavaScriptCoredfgDFGJITCompilercpp">branches/safari-603-branch/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp</a></li>
<li><a href="#branchessafari603branchSourceJavaScriptCoredfgDFGOperationscpp">branches/safari-603-branch/Source/JavaScriptCore/dfg/DFGOperations.cpp</a></li>
<li><a href="#branchessafari603branchSourceJavaScriptCoredfgDFGSpeculativeJIT64cpp">branches/safari-603-branch/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp</a></li>
<li><a href="#branchessafari603branchSourceJavaScriptCoredfgDFGToFTLForOSREntryDeferredCompilationCallbackcpp">branches/safari-603-branch/Source/JavaScriptCore/dfg/DFGToFTLForOSREntryDeferredCompilationCallback.cpp</a></li>
<li><a href="#branchessafari603branchSourceJavaScriptCoredfgDFGToFTLForOSREntryDeferredCompilationCallbackh">branches/safari-603-branch/Source/JavaScriptCore/dfg/DFGToFTLForOSREntryDeferredCompilationCallback.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari603branchSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/JavaScriptCore/ChangeLog (211703 => 211704)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/JavaScriptCore/ChangeLog        2017-02-06 05:51:01 UTC (rev 211703)
+++ branches/safari-603-branch/Source/JavaScriptCore/ChangeLog        2017-02-06 06:17:09 UTC (rev 211704)
</span><span class="lines">@@ -1,3 +1,72 @@
</span><ins>+2017-02-05  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
+        Merge r211658. rdar://problem/29144126
+
+    2017-02-03  JF Bastien  &lt;jfbastien@apple.com&gt;
+
+            OSR entry: delay outer-loop compilation when at inner-loop
+            https://bugs.webkit.org/show_bug.cgi?id=167149
+
+            Reviewed by Filip Pizlo.
+
+            r211224 and r211461 were reverted because they caused massive
+            kraken/ai-astar regressions. This patch instead does the
+            minimally-disruptive change to fix the original bug as described
+            below, but omits extra tuning and refactoring which I had
+            before. I'll commit tuning and refactoring separately, if this
+            sticks. This patch is therefore very minimal, and layers carefully
+            on top of the complex spaghetti-logic. The only change it makes is
+            that it uses triggers to indicate to outer loops that they should
+            compile, which fixes the immediate bug and seems roughly perf
+            neutral (maybe a small gain on kraken sometimes, other times a
+            small regression as would be expected from slightly compiling
+            later). As opposed to r211461 this patch doesn't unconditionally
+            unset the trigger because it prevents further DFG executions from
+            entering. It therefore makes the trigger a tri-state enum class:
+            don't trigger, compilation done, start compilation. Only &quot;start
+            compilation&quot; gets reset to &quot;don't trigger&quot;. &quot;Compilation done&quot;
+            does not (unless there's a problem compiling, then it gets set
+            back to &quot;don't trigger&quot;).
+
+            As of https://bugs.webkit.org/show_bug.cgi?id=155217 OSR
+            compilation can be kicked off for an entry into an outer-loop,
+            while executing an inner-loop. This is desirable because often the
+            codegen from an inner-entry isn't as good as the codegen from an
+            outer-entry, but execution from an inner-loop is often pretty hot
+            and likely to kick off compilation. This approach provided nice
+            speedups on Kraken because we'd select to enter to the outer-loop
+            very reliably, which reduces variability (the inner-loop was
+            selected roughly 1/5 times from my unscientific measurements).
+
+            When compilation starts we take a snapshot of the JSValues at the
+            current execution state using OSR's recovery mechanism. These
+            values are passed to the compiler and are used as way to perform
+            type profiling, and could be used to observe cell types as well as
+            to perform predictions such as through constant propagation.
+
+            It's therefore desired to enter from the outer-loop when we can,
+            but we need to be executing from that location to capture the
+            right JSValues, otherwise we're confusing the compiler and giving
+            it inaccurate JSValues which can lead it to predict the wrong
+            things, leading to suboptimal code or recompilation due to
+            misprediction, or in super-corner-cases a crash.
+
+            DFG tier-up was added here:
+            https://bugs.webkit.org/show_bug.cgi?id=112838
+
+            * dfg/DFGJITCode.h:
+            * dfg/DFGJITCompiler.cpp:
+            (JSC::DFG::JITCompiler::JITCompiler):
+            * dfg/DFGOperations.cpp:
+            * dfg/DFGSpeculativeJIT64.cpp:
+            (JSC::DFG::SpeculativeJIT::compile):
+            * dfg/DFGToFTLForOSREntryDeferredCompilationCallback.cpp:
+            (JSC::DFG::ToFTLForOSREntryDeferredCompilationCallback::ToFTLForOSREntryDeferredCompilationCallback):
+            (JSC::DFG::Ref&lt;ToFTLForOSREntryDeferredCompilationCallback&gt;ToFTLForOSREntryDeferredCompilationCallback::create):
+            (JSC::DFG::ToFTLForOSREntryDeferredCompilationCallback::compilationDidBecomeReadyAsynchronously):
+            (JSC::DFG::ToFTLForOSREntryDeferredCompilationCallback::compilationDidComplete):
+            * dfg/DFGToFTLForOSREntryDeferredCompilationCallback.h:
+
</ins><span class="cx"> 2017-02-02  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge r211486. rdar://problem/30167791
</span></span></pre></div>
<a id="branchessafari603branchSourceJavaScriptCoredfgDFGJITCodeh"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/JavaScriptCore/dfg/DFGJITCode.h (211703 => 211704)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/JavaScriptCore/dfg/DFGJITCode.h        2017-02-06 05:51:01 UTC (rev 211703)
+++ branches/safari-603-branch/Source/JavaScriptCore/dfg/DFGJITCode.h        2017-02-06 06:17:09 UTC (rev 211704)
</span><span class="lines">@@ -151,10 +151,16 @@
</span><span class="cx">     // Map each bytecode of CheckTierUpAndOSREnter to its stream index.
</span><span class="cx">     HashMap&lt;unsigned, unsigned, WTF::IntHash&lt;unsigned&gt;, WTF::UnsignedWithZeroKeyHashTraits&lt;unsigned&gt;&gt; bytecodeIndexToStreamIndex;
</span><span class="cx"> 
</span><ins>+    enum class TriggerReason : uint8_t {
+        DontTrigger,
+        CompilationDone,
+        StartCompilation,
+    };
+
</ins><span class="cx">     // Map each bytecode of CheckTierUpAndOSREnter to its trigger forcing OSR Entry.
</span><span class="cx">     // This can never be modified after it has been initialized since the addresses of the triggers
</span><span class="cx">     // are used by the JIT.
</span><del>-    HashMap&lt;unsigned, uint8_t&gt; tierUpEntryTriggers;
</del><ins>+    HashMap&lt;unsigned, TriggerReason&gt; tierUpEntryTriggers;
</ins><span class="cx"> 
</span><span class="cx">     // Set of bytecode that were the target of a TierUp operation.
</span><span class="cx">     HashSet&lt;unsigned, WTF::IntHash&lt;unsigned&gt;, WTF::UnsignedWithZeroKeyHashTraits&lt;unsigned&gt;&gt; tierUpEntrySeen;
</span></span></pre></div>
<a id="branchessafari603branchSourceJavaScriptCoredfgDFGJITCompilercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp (211703 => 211704)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp        2017-02-06 05:51:01 UTC (rev 211703)
+++ branches/safari-603-branch/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp        2017-02-06 06:17:09 UTC (rev 211704)
</span><span class="lines">@@ -60,7 +60,7 @@
</span><span class="cx"> #if ENABLE(FTL_JIT)
</span><span class="cx">     m_jitCode-&gt;tierUpInLoopHierarchy = WTFMove(m_graph.m_plan.tierUpInLoopHierarchy);
</span><span class="cx">     for (unsigned tierUpBytecode : m_graph.m_plan.tierUpAndOSREnterBytecodes)
</span><del>-        m_jitCode-&gt;tierUpEntryTriggers.add(tierUpBytecode, 0);
</del><ins>+        m_jitCode-&gt;tierUpEntryTriggers.add(tierUpBytecode, JITCode::TriggerReason::DontTrigger);
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari603branchSourceJavaScriptCoredfgDFGOperationscpp"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/JavaScriptCore/dfg/DFGOperations.cpp (211703 => 211704)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/JavaScriptCore/dfg/DFGOperations.cpp        2017-02-06 05:51:01 UTC (rev 211703)
+++ branches/safari-603-branch/Source/JavaScriptCore/dfg/DFGOperations.cpp        2017-02-06 06:17:09 UTC (rev 211704)
</span><span class="lines">@@ -2351,6 +2351,37 @@
</span><span class="cx">         worklistState = Worklist::NotKnown;
</span><span class="cx"> 
</span><span class="cx">     JITCode* jitCode = codeBlock-&gt;jitCode()-&gt;dfg();
</span><ins>+
+    // The following is only true for triggerTierUpNowInLoop, which can never
+    // be an OSR entry.
+    bool canOSRFromHere = originBytecodeIndex == osrEntryBytecodeIndex;
+
+    bool triggeredSlowPathToStartCompilation = false;
+    auto tierUpEntryTriggers = jitCode-&gt;tierUpEntryTriggers.find(originBytecodeIndex);
+    if (tierUpEntryTriggers != jitCode-&gt;tierUpEntryTriggers.end()) {
+        switch (tierUpEntryTriggers-&gt;value) {
+        case JITCode::TriggerReason::DontTrigger:
+            // The trigger isn't set, we entered because the counter reached its
+            // threshold.
+            break;
+
+        case JITCode::TriggerReason::CompilationDone:
+            // The trigger was set because compilation completed. Don't unset it
+            // so that further DFG executions OSR enters as well.
+            RELEASE_ASSERT(canOSRFromHere);
+            break;
+
+        case JITCode::TriggerReason::StartCompilation:
+            // We were asked to enter as soon as possible and start compiling an
+            // entry for the current bytecode location. Unset this trigger so we
+            // don't continually enter.
+            RELEASE_ASSERT(canOSRFromHere);
+            tierUpEntryTriggers-&gt;value = JITCode::TriggerReason::DontTrigger;
+            triggeredSlowPathToStartCompilation = true;
+            break;
+        }
+    }
+
</ins><span class="cx">     if (worklistState == Worklist::Compiling) {
</span><span class="cx">         CODEBLOCK_LOG_EVENT(codeBlock, &quot;delayFTLCompile&quot;, (&quot;still compiling&quot;));
</span><span class="cx">         jitCode-&gt;setOptimizationThresholdBasedOnCompilationResult(
</span><span class="lines">@@ -2367,7 +2398,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // If we can OSR Enter, do it right away.
</span><del>-    if (originBytecodeIndex == osrEntryBytecodeIndex) {
</del><ins>+    if (canOSRFromHere) {
</ins><span class="cx">         unsigned streamIndex = jitCode-&gt;bytecodeIndexToStreamIndex.get(originBytecodeIndex);
</span><span class="cx">         if (CodeBlock* entryBlock = jitCode-&gt;osrEntryBlock()) {
</span><span class="cx">             if (void* address = FTL::prepareOSREntry(exec, codeBlock, entryBlock, originBytecodeIndex, streamIndex)) {
</span><span class="lines">@@ -2381,10 +2412,10 @@
</span><span class="cx">     // - If we do have an FTL code block, then try to enter for a while.
</span><span class="cx">     // - If we couldn't enter for a while, then trigger OSR entry.
</span><span class="cx"> 
</span><del>-    if (!shouldTriggerFTLCompile(codeBlock, jitCode))
</del><ins>+    if (!shouldTriggerFTLCompile(codeBlock, jitCode) &amp;&amp; !triggeredSlowPathToStartCompilation)
</ins><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><del>-    if (!jitCode-&gt;neverExecutedEntry) {
</del><ins>+    if (!jitCode-&gt;neverExecutedEntry &amp;&amp; !triggeredSlowPathToStartCompilation) {
</ins><span class="cx">         triggerFTLReplacementCompile(vm, codeBlock, jitCode);
</span><span class="cx"> 
</span><span class="cx">         if (!codeBlock-&gt;hasOptimizedReplacement())
</span><span class="lines">@@ -2424,19 +2455,36 @@
</span><span class="cx">         unsigned osrEntryBytecode = entryBlock-&gt;jitCode()-&gt;ftlForOSREntry()-&gt;bytecodeIndex();
</span><span class="cx">         jitCode-&gt;clearOSREntryBlock();
</span><span class="cx">         jitCode-&gt;osrEntryRetry = 0;
</span><del>-        jitCode-&gt;tierUpEntryTriggers.set(osrEntryBytecode, 0);
</del><ins>+        jitCode-&gt;tierUpEntryTriggers.set(osrEntryBytecode, JITCode::TriggerReason::DontTrigger);
</ins><span class="cx">         jitCode-&gt;setOptimizationThresholdBasedOnCompilationResult(
</span><span class="cx">             codeBlock, CompilationDeferred);
</span><span class="cx">         return nullptr;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    if (!canOSRFromHere) {
+        // We can't OSR from here, or even start a compilation because doing so
+        // calls jitCode-&gt;reconstruct which would get the wrong state.
+        if (Options::verboseOSR())
+            dataLog(&quot;Non-OSR-able bc#&quot;, originBytecodeIndex, &quot; in &quot;, *codeBlock, &quot; setting parent loop bc#&quot;, osrEntryBytecodeIndex, &quot;'s trigger and backing off.\n&quot;);
+        jitCode-&gt;tierUpEntryTriggers.set(osrEntryBytecodeIndex, JITCode::TriggerReason::StartCompilation);
+        jitCode-&gt;setOptimizationThresholdBasedOnCompilationResult(codeBlock, CompilationDeferred);
+        return nullptr;
+    }
+
</ins><span class="cx">     unsigned streamIndex = jitCode-&gt;bytecodeIndexToStreamIndex.get(osrEntryBytecodeIndex);
</span><del>-    auto tierUpHierarchyEntry = jitCode-&gt;tierUpInLoopHierarchy.find(osrEntryBytecodeIndex);
-    if (tierUpHierarchyEntry != jitCode-&gt;tierUpInLoopHierarchy.end()) {
-        for (unsigned osrEntryCandidate : tierUpHierarchyEntry-&gt;value) {
-            if (jitCode-&gt;tierUpEntrySeen.contains(osrEntryCandidate)) {
-                osrEntryBytecodeIndex = osrEntryCandidate;
-                streamIndex = jitCode-&gt;bytecodeIndexToStreamIndex.get(osrEntryBytecodeIndex);
</del><ins>+
+    if (!triggeredSlowPathToStartCompilation) {
+        auto tierUpHierarchyEntry = jitCode-&gt;tierUpInLoopHierarchy.find(osrEntryBytecodeIndex);
+        if (tierUpHierarchyEntry != jitCode-&gt;tierUpInLoopHierarchy.end()) {
+            for (unsigned osrEntryCandidate : tierUpHierarchyEntry-&gt;value) {
+                if (jitCode-&gt;tierUpEntrySeen.contains(osrEntryCandidate)) {
+                    // Ask an enclosing loop to compile, instead of doing so here.
+                    if (Options::verboseOSR())
+                        dataLog(&quot;Inner-loop bc#&quot;, originBytecodeIndex, &quot; in &quot;, *codeBlock, &quot; setting parent loop bc#&quot;, osrEntryCandidate, &quot;'s trigger and backing off.\n&quot;);
+                    jitCode-&gt;tierUpEntryTriggers.set(osrEntryCandidate, JITCode::TriggerReason::StartCompilation);
+                    jitCode-&gt;setOptimizationThresholdBasedOnCompilationResult(codeBlock, CompilationDeferred);
+                    return nullptr;
+                }
</ins><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -2445,7 +2493,7 @@
</span><span class="cx">     // something.
</span><span class="cx">     auto triggerIterator = jitCode-&gt;tierUpEntryTriggers.find(osrEntryBytecodeIndex);
</span><span class="cx">     RELEASE_ASSERT(triggerIterator != jitCode-&gt;tierUpEntryTriggers.end());
</span><del>-    uint8_t* triggerAddress = &amp;(triggerIterator-&gt;value);
</del><ins>+    JITCode::TriggerReason* triggerAddress = &amp;(triggerIterator-&gt;value);
</ins><span class="cx"> 
</span><span class="cx">     Operands&lt;JSValue&gt; mustHandleValues;
</span><span class="cx">     jitCode-&gt;reconstruct(
</span></span></pre></div>
<a id="branchessafari603branchSourceJavaScriptCoredfgDFGSpeculativeJIT64cpp"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp (211703 => 211704)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp        2017-02-06 05:51:01 UTC (rev 211703)
+++ branches/safari-603-branch/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp        2017-02-06 06:17:09 UTC (rev 211704)
</span><span class="lines">@@ -5781,7 +5781,9 @@
</span><span class="cx">         unsigned bytecodeIndex = node-&gt;origin.semantic.bytecodeIndex;
</span><span class="cx">         auto triggerIterator = m_jit.jitCode()-&gt;tierUpEntryTriggers.find(bytecodeIndex);
</span><span class="cx">         DFG_ASSERT(m_jit.graph(), node, triggerIterator != m_jit.jitCode()-&gt;tierUpEntryTriggers.end());
</span><del>-        uint8_t* forceEntryTrigger = &amp;(m_jit.jitCode()-&gt;tierUpEntryTriggers.find(bytecodeIndex)-&gt;value);
</del><ins>+        JITCode::TriggerReason* forceEntryTrigger = &amp;(m_jit.jitCode()-&gt;tierUpEntryTriggers.find(bytecodeIndex)-&gt;value);
+        static_assert(!static_cast&lt;uint8_t&gt;(JITCode::TriggerReason::DontTrigger), &quot;the JIT code assumes non-zero means 'enter'&quot;);
+        static_assert(sizeof(JITCode::TriggerReason) == 1, &quot;branchTest8 assumes this size&quot;);
</ins><span class="cx"> 
</span><span class="cx">         MacroAssembler::Jump forceOSREntry = m_jit.branchTest8(MacroAssembler::NonZero, MacroAssembler::AbsoluteAddress(forceEntryTrigger));
</span><span class="cx">         MacroAssembler::Jump overflowedCounter = m_jit.branchAdd32(
</span></span></pre></div>
<a id="branchessafari603branchSourceJavaScriptCoredfgDFGToFTLForOSREntryDeferredCompilationCallbackcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/JavaScriptCore/dfg/DFGToFTLForOSREntryDeferredCompilationCallback.cpp (211703 => 211704)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/JavaScriptCore/dfg/DFGToFTLForOSREntryDeferredCompilationCallback.cpp        2017-02-06 05:51:01 UTC (rev 211703)
+++ branches/safari-603-branch/Source/JavaScriptCore/dfg/DFGToFTLForOSREntryDeferredCompilationCallback.cpp        2017-02-06 06:17:09 UTC (rev 211704)
</span><span class="lines">@@ -35,7 +35,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace JSC { namespace DFG {
</span><span class="cx"> 
</span><del>-ToFTLForOSREntryDeferredCompilationCallback::ToFTLForOSREntryDeferredCompilationCallback(uint8_t* forcedOSREntryTrigger)
</del><ins>+ToFTLForOSREntryDeferredCompilationCallback::ToFTLForOSREntryDeferredCompilationCallback(JITCode::TriggerReason* forcedOSREntryTrigger)
</ins><span class="cx">     : m_forcedOSREntryTrigger(forcedOSREntryTrigger)
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Ref&lt;ToFTLForOSREntryDeferredCompilationCallback&gt;ToFTLForOSREntryDeferredCompilationCallback::create(uint8_t* forcedOSREntryTrigger)
</del><ins>+Ref&lt;ToFTLForOSREntryDeferredCompilationCallback&gt;ToFTLForOSREntryDeferredCompilationCallback::create(JITCode::TriggerReason* forcedOSREntryTrigger)
</ins><span class="cx"> {
</span><span class="cx">     return adoptRef(*new ToFTLForOSREntryDeferredCompilationCallback(forcedOSREntryTrigger));
</span><span class="cx"> }
</span><span class="lines">@@ -58,7 +58,7 @@
</span><span class="cx">             &quot;) did become ready.\n&quot;);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    *m_forcedOSREntryTrigger = 1;
</del><ins>+    *m_forcedOSREntryTrigger = JITCode::TriggerReason::CompilationDone;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ToFTLForOSREntryDeferredCompilationCallback::compilationDidComplete(
</span><span class="lines">@@ -76,7 +76,7 @@
</span><span class="cx">     case CompilationSuccessful: {
</span><span class="cx">         jitCode-&gt;setOSREntryBlock(*codeBlock-&gt;vm(), profiledDFGCodeBlock, codeBlock);
</span><span class="cx">         unsigned osrEntryBytecode = codeBlock-&gt;jitCode()-&gt;ftlForOSREntry()-&gt;bytecodeIndex();
</span><del>-        jitCode-&gt;tierUpEntryTriggers.set(osrEntryBytecode, 1);
</del><ins>+        jitCode-&gt;tierUpEntryTriggers.set(osrEntryBytecode, JITCode::TriggerReason::CompilationDone);
</ins><span class="cx">         break;
</span><span class="cx">     }
</span><span class="cx">     case CompilationFailed:
</span></span></pre></div>
<a id="branchessafari603branchSourceJavaScriptCoredfgDFGToFTLForOSREntryDeferredCompilationCallbackh"></a>
<div class="modfile"><h4>Modified: branches/safari-603-branch/Source/JavaScriptCore/dfg/DFGToFTLForOSREntryDeferredCompilationCallback.h (211703 => 211704)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-603-branch/Source/JavaScriptCore/dfg/DFGToFTLForOSREntryDeferredCompilationCallback.h        2017-02-06 05:51:01 UTC (rev 211703)
+++ branches/safari-603-branch/Source/JavaScriptCore/dfg/DFGToFTLForOSREntryDeferredCompilationCallback.h        2017-02-06 06:17:09 UTC (rev 211704)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(FTL_JIT)
</span><span class="cx"> 
</span><ins>+#include &quot;DFGJITCode.h&quot;
</ins><span class="cx"> #include &quot;DeferredCompilationCallback.h&quot;
</span><span class="cx"> #include &lt;wtf/RefPtr.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -38,18 +39,18 @@
</span><span class="cx"> 
</span><span class="cx"> class ToFTLForOSREntryDeferredCompilationCallback : public DeferredCompilationCallback {
</span><span class="cx"> protected:
</span><del>-    ToFTLForOSREntryDeferredCompilationCallback(uint8_t* forcedOSREntryTrigger);
</del><ins>+    ToFTLForOSREntryDeferredCompilationCallback(JITCode::TriggerReason* forcedOSREntryTrigger);
</ins><span class="cx"> 
</span><span class="cx"> public:
</span><span class="cx">     virtual ~ToFTLForOSREntryDeferredCompilationCallback();
</span><span class="cx"> 
</span><del>-    static Ref&lt;ToFTLForOSREntryDeferredCompilationCallback&gt; create(uint8_t* forcedOSREntryTrigger);
</del><ins>+    static Ref&lt;ToFTLForOSREntryDeferredCompilationCallback&gt; create(JITCode::TriggerReason* forcedOSREntryTrigger);
</ins><span class="cx">     
</span><span class="cx">     virtual void compilationDidBecomeReadyAsynchronously(CodeBlock*, CodeBlock* profiledDFGCodeBlock);
</span><span class="cx">     virtual void compilationDidComplete(CodeBlock*, CodeBlock* profiledDFGCodeBlock, CompilationResult);
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    uint8_t* m_forcedOSREntryTrigger;
</del><ins>+    JITCode::TriggerReason* m_forcedOSREntryTrigger;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } } // namespace JSC::DFG
</span></span></pre>
</div>
</div>

</body>
</html>