<!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>[192558] 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/192558">192558</a></dd>
<dt>Author</dt> <dd>fpizlo@apple.com</dd>
<dt>Date</dt> <dd>2015-11-17 17:27:28 -0800 (Tue, 17 Nov 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>B3::generate should separate out the final Air codegen, so that it can be done outside the Graph safepoint
https://bugs.webkit.org/show_bug.cgi?id=151371

Reviewed by Benjamin Poulain.

One of the FTL optimizations is that while the expensive backend is running, we are at a &quot;graph
safepoint&quot; that allows the VM to do GCs and other dangerous and time-sensitive things without
waiting for the compilation thread. While in the safepoint, we cannot do anything that touches
anything other than the backend's state. That means, for example, that we wouldn't be able to run
any of the stackmap generation callbacks, since those need to mess with DFG state.

That means that we need to separate the B3 pipeline into &quot;preparation&quot; and &quot;generation&quot;.
Preparation is all of the expensive stuff: all B3 phases, lowering to Air, all Air phases.
Generation is just the part where we turn fully lowered Air into machine code. Generation also
happens to be the part where we call stackmap generation callbacks. In other words, preparation
is exactly the stuff that should go into the graph safepoint, while generation is the stuff that
we want to do after we emerge from the safepoint.

Because the tests were using the higher-level Compilation API, I didn't have to change any test
code. The FTL will not use that high-level API.

* b3/B3Compilation.cpp:
(JSC::B3::Compilation::Compilation):
* b3/B3Generate.cpp:
(JSC::B3::prepareForGeneration):
(JSC::B3::generate):
(JSC::B3::generateToAir):
* b3/B3Generate.h:
* b3/B3LowerToAir.cpp:
(JSC::B3::Air::LowerToAir::LowerToAir):
(JSC::B3::lowerToAir):
* b3/B3LowerToAir.h:
* b3/B3Procedure.cpp:
(JSC::B3::Procedure::Procedure):
* b3/B3Procedure.h:
(JSC::B3::Procedure::takeByproducts):
(JSC::B3::Procedure::code):
* b3/air/AirCode.h:
(JSC::B3::Air::Code::proc):
(JSC::B3::Air::Code::lastPhaseName):
* b3/air/AirGenerate.cpp:
(JSC::B3::Air::prepareForGeneration):
(JSC::B3::Air::generate):
* b3/air/AirGenerate.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3Compilationcpp">trunk/Source/JavaScriptCore/b3/B3Compilation.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3Generatecpp">trunk/Source/JavaScriptCore/b3/B3Generate.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3Generateh">trunk/Source/JavaScriptCore/b3/B3Generate.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3LowerToAircpp">trunk/Source/JavaScriptCore/b3/B3LowerToAir.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3LowerToAirh">trunk/Source/JavaScriptCore/b3/B3LowerToAir.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3Procedurecpp">trunk/Source/JavaScriptCore/b3/B3Procedure.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3Procedureh">trunk/Source/JavaScriptCore/b3/B3Procedure.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3airAirCodeh">trunk/Source/JavaScriptCore/b3/air/AirCode.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3airAirGeneratecpp">trunk/Source/JavaScriptCore/b3/air/AirGenerate.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3airAirGenerateh">trunk/Source/JavaScriptCore/b3/air/AirGenerate.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (192557 => 192558)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-11-18 00:27:16 UTC (rev 192557)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-11-18 01:27:28 UTC (rev 192558)
</span><span class="lines">@@ -1,5 +1,52 @@
</span><span class="cx"> 2015-11-17  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        B3::generate should separate out the final Air codegen, so that it can be done outside the Graph safepoint
+        https://bugs.webkit.org/show_bug.cgi?id=151371
+
+        Reviewed by Benjamin Poulain.
+
+        One of the FTL optimizations is that while the expensive backend is running, we are at a &quot;graph
+        safepoint&quot; that allows the VM to do GCs and other dangerous and time-sensitive things without
+        waiting for the compilation thread. While in the safepoint, we cannot do anything that touches
+        anything other than the backend's state. That means, for example, that we wouldn't be able to run
+        any of the stackmap generation callbacks, since those need to mess with DFG state.
+
+        That means that we need to separate the B3 pipeline into &quot;preparation&quot; and &quot;generation&quot;.
+        Preparation is all of the expensive stuff: all B3 phases, lowering to Air, all Air phases.
+        Generation is just the part where we turn fully lowered Air into machine code. Generation also
+        happens to be the part where we call stackmap generation callbacks. In other words, preparation
+        is exactly the stuff that should go into the graph safepoint, while generation is the stuff that
+        we want to do after we emerge from the safepoint.
+
+        Because the tests were using the higher-level Compilation API, I didn't have to change any test
+        code. The FTL will not use that high-level API.
+
+        * b3/B3Compilation.cpp:
+        (JSC::B3::Compilation::Compilation):
+        * b3/B3Generate.cpp:
+        (JSC::B3::prepareForGeneration):
+        (JSC::B3::generate):
+        (JSC::B3::generateToAir):
+        * b3/B3Generate.h:
+        * b3/B3LowerToAir.cpp:
+        (JSC::B3::Air::LowerToAir::LowerToAir):
+        (JSC::B3::lowerToAir):
+        * b3/B3LowerToAir.h:
+        * b3/B3Procedure.cpp:
+        (JSC::B3::Procedure::Procedure):
+        * b3/B3Procedure.h:
+        (JSC::B3::Procedure::takeByproducts):
+        (JSC::B3::Procedure::code):
+        * b3/air/AirCode.h:
+        (JSC::B3::Air::Code::proc):
+        (JSC::B3::Air::Code::lastPhaseName):
+        * b3/air/AirGenerate.cpp:
+        (JSC::B3::Air::prepareForGeneration):
+        (JSC::B3::Air::generate):
+        * b3/air/AirGenerate.h:
+
+2015-11-17  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
</ins><span class="cx">         FTL::State should be able to refer to B3::Procedure
</span><span class="cx"> 
</span><span class="cx">         Rubber stamped by Benjamin Poulain.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3Compilationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/B3Compilation.cpp (192557 => 192558)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3Compilation.cpp        2015-11-18 00:27:16 UTC (rev 192557)
+++ trunk/Source/JavaScriptCore/b3/B3Compilation.cpp        2015-11-18 01:27:28 UTC (rev 192558)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include &quot;B3Generate.h&quot;
</span><span class="cx"> #include &quot;B3OpaqueByproducts.h&quot;
</span><span class="cx"> #include &quot;B3Procedure.h&quot;
</span><ins>+#include &quot;B3TimingScope.h&quot;
</ins><span class="cx"> #include &quot;CCallHelpers.h&quot;
</span><span class="cx"> #include &quot;JSCInlines.h&quot;
</span><span class="cx"> #include &quot;LinkBuffer.h&quot;
</span><span class="lines">@@ -39,8 +40,11 @@
</span><span class="cx"> 
</span><span class="cx"> Compilation::Compilation(VM&amp; vm, Procedure&amp; proc, unsigned optLevel)
</span><span class="cx"> {
</span><ins>+    TimingScope timingScope(&quot;Compilation&quot;);
+    
</ins><span class="cx">     CCallHelpers jit(&amp;vm);
</span><del>-    generate(proc, jit, optLevel);
</del><ins>+    prepareForGeneration(proc, optLevel);
+    generate(proc, jit);
</ins><span class="cx">     LinkBuffer linkBuffer(vm, jit, nullptr);
</span><span class="cx"> 
</span><span class="cx">     m_codeRef = FINALIZE_CODE(linkBuffer, (&quot;B3::Compilation&quot;));
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3Generatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/B3Generate.cpp (192557 => 192558)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3Generate.cpp        2015-11-18 00:27:16 UTC (rev 192557)
+++ trunk/Source/JavaScriptCore/b3/B3Generate.cpp        2015-11-18 01:27:28 UTC (rev 192558)
</span><span class="lines">@@ -42,17 +42,21 @@
</span><span class="cx"> 
</span><span class="cx"> namespace JSC { namespace B3 {
</span><span class="cx"> 
</span><del>-void generate(Procedure&amp; procedure, CCallHelpers&amp; jit, unsigned optLevel)
</del><ins>+void prepareForGeneration(Procedure&amp; procedure, unsigned optLevel)
</ins><span class="cx"> {
</span><del>-    TimingScope timingScope(&quot;generate&quot;);
</del><ins>+    TimingScope timingScope(&quot;prepareForGeneration&quot;);
</ins><span class="cx"> 
</span><del>-    Air::Code code(procedure);
-    generateToAir(procedure, code, optLevel);
-    Air::generate(code, jit);
</del><ins>+    generateToAir(procedure, optLevel);
+    Air::prepareForGeneration(procedure.code());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void generateToAir(Procedure&amp; procedure, Air::Code&amp; code, unsigned optLevel)
</del><ins>+void generate(Procedure&amp; procedure, CCallHelpers&amp; jit)
</ins><span class="cx"> {
</span><ins>+    Air::generate(procedure.code(), jit);
+}
+
+void generateToAir(Procedure&amp; procedure, unsigned optLevel)
+{
</ins><span class="cx">     TimingScope timingScope(&quot;generateToAir&quot;);
</span><span class="cx">     
</span><span class="cx">     if (shouldDumpIR() &amp;&amp; !shouldDumpIRAtEachPhase()) {
</span><span class="lines">@@ -87,7 +91,7 @@
</span><span class="cx">         dataLog(procedure);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    lowerToAir(procedure, code);
</del><ins>+    lowerToAir(procedure);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } } // namespace JSC::B3
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3Generateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/B3Generate.h (192557 => 192558)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3Generate.h        2015-11-18 00:27:16 UTC (rev 192557)
+++ trunk/Source/JavaScriptCore/b3/B3Generate.h        2015-11-18 01:27:28 UTC (rev 192558)
</span><span class="lines">@@ -37,14 +37,19 @@
</span><span class="cx"> class Procedure;
</span><span class="cx"> namespace Air { class Code; }
</span><span class="cx"> 
</span><del>-// This takes a B3::Procedure, optimizes it in-place, and generates it to machine code by first
-// internally converting to an Air::Code and then generating that.
-JS_EXPORT_PRIVATE void generate(Procedure&amp;, CCallHelpers&amp;, unsigned optLevel = 1);
</del><ins>+// This takes a B3::Procedure, optimizes it in-place, lowers it to Air, and prepares the Air for
+// generation.
+void prepareForGeneration(Procedure&amp;, unsigned optLevel = 1);
</ins><span class="cx"> 
</span><ins>+// This takes a B3::Procedure that has been prepared for generation (i.e. it has been lowered to Air and
+// the Air has been prepared for generation) and generates it. This is the equivalent of calling
+// Air::generate() on the Procedure::code().
+void generate(Procedure&amp;, CCallHelpers&amp;);
+
</ins><span class="cx"> // This takes a B3::Procedure, optimizes it in-place, and lowers it to Air. You can then generate
</span><del>-// the Air to machine code using Air::generate(). Note that an Air::Code will have pointers into the
-// B3::Procedure, so you need to ensure that the B3::Procedure outlives the Air::Code.
-void generateToAir(Procedure&amp;, Air::Code&amp;, unsigned optLevel = 1);
</del><ins>+// the Air to machine code using Air::prepareForGeneration() and Air::generate() on the Procedure's
+// code().
+void generateToAir(Procedure&amp;, unsigned optLevel = 1);
</ins><span class="cx"> 
</span><span class="cx"> } } // namespace JSC::B3
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3LowerToAircpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/B3LowerToAir.cpp (192557 => 192558)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3LowerToAir.cpp        2015-11-18 00:27:16 UTC (rev 192557)
+++ trunk/Source/JavaScriptCore/b3/B3LowerToAir.cpp        2015-11-18 01:27:28 UTC (rev 192558)
</span><span class="lines">@@ -61,12 +61,12 @@
</span><span class="cx"> 
</span><span class="cx"> class LowerToAir {
</span><span class="cx"> public:
</span><del>-    LowerToAir(Procedure&amp; procedure, Code&amp; code)
</del><ins>+    LowerToAir(Procedure&amp; procedure)
</ins><span class="cx">         : m_valueToTmp(procedure.values().size())
</span><span class="cx">         , m_blockToBlock(procedure.size())
</span><span class="cx">         , m_useCounts(procedure)
</span><span class="cx">         , m_procedure(procedure)
</span><del>-        , m_code(code)
</del><ins>+        , m_code(procedure.code())
</ins><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -1745,10 +1745,10 @@
</span><span class="cx"> 
</span><span class="cx"> } // anonymous namespace
</span><span class="cx"> 
</span><del>-void lowerToAir(Procedure&amp; procedure, Code&amp; code)
</del><ins>+void lowerToAir(Procedure&amp; procedure)
</ins><span class="cx"> {
</span><span class="cx">     PhaseScope phaseScope(procedure, &quot;lowerToAir&quot;);
</span><del>-    LowerToAir lowerToAir(procedure, code);
</del><ins>+    LowerToAir lowerToAir(procedure);
</ins><span class="cx">     lowerToAir.run();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3LowerToAirh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/B3LowerToAir.h (192557 => 192558)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3LowerToAir.h        2015-11-18 00:27:16 UTC (rev 192557)
+++ trunk/Source/JavaScriptCore/b3/B3LowerToAir.h        2015-11-18 01:27:28 UTC (rev 192558)
</span><span class="lines">@@ -35,7 +35,7 @@
</span><span class="cx"> 
</span><span class="cx"> // This lowers the current B3 procedure to an Air code.
</span><span class="cx"> 
</span><del>-void lowerToAir(Procedure&amp;, Air::Code&amp;);
</del><ins>+void lowerToAir(Procedure&amp;);
</ins><span class="cx"> 
</span><span class="cx"> } } // namespace JSC::B3
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3Procedurecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/B3Procedure.cpp (192557 => 192558)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3Procedure.cpp        2015-11-18 00:27:16 UTC (rev 192557)
+++ trunk/Source/JavaScriptCore/b3/B3Procedure.cpp        2015-11-18 01:27:28 UTC (rev 192558)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(B3_JIT)
</span><span class="cx"> 
</span><ins>+#include &quot;AirCode.h&quot;
</ins><span class="cx"> #include &quot;B3BasicBlockInlines.h&quot;
</span><span class="cx"> #include &quot;B3BasicBlockUtils.h&quot;
</span><span class="cx"> #include &quot;B3BlockWorklist.h&quot;
</span><span class="lines">@@ -40,6 +41,7 @@
</span><span class="cx"> Procedure::Procedure()
</span><span class="cx">     : m_lastPhaseName(&quot;initial&quot;)
</span><span class="cx">     , m_byproducts(std::make_unique&lt;OpaqueByproducts&gt;())
</span><ins>+    , m_code(new Air::Code(*this))
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3Procedureh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/B3Procedure.h (192557 => 192558)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3Procedure.h        2015-11-18 00:27:16 UTC (rev 192557)
+++ trunk/Source/JavaScriptCore/b3/B3Procedure.h        2015-11-18 01:27:28 UTC (rev 192558)
</span><span class="lines">@@ -45,6 +45,8 @@
</span><span class="cx"> class OpaqueByproducts;
</span><span class="cx"> class Value;
</span><span class="cx"> 
</span><ins>+namespace Air { class Code; }
+
</ins><span class="cx"> class Procedure {
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(Procedure);
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="lines">@@ -218,6 +220,8 @@
</span><span class="cx">     // that API, then you don't have to worry about this.
</span><span class="cx">     std::unique_ptr&lt;OpaqueByproducts&gt; takeByproducts() { return WTF::move(m_byproducts); }
</span><span class="cx"> 
</span><ins>+    Air::Code&amp; code() { return *m_code; }
+
</ins><span class="cx"> private:
</span><span class="cx">     friend class BlockInsertionSet;
</span><span class="cx">     
</span><span class="lines">@@ -228,6 +232,7 @@
</span><span class="cx">     Vector&lt;size_t&gt; m_valueIndexFreeList;
</span><span class="cx">     const char* m_lastPhaseName;
</span><span class="cx">     std::unique_ptr&lt;OpaqueByproducts&gt; m_byproducts;
</span><ins>+    std::unique_ptr&lt;Air::Code&gt; m_code;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } } // namespace JSC::B3
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3airAirCodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/air/AirCode.h (192557 => 192558)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/air/AirCode.h        2015-11-18 00:27:16 UTC (rev 192557)
+++ trunk/Source/JavaScriptCore/b3/air/AirCode.h        2015-11-18 01:27:28 UTC (rev 192558)
</span><span class="lines">@@ -50,7 +50,6 @@
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(Code);
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    Code(Procedure&amp;);
</del><span class="cx">     ~Code();
</span><span class="cx"> 
</span><span class="cx">     Procedure&amp; proc() { return m_proc; }
</span><span class="lines">@@ -299,6 +298,10 @@
</span><span class="cx">     const char* lastPhaseName() const { return m_lastPhaseName; }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><ins>+    friend class ::JSC::B3::Procedure;
+    
+    Code(Procedure&amp;);
+
</ins><span class="cx">     Procedure&amp; m_proc; // Some meta-data, like byproducts, is stored in the Procedure.
</span><span class="cx">     Vector&lt;std::unique_ptr&lt;StackSlot&gt;&gt; m_stackSlots;
</span><span class="cx">     Vector&lt;std::unique_ptr&lt;BasicBlock&gt;&gt; m_blocks;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3airAirGeneratecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/air/AirGenerate.cpp (192557 => 192558)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/air/AirGenerate.cpp        2015-11-18 00:27:16 UTC (rev 192557)
+++ trunk/Source/JavaScriptCore/b3/air/AirGenerate.cpp        2015-11-18 01:27:28 UTC (rev 192558)
</span><span class="lines">@@ -46,9 +46,9 @@
</span><span class="cx"> 
</span><span class="cx"> namespace JSC { namespace B3 { namespace Air {
</span><span class="cx"> 
</span><del>-void generate(Code&amp; code, CCallHelpers&amp; jit)
</del><ins>+void prepareForGeneration(Code&amp; code)
</ins><span class="cx"> {
</span><del>-    TimingScope timingScope(&quot;Air::generate&quot;);
</del><ins>+    TimingScope timingScope(&quot;Air::prepareForGeneration&quot;);
</ins><span class="cx">     
</span><span class="cx">     // We don't expect the incoming code to have predecessors computed.
</span><span class="cx">     code.resetReachability();
</span><span class="lines">@@ -106,8 +106,11 @@
</span><span class="cx">         dataLog(&quot;Air after &quot;, code.lastPhaseName(), &quot;, before generation:\n&quot;);
</span><span class="cx">         dataLog(code);
</span><span class="cx">     }
</span><ins>+}
</ins><span class="cx"> 
</span><del>-    TimingScope codeGenTimingScope(&quot;Air::generate backend&quot;);
</del><ins>+void generate(Code&amp; code, CCallHelpers&amp; jit)
+{
+    TimingScope timingScope(&quot;Air::generate&quot;);
</ins><span class="cx"> 
</span><span class="cx">     // And now, we generate code.
</span><span class="cx">     jit.emitFunctionPrologue();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3airAirGenerateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/air/AirGenerate.h (192557 => 192558)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/air/AirGenerate.h        2015-11-18 00:27:16 UTC (rev 192557)
+++ trunk/Source/JavaScriptCore/b3/air/AirGenerate.h        2015-11-18 01:27:28 UTC (rev 192558)
</span><span class="lines">@@ -37,9 +37,11 @@
</span><span class="cx"> class Code;
</span><span class="cx"> 
</span><span class="cx"> // This takes an Air::Code that hasn't had any stack allocation and optionally hasn't had any
</span><del>-// register allocation and does both of those things, and then generates the code using the given
-// CCallHelpers instance. Note that this may call callbacks in the supplied code as it is
-// generating.
</del><ins>+// register allocation and does both of those things.
+void prepareForGeneration(Code&amp;);
+
+// This generates the code using the given CCallHelpers instance. Note that this may call callbacks
+// in the supplied code as it is generating.
</ins><span class="cx"> void generate(Code&amp;, CCallHelpers&amp;);
</span><span class="cx"> 
</span><span class="cx"> } } } // namespace JSC::B3::Air
</span></span></pre>
</div>
</div>

</body>
</html>