<!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>[192912] 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/192912">192912</a></dd>
<dt>Author</dt> <dd>fpizlo@apple.com</dd>
<dt>Date</dt> <dd>2015-12-01 14:12:42 -0800 (Tue, 01 Dec 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Remove repetitive cruft from FTL OSR exit code in LowerDFGToLLVM
https://bugs.webkit.org/show_bug.cgi?id=151718

Reviewed by Geoffrey Garen.

* b3/B3StackmapValue.h:
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::DFG::LowerDFGToLLVM::compileInvalidationPoint):
(JSC::FTL::DFG::LowerDFGToLLVM::appendOSRExitArgumentsForPatchpointIfWillCatchException):
(JSC::FTL::DFG::LowerDFGToLLVM::lowBlock):
(JSC::FTL::DFG::LowerDFGToLLVM::appendOSRExitDescriptor):
(JSC::FTL::DFG::LowerDFGToLLVM::appendOSRExit):
(JSC::FTL::DFG::LowerDFGToLLVM::blessSpeculation):
(JSC::FTL::DFG::LowerDFGToLLVM::emitOSRExitCall):
(JSC::FTL::DFG::LowerDFGToLLVM::buildExitArguments):
(JSC::FTL::DFG::LowerDFGToLLVM::callStackmap):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3StackmapValueh">trunk/Source/JavaScriptCore/b3/B3StackmapValue.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLLowerDFGToLLVMcpp">trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (192911 => 192912)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-12-01 22:09:49 UTC (rev 192911)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-12-01 22:12:42 UTC (rev 192912)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2015-12-01  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
+        Remove repetitive cruft from FTL OSR exit code in LowerDFGToLLVM
+        https://bugs.webkit.org/show_bug.cgi?id=151718
+
+        Reviewed by Geoffrey Garen.
+
+        * b3/B3StackmapValue.h:
+        * ftl/FTLLowerDFGToLLVM.cpp:
+        (JSC::FTL::DFG::LowerDFGToLLVM::compileInvalidationPoint):
+        (JSC::FTL::DFG::LowerDFGToLLVM::appendOSRExitArgumentsForPatchpointIfWillCatchException):
+        (JSC::FTL::DFG::LowerDFGToLLVM::lowBlock):
+        (JSC::FTL::DFG::LowerDFGToLLVM::appendOSRExitDescriptor):
+        (JSC::FTL::DFG::LowerDFGToLLVM::appendOSRExit):
+        (JSC::FTL::DFG::LowerDFGToLLVM::blessSpeculation):
+        (JSC::FTL::DFG::LowerDFGToLLVM::emitOSRExitCall):
+        (JSC::FTL::DFG::LowerDFGToLLVM::buildExitArguments):
+        (JSC::FTL::DFG::LowerDFGToLLVM::callStackmap):
+
</ins><span class="cx"> 2015-12-01  Caitlin Potter  &lt;caitp@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [JSC] add missing RequireObjectCoercible() step in destructuring
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3StackmapValueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/B3StackmapValue.h (192911 => 192912)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3StackmapValue.h        2015-12-01 22:09:49 UTC (rev 192911)
+++ trunk/Source/JavaScriptCore/b3/B3StackmapValue.h        2015-12-01 22:12:42 UTC (rev 192912)
</span><span class="lines">@@ -84,6 +84,13 @@
</span><span class="cx">     // children().append(). That will work fine, but it's not recommended.
</span><span class="cx">     void append(const ConstrainedValue&amp;);
</span><span class="cx"> 
</span><ins>+    template&lt;typename VectorType&gt;
+    void appendAnys(const VectorType&amp; vector)
+    {
+        for (Value* value : vector)
+            append(value);
+    }
+
</ins><span class="cx">     // This is a helper for something you might do a lot of: append a value that should be constrained
</span><span class="cx">     // to SomeRegister.
</span><span class="cx">     void appendSomeRegister(Value*);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLLowerDFGToLLVMcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp (192911 => 192912)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp        2015-12-01 22:09:49 UTC (rev 192911)
+++ trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp        2015-12-01 22:12:42 UTC (rev 192912)
</span><span class="lines">@@ -5283,8 +5283,7 @@
</span><span class="cx">         
</span><span class="cx">         OSRExitDescriptor&amp; exitDescriptor = m_ftlState.jitCode-&gt;osrExitDescriptors.last();
</span><span class="cx">         
</span><del>-        StackmapArgumentList arguments =
-            buildExitArguments(exitDescriptor, FormattedValue(), exitDescriptor.m_codeOrigin);
</del><ins>+        StackmapArgumentList arguments = buildExitArguments(exitDescriptor, FormattedValue());
</ins><span class="cx">         callStackmap(exitDescriptor, arguments);
</span><span class="cx">         
</span><span class="cx">         exitDescriptor.m_isInvalidationPoint = true;
</span><span class="lines">@@ -9180,7 +9179,7 @@
</span><span class="cx">         exitDescriptor.m_stackmapID = m_stackmapIDs - 1;
</span><span class="cx"> 
</span><span class="cx">         StackmapArgumentList freshList =
</span><del>-            buildExitArguments(exitDescriptor, noValue(), exitDescriptor.m_codeOrigin, offsetOfExitArguments);
</del><ins>+            buildExitArguments(exitDescriptor, noValue(), offsetOfExitArguments);
</ins><span class="cx">         arguments.appendVector(freshList);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -9201,13 +9200,13 @@
</span><span class="cx">         return m_blocks.get(block);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    void appendOSRExitDescriptor(ExitKind kind, ExceptionType exceptionType, FormattedValue lowValue, Node* highValue, NodeOrigin origin)
</del><ins>+    OSRExitDescriptor&amp; appendOSRExitDescriptor(ExitKind kind, ExceptionType exceptionType, FormattedValue lowValue, Node* highValue, NodeOrigin origin)
</ins><span class="cx">     {
</span><del>-        m_ftlState.jitCode-&gt;osrExitDescriptors.append(OSRExitDescriptor(
</del><ins>+        return m_ftlState.jitCode-&gt;osrExitDescriptors.alloc(
</ins><span class="cx">             kind, exceptionType, lowValue.format(), m_graph.methodOfGettingAValueProfileFor(highValue),
</span><span class="cx">             origin.forExit, origin.semantic,
</span><span class="cx">             availabilityMap().m_locals.numberOfArguments(),
</span><del>-            availabilityMap().m_locals.numberOfLocals()));
</del><ins>+            availabilityMap().m_locals.numberOfLocals());
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     void appendOSRExit(
</span><span class="lines">@@ -9248,8 +9247,7 @@
</span><span class="cx">         blessSpeculation(
</span><span class="cx">             m_out.speculate(failCondition), kind, lowValue, highValue, origin, isExceptionHandler);
</span><span class="cx"> #else // FTL_USES_B3
</span><del>-        appendOSRExitDescriptor(kind, isExceptionHandler ? ExceptionType::CCallException : ExceptionType::None, lowValue, highValue, origin);
-        OSRExitDescriptor&amp; exitDescriptor = m_ftlState.jitCode-&gt;osrExitDescriptors.last();
</del><ins>+        OSRExitDescriptor&amp; exitDescriptor = appendOSRExitDescriptor(kind, isExceptionHandler ? ExceptionType::CCallException : ExceptionType::None, lowValue, highValue, origin);
</ins><span class="cx"> 
</span><span class="cx">         if (failCondition == m_out.booleanTrue) {
</span><span class="cx">             emitOSRExitCall(exitDescriptor, lowValue);
</span><span class="lines">@@ -9277,12 +9275,8 @@
</span><span class="cx"> #if FTL_USES_B3
</span><span class="cx">     void blessSpeculation(B3::StackmapValue* value, ExitKind kind, FormattedValue lowValue, Node* highValue, NodeOrigin origin, bool isExceptionHandler = false)
</span><span class="cx">     {
</span><del>-        appendOSRExitDescriptor(kind, isExceptionHandler ? ExceptionType::CCallException : ExceptionType::None, lowValue, highValue, origin);
-        OSRExitDescriptor&amp; exitDescriptor = m_ftlState.jitCode-&gt;osrExitDescriptors.last();
-        CodeOrigin codeOrigin = exitDescriptor.m_codeOrigin;
-        StackmapArgumentList arguments = buildExitArguments(exitDescriptor, lowValue, codeOrigin);
-        for (LValue child : arguments)
-            value-&gt;append(child);
</del><ins>+        OSRExitDescriptor&amp; exitDescriptor = appendOSRExitDescriptor(kind, isExceptionHandler ? ExceptionType::CCallException : ExceptionType::None, lowValue, highValue, origin);
+        value-&gt;appendAnys(buildExitArguments(exitDescriptor, lowValue));
</ins><span class="cx">         value-&gt;setGenerator(
</span><span class="cx">             [&amp;] (CCallHelpers&amp; jit, const B3::StackmapGenerationParams&amp;) {
</span><span class="cx">                 jit.oops();
</span><span class="lines">@@ -9293,35 +9287,29 @@
</span><span class="cx"> #if !FTL_USES_B3
</span><span class="cx">     void emitOSRExitCall(OSRExitDescriptor&amp; exitDescriptor, FormattedValue lowValue)
</span><span class="cx">     {
</span><del>-        StackmapArgumentList arguments;
-        
-        CodeOrigin codeOrigin = exitDescriptor.m_codeOrigin;
-        
-        buildExitArguments(exitDescriptor, arguments, lowValue, codeOrigin);
-        
-        callStackmap(exitDescriptor, arguments);
</del><ins>+        callStackmap(exitDescriptor, buildExitArguments(exitDescriptor, lowValue));
</ins><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     StackmapArgumentList buildExitArguments(
</span><del>-        OSRExitDescriptor&amp; exitDescriptor, FormattedValue lowValue, CodeOrigin codeOrigin,
</del><ins>+        OSRExitDescriptor&amp; exitDescriptor, FormattedValue lowValue,
</ins><span class="cx">         unsigned offsetOfExitArgumentsInStackmapLocations = 0)
</span><span class="cx">     {
</span><span class="cx">         StackmapArgumentList result;
</span><span class="cx">         buildExitArguments(
</span><del>-            exitDescriptor, result, lowValue, codeOrigin, offsetOfExitArgumentsInStackmapLocations);
</del><ins>+            exitDescriptor, result, lowValue, offsetOfExitArgumentsInStackmapLocations);
</ins><span class="cx">         return result;
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     void buildExitArguments(
</span><span class="cx">         OSRExitDescriptor&amp; exitDescriptor, StackmapArgumentList&amp; arguments, FormattedValue lowValue,
</span><del>-        CodeOrigin codeOrigin, unsigned offsetOfExitArgumentsInStackmapLocations = 0)
</del><ins>+        unsigned offsetOfExitArgumentsInStackmapLocations = 0)
</ins><span class="cx">     {
</span><span class="cx">         if (!!lowValue)
</span><span class="cx">             arguments.append(lowValue.value());
</span><span class="cx">         
</span><span class="cx">         AvailabilityMap availabilityMap = this-&gt;availabilityMap();
</span><del>-        availabilityMap.pruneByLiveness(m_graph, codeOrigin);
</del><ins>+        availabilityMap.pruneByLiveness(m_graph, exitDescriptor.m_codeOrigin);
</ins><span class="cx">         
</span><span class="cx">         HashMap&lt;Node*, ExitTimeObjectMaterialization*&gt; map;
</span><span class="cx">         availabilityMap.forEachAvailability(
</span><span class="lines">@@ -9348,7 +9336,7 @@
</span><span class="cx">             if (Options::validateFTLOSRExitLiveness()) {
</span><span class="cx">                 DFG_ASSERT(
</span><span class="cx">                     m_graph, m_node,
</span><del>-                    (!(availability.isDead() &amp;&amp; m_graph.isLiveInBytecode(VirtualRegister(operand), codeOrigin))) || m_graph.m_plan.mode == FTLForOSREntryMode);
</del><ins>+                    (!(availability.isDead() &amp;&amp; m_graph.isLiveInBytecode(VirtualRegister(operand), exitDescriptor.m_codeOrigin))) || m_graph.m_plan.mode == FTLForOSREntryMode);
</ins><span class="cx">             }
</span><span class="cx">             ExitValue exitValue = exitValueForAvailability(arguments, map, availability);
</span><span class="cx">             if (exitValue.hasIndexInStackmapLocations())
</span><span class="lines">@@ -9378,7 +9366,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> #if !FTL_USES_B3
</span><del>-    void callStackmap(OSRExitDescriptor&amp; exitDescriptor, StackmapArgumentList&amp; arguments)
</del><ins>+    void callStackmap(OSRExitDescriptor&amp; exitDescriptor, StackmapArgumentList arguments)
</ins><span class="cx">     {
</span><span class="cx">         exitDescriptor.m_stackmapID = m_stackmapIDs++;
</span><span class="cx">         arguments.insert(0, m_out.constInt32(MacroAssembler::maxJumpReplacementSize()));
</span></span></pre>
</div>
</div>

</body>
</html>