<!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>[214883] trunk/Source</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/214883">214883</a></dd>
<dt>Author</dt> <dd>fpizlo@apple.com</dd>
<dt>Date</dt> <dd>2017-04-04 10:20:43 -0700 (Tue, 04 Apr 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Air liveness should build constraints and solve them rather than repeatedly parsing IR
https://bugs.webkit.org/show_bug.cgi?id=170421

Reviewed by Saam Barati.
Source/JavaScriptCore:

        
Inst::forEach&lt;&gt; is expensive. The LivenessAdapter uses forEach with a particularly
gnarly lambda that has many extra checks. Therefore, a lot of the time spent in
liveness analysis is just recomputing forEach&lt;&gt; and that lambda to get uses and defs.
        
This introduces LivenessConstraints&lt;&gt;, which is a liveness constraint system based on
Adapter. It basically caches the results of doing forEach. It'll give you the uses and
defs at each instruction boundary.
        
This is a ~5% compile time progression at optLevel=1. It's also a ~3% compile time
progression at optLevel=2.
        
* JavaScriptCore.xcodeproj/project.pbxproj:
* b3/air/AirLivenessAdapter.h:
(JSC::B3::Air::LivenessAdapter::LivenessAdapter):
(JSC::B3::Air::LivenessAdapter::forEachUse):
(JSC::B3::Air::LivenessAdapter::forEachDef):
* b3/air/AirLivenessConstraints.h: Added.
(JSC::B3::Air::LivenessConstraints::Actions::Actions):
(JSC::B3::Air::LivenessConstraints::LivenessConstraints):
(JSC::B3::Air::LivenessConstraints::at):

Source/WTF:


* wtf/Vector.h:
(WTF::minCapacity&gt;::appendIfNotContains): Because sometimes Vector&lt;&gt; is the best kind of set.</pre>

<h3>Modified Paths</h3>
<ul>
<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="#trunkSourceJavaScriptCoreb3airAirLivenessAdapterh">trunk/Source/JavaScriptCore/b3/air/AirLivenessAdapter.h</a></li>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfVectorh">trunk/Source/WTF/wtf/Vector.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreb3airAirLivenessConstraintsh">trunk/Source/JavaScriptCore/b3/air/AirLivenessConstraints.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (214882 => 214883)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2017-04-04 16:12:17 UTC (rev 214882)
+++ trunk/Source/JavaScriptCore/ChangeLog        2017-04-04 17:20:43 UTC (rev 214883)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2017-04-03  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
+        Air liveness should build constraints and solve them rather than repeatedly parsing IR
+        https://bugs.webkit.org/show_bug.cgi?id=170421
+
+        Reviewed by Saam Barati.
+        
+        Inst::forEach&lt;&gt; is expensive. The LivenessAdapter uses forEach with a particularly
+        gnarly lambda that has many extra checks. Therefore, a lot of the time spent in
+        liveness analysis is just recomputing forEach&lt;&gt; and that lambda to get uses and defs.
+        
+        This introduces LivenessConstraints&lt;&gt;, which is a liveness constraint system based on
+        Adapter. It basically caches the results of doing forEach. It'll give you the uses and
+        defs at each instruction boundary.
+        
+        This is a ~5% compile time progression at optLevel=1. It's also a ~3% compile time
+        progression at optLevel=2.
+        
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        * b3/air/AirLivenessAdapter.h:
+        (JSC::B3::Air::LivenessAdapter::LivenessAdapter):
+        (JSC::B3::Air::LivenessAdapter::forEachUse):
+        (JSC::B3::Air::LivenessAdapter::forEachDef):
+        * b3/air/AirLivenessConstraints.h: Added.
+        (JSC::B3::Air::LivenessConstraints::Actions::Actions):
+        (JSC::B3::Air::LivenessConstraints::LivenessConstraints):
+        (JSC::B3::Air::LivenessConstraints::at):
+
</ins><span class="cx"> 2017-04-03  Mark Lam  &lt;mark.lam@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix incorrect capacity delta calculation reported in SparseArrayValueMap::add().
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (214882 => 214883)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2017-04-04 16:12:17 UTC (rev 214882)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2017-04-04 17:20:43 UTC (rev 214883)
</span><span class="lines">@@ -119,6 +119,7 @@
</span><span class="cx">                 0F15F15F14B7A73E005DE37D /* CommonSlowPaths.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F15F15D14B7A73A005DE37D /* CommonSlowPaths.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 0F1725FF1B48719A00AC3A55 /* DFGMinifiedGraph.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F1725FE1B48719A00AC3A55 /* DFGMinifiedGraph.cpp */; };
</span><span class="cx">                 0F1829691E92EE54005B1EA8 /* AirLivenessAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F1829681E92EE51005B1EA8 /* AirLivenessAdapter.h */; };
</span><ins>+                0F18296B1E92F6DC005B1EA8 /* AirLivenessConstraints.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F18296A1E92F6DA005B1EA8 /* AirLivenessConstraints.h */; };
</ins><span class="cx">                 0F18D3CF1B55A6E0002C5C9F /* DFGAdaptiveStructureWatchpoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F18D3CD1B55A6E0002C5C9F /* DFGAdaptiveStructureWatchpoint.cpp */; };
</span><span class="cx">                 0F18D3D01B55A6E0002C5C9F /* DFGAdaptiveStructureWatchpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F18D3CE1B55A6E0002C5C9F /* DFGAdaptiveStructureWatchpoint.h */; };
</span><span class="cx">                 0F190CAC189D82F6000AE5F0 /* ProfilerJettisonReason.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F190CAA189D82F6000AE5F0 /* ProfilerJettisonReason.cpp */; };
</span><span class="lines">@@ -2654,6 +2655,7 @@
</span><span class="cx">                 0F15F15D14B7A73A005DE37D /* CommonSlowPaths.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommonSlowPaths.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 0F1725FE1B48719A00AC3A55 /* DFGMinifiedGraph.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGMinifiedGraph.cpp; path = dfg/DFGMinifiedGraph.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 0F1829681E92EE51005B1EA8 /* AirLivenessAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AirLivenessAdapter.h; path = b3/air/AirLivenessAdapter.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                0F18296A1E92F6DA005B1EA8 /* AirLivenessConstraints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AirLivenessConstraints.h; path = b3/air/AirLivenessConstraints.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 0F18D3CD1B55A6E0002C5C9F /* DFGAdaptiveStructureWatchpoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGAdaptiveStructureWatchpoint.cpp; path = dfg/DFGAdaptiveStructureWatchpoint.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 0F18D3CE1B55A6E0002C5C9F /* DFGAdaptiveStructureWatchpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGAdaptiveStructureWatchpoint.h; path = dfg/DFGAdaptiveStructureWatchpoint.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 0F190CAA189D82F6000AE5F0 /* ProfilerJettisonReason.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ProfilerJettisonReason.cpp; path = profiler/ProfilerJettisonReason.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -5613,6 +5615,7 @@
</span><span class="cx">                                 0FDF67D51D9DC43E001B9825 /* AirKind.h */,
</span><span class="cx">                                 2684D4371C00161C0081D663 /* AirLiveness.h */,
</span><span class="cx">                                 0F1829681E92EE51005B1EA8 /* AirLivenessAdapter.h */,
</span><ins>+                                0F18296A1E92F6DA005B1EA8 /* AirLivenessConstraints.h */,
</ins><span class="cx">                                 0FE34C171C4B39AE0003A512 /* AirLogRegisterPressure.cpp */,
</span><span class="cx">                                 0FE34C181C4B39AE0003A512 /* AirLogRegisterPressure.h */,
</span><span class="cx">                                 0F6183251C45BF070072450B /* AirLowerAfterRegAlloc.cpp */,
</span><span class="lines">@@ -8966,6 +8969,7 @@
</span><span class="cx">                                 2A4BB7F318A41179008A0FCD /* JSManagedValueInternal.h in Headers */,
</span><span class="cx">                                 A700874217CBE8EB00C3E643 /* JSMap.h in Headers */,
</span><span class="cx">                                 A74DEF96182D991400522C22 /* JSMapIterator.h in Headers */,
</span><ins>+                                0F18296B1E92F6DC005B1EA8 /* AirLivenessConstraints.h in Headers */,
</ins><span class="cx">                                 9959E92D1BD17FA4001AA413 /* jsmin.py in Headers */,
</span><span class="cx">                                 E3D239C91B829C1C00BBEF67 /* JSModuleEnvironment.h in Headers */,
</span><span class="cx">                                 D9722752DC54459B9125B539 /* JSModuleLoader.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3airAirLivenessAdapterh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/air/AirLivenessAdapter.h (214882 => 214883)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/air/AirLivenessAdapter.h        2017-04-04 16:12:17 UTC (rev 214882)
+++ trunk/Source/JavaScriptCore/b3/air/AirLivenessAdapter.h        2017-04-04 17:20:43 UTC (rev 214883)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include &quot;AirCFG.h&quot;
</span><span class="cx"> #include &quot;AirCode.h&quot;
</span><span class="cx"> #include &quot;AirInstInlines.h&quot;
</span><ins>+#include &quot;AirLivenessConstraints.h&quot;
</ins><span class="cx"> #include &quot;AirStackSlot.h&quot;
</span><span class="cx"> #include &quot;AirTmpInlines.h&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -42,6 +43,7 @@
</span><span class="cx">     
</span><span class="cx">     LivenessAdapter(Code&amp; code)
</span><span class="cx">         : code(code)
</span><ins>+        , constraints(code)
</ins><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="lines">@@ -53,52 +55,19 @@
</span><span class="cx">     template&lt;typename Func&gt;
</span><span class="cx">     void forEachUse(BasicBlock* block, size_t instBoundaryIndex, const Func&amp; func)
</span><span class="cx">     {
</span><del>-        if (Inst* prevInst = block-&gt;get(instBoundaryIndex - 1)) {
-            prevInst-&gt;forEach&lt;typename Adapter::Thing&gt;(
-                [&amp;] (typename Adapter::Thing&amp; thing, Arg::Role role, Bank bank, Width) {
-                    if (Arg::isLateUse(role)
-                        &amp;&amp; Adapter::acceptsBank(bank)
-                        &amp;&amp; Adapter::acceptsRole(role))
-                        func(Adapter::valueToIndex(thing));
-                });
-        }
-        
-        if (Inst* nextInst = block-&gt;get(instBoundaryIndex)) {
-            nextInst-&gt;forEach&lt;typename Adapter::Thing&gt;(
-                [&amp;] (typename Adapter::Thing&amp; thing, Arg::Role role, Bank bank, Width) {
-                    if (Arg::isEarlyUse(role)
-                        &amp;&amp; Adapter::acceptsBank(bank)
-                        &amp;&amp; Adapter::acceptsRole(role))
-                        func(Adapter::valueToIndex(thing));
-                });
-        }
</del><ins>+        for (unsigned index : constraints.at(block, instBoundaryIndex).use)
+            func(index);
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     template&lt;typename Func&gt;
</span><span class="cx">     void forEachDef(BasicBlock* block, size_t instBoundaryIndex, const Func&amp; func)
</span><span class="cx">     {
</span><del>-        if (Inst* prevInst = block-&gt;get(instBoundaryIndex - 1)) {
-            prevInst-&gt;forEach&lt;typename Adapter::Thing&gt;(
-                [&amp;] (typename Adapter::Thing&amp; thing, Arg::Role role, Bank bank, Width) {
-                    if (Arg::isLateDef(role)
-                        &amp;&amp; Adapter::acceptsBank(bank)
-                        &amp;&amp; Adapter::acceptsRole(role))
-                        func(Adapter::valueToIndex(thing));
-                });
-        }
-        
-        if (Inst* nextInst = block-&gt;get(instBoundaryIndex)) {
-            nextInst-&gt;forEach&lt;typename Adapter::Thing&gt;(
-                [&amp;] (typename Adapter::Thing&amp; thing, Arg::Role role, Bank bank, Width) {
-                    if (Arg::isEarlyDef(role)
-                        &amp;&amp; Adapter::acceptsBank(bank)
-                        &amp;&amp; Adapter::acceptsRole(role))
-                        func(Adapter::valueToIndex(thing));
-                });
-        }
</del><ins>+        for (unsigned index : constraints.at(block, instBoundaryIndex).def)
+            func(index);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     Code&amp; code;
</span><ins>+    LivenessConstraints&lt;Adapter&gt; constraints;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> template&lt;Bank adapterBank, Arg::Temperature minimumTemperature = Arg::Cold&gt;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3airAirLivenessConstraintsh"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/b3/air/AirLivenessConstraints.h (0 => 214883)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/air/AirLivenessConstraints.h                                (rev 0)
+++ trunk/Source/JavaScriptCore/b3/air/AirLivenessConstraints.h        2017-04-04 17:20:43 UTC (rev 214883)
</span><span class="lines">@@ -0,0 +1,94 @@
</span><ins>+/*
+ * Copyright (C) 2017 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(B3_JIT)
+
+#include &quot;AirBasicBlock.h&quot;
+#include &quot;AirCode.h&quot;
+#include &quot;AirInstInlines.h&quot;
+#include &lt;wtf/IndexMap.h&gt;
+
+namespace JSC { namespace B3 { namespace Air {
+
+template&lt;typename Adapter&gt;
+class LivenessConstraints {
+public:
+    typedef Vector&lt;unsigned, 4&gt; ActionsList;
+    
+    struct Actions {
+        Actions() { }
+        
+        ActionsList use;
+        ActionsList def;
+    };
+    
+    typedef Vector&lt;Actions, 0, UnsafeVectorOverflow&gt; ActionsForBoundary;
+    
+    LivenessConstraints(Code&amp; code)
+        : m_code(code)
+        , m_actions(code.size())
+    {
+        for (BasicBlock* block : m_code) {
+            ActionsForBoundary&amp; actionsForBoundary = m_actions[block];
+            actionsForBoundary.resize(block-&gt;size() + 1);
+            
+            for (size_t instIndex = block-&gt;size(); instIndex--;) {
+                Inst&amp; inst = block-&gt;at(instIndex);
+                inst.forEach&lt;typename Adapter::Thing&gt;(
+                    [&amp;] (typename Adapter::Thing&amp; thing, Arg::Role role, Bank bank, Width) {
+                        if (!Adapter::acceptsBank(bank) || !Adapter::acceptsRole(role))
+                            return;
+                        
+                        unsigned index = Adapter::valueToIndex(thing);
+                        
+                        if (Arg::isEarlyUse(role))
+                            actionsForBoundary[instIndex].use.appendIfNotContains(index);
+                        if (Arg::isEarlyDef(role))
+                            actionsForBoundary[instIndex].def.appendIfNotContains(index);
+                        if (Arg::isLateUse(role))
+                            actionsForBoundary[instIndex + 1].use.appendIfNotContains(index);
+                        if (Arg::isLateDef(role))
+                            actionsForBoundary[instIndex + 1].def.appendIfNotContains(index);
+                    });
+            }
+        }
+    }
+    
+    Actions&amp; at(BasicBlock* block, unsigned instBoundaryIndex)
+    {
+        return m_actions[block][instBoundaryIndex];
+    }
+    
+private:
+    Code&amp; m_code;
+    IndexMap&lt;BasicBlock*, ActionsForBoundary&gt; m_actions;
+};
+
+} } } // namespace JSC::B3::Air
+
+#endif // ENABLE(B3_JIT)
+
</ins></span></pre></div>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (214882 => 214883)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2017-04-04 16:12:17 UTC (rev 214882)
+++ trunk/Source/WTF/ChangeLog        2017-04-04 17:20:43 UTC (rev 214883)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2017-04-03  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
+        Air liveness should build constraints and solve them rather than repeatedly parsing IR
+        https://bugs.webkit.org/show_bug.cgi?id=170421
+
+        Reviewed by Saam Barati.
+
+        * wtf/Vector.h:
+        (WTF::minCapacity&gt;::appendIfNotContains): Because sometimes Vector&lt;&gt; is the best kind of set.
+
</ins><span class="cx"> 2017-04-03  Yusuke Suzuki  &lt;utatane.tea@gmail.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [WTF] Introduce WTF::RandomDevice which keeps /dev/urandom opened
</span></span></pre></div>
<a id="trunkSourceWTFwtfVectorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/Vector.h (214882 => 214883)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/Vector.h        2017-04-04 16:12:17 UTC (rev 214882)
+++ trunk/Source/WTF/wtf/Vector.h        2017-04-04 17:20:43 UTC (rev 214883)
</span><span class="lines">@@ -706,6 +706,8 @@
</span><span class="cx">     template&lt;typename U&gt; bool contains(const U&amp;) const;
</span><span class="cx">     template&lt;typename U&gt; size_t find(const U&amp;) const;
</span><span class="cx">     template&lt;typename U&gt; size_t reverseFind(const U&amp;) const;
</span><ins>+    
+    template&lt;typename U&gt; bool appendIfNotContains(const U&amp;);
</ins><span class="cx"> 
</span><span class="cx">     void shrink(size_t size);
</span><span class="cx">     void grow(size_t size);
</span><span class="lines">@@ -926,6 +928,16 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template&lt;typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity&gt;
</span><ins>+template&lt;typename U&gt;
+bool Vector&lt;T, inlineCapacity, OverflowHandler, minCapacity&gt;::appendIfNotContains(const U&amp; value)
+{
+    if (contains(value))
+        return false;
+    append(value);
+    return true;
+}
+
+template&lt;typename T, size_t inlineCapacity, typename OverflowHandler, size_t minCapacity&gt;
</ins><span class="cx"> void Vector&lt;T, inlineCapacity, OverflowHandler, minCapacity&gt;::fill(const T&amp; val, size_t newSize)
</span><span class="cx"> {
</span><span class="cx">     if (size() &gt; newSize)
</span></span></pre>
</div>
</div>

</body>
</html>