<!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>[170016] branches/ftlopt/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/170016">170016</a></dd>
<dt>Author</dt> <dd>fpizlo@apple.com</dd>
<dt>Date</dt> <dd>2014-06-16 11:03:04 -0700 (Mon, 16 Jun 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[ftlopt] DFG OSR entry should have a crystal-clear story for when it's safe to enter at a block with a set of values
https://bugs.webkit.org/show_bug.cgi?id=133935

Reviewed by Oliver Hunt.

* bytecode/Operands.h:
(JSC::Operands::Operands):
(JSC::Operands::ensureLocals):
* dfg/DFGAbstractValue.cpp:
(JSC::DFG::AbstractValue::filter): Now we can compute intersections of abstract values!
* dfg/DFGAbstractValue.h:
(JSC::DFG::AbstractValue::makeFullTop): Completeness.
(JSC::DFG::AbstractValue::bytecodeTop): Completeness.
(JSC::DFG::AbstractValue::fullTop): Completeness. We end up using this one.
* dfg/DFGBasicBlock.cpp:
(JSC::DFG::BasicBlock::BasicBlock):
(JSC::DFG::BasicBlock::ensureLocals):
* dfg/DFGBasicBlock.h: Remember the intersection of all things ever proven.
* dfg/DFGCFAPhase.cpp:
(JSC::DFG::CFAPhase::run): Compute the intersection.
* dfg/DFGConstantFoldingPhase.cpp:
(JSC::DFG::ConstantFoldingPhase::foldConstants): No need for the weirdo merge check since this fixes the root of the problem.
* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::dumpBlockHeader): Better dumping.
(JSC::DFG::Graph::dump): Better dumping.
* dfg/DFGJITCompiler.h:
(JSC::DFG::JITCompiler::noticeOSREntry): Use the intersected abstract value.
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileCurrentBlock): Assert if the intersected state indicates the block shouldn't execute.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchesftloptSourceJavaScriptCoreChangeLog">branches/ftlopt/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#branchesftloptSourceJavaScriptCorebytecodeOperandsh">branches/ftlopt/Source/JavaScriptCore/bytecode/Operands.h</a></li>
<li><a href="#branchesftloptSourceJavaScriptCoredfgDFGAbstractValuecpp">branches/ftlopt/Source/JavaScriptCore/dfg/DFGAbstractValue.cpp</a></li>
<li><a href="#branchesftloptSourceJavaScriptCoredfgDFGAbstractValueh">branches/ftlopt/Source/JavaScriptCore/dfg/DFGAbstractValue.h</a></li>
<li><a href="#branchesftloptSourceJavaScriptCoredfgDFGBasicBlockcpp">branches/ftlopt/Source/JavaScriptCore/dfg/DFGBasicBlock.cpp</a></li>
<li><a href="#branchesftloptSourceJavaScriptCoredfgDFGBasicBlockh">branches/ftlopt/Source/JavaScriptCore/dfg/DFGBasicBlock.h</a></li>
<li><a href="#branchesftloptSourceJavaScriptCoredfgDFGCFAPhasecpp">branches/ftlopt/Source/JavaScriptCore/dfg/DFGCFAPhase.cpp</a></li>
<li><a href="#branchesftloptSourceJavaScriptCoredfgDFGConstantFoldingPhasecpp">branches/ftlopt/Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp</a></li>
<li><a href="#branchesftloptSourceJavaScriptCoredfgDFGGraphcpp">branches/ftlopt/Source/JavaScriptCore/dfg/DFGGraph.cpp</a></li>
<li><a href="#branchesftloptSourceJavaScriptCoredfgDFGJITCompilerh">branches/ftlopt/Source/JavaScriptCore/dfg/DFGJITCompiler.h</a></li>
<li><a href="#branchesftloptSourceJavaScriptCoredfgDFGSpeculativeJITcpp">branches/ftlopt/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchesftloptSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/ftlopt/Source/JavaScriptCore/ChangeLog (170015 => 170016)</h4>
<pre class="diff"><span>
<span class="info">--- branches/ftlopt/Source/JavaScriptCore/ChangeLog        2014-06-16 17:41:40 UTC (rev 170015)
+++ branches/ftlopt/Source/JavaScriptCore/ChangeLog        2014-06-16 18:03:04 UTC (rev 170016)
</span><span class="lines">@@ -1,3 +1,35 @@
</span><ins>+2014-06-15  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
+        [ftlopt] DFG OSR entry should have a crystal-clear story for when it's safe to enter at a block with a set of values
+        https://bugs.webkit.org/show_bug.cgi?id=133935
+
+        Reviewed by Oliver Hunt.
+
+        * bytecode/Operands.h:
+        (JSC::Operands::Operands):
+        (JSC::Operands::ensureLocals):
+        * dfg/DFGAbstractValue.cpp:
+        (JSC::DFG::AbstractValue::filter): Now we can compute intersections of abstract values!
+        * dfg/DFGAbstractValue.h:
+        (JSC::DFG::AbstractValue::makeFullTop): Completeness.
+        (JSC::DFG::AbstractValue::bytecodeTop): Completeness.
+        (JSC::DFG::AbstractValue::fullTop): Completeness. We end up using this one.
+        * dfg/DFGBasicBlock.cpp:
+        (JSC::DFG::BasicBlock::BasicBlock):
+        (JSC::DFG::BasicBlock::ensureLocals):
+        * dfg/DFGBasicBlock.h: Remember the intersection of all things ever proven.
+        * dfg/DFGCFAPhase.cpp:
+        (JSC::DFG::CFAPhase::run): Compute the intersection.
+        * dfg/DFGConstantFoldingPhase.cpp:
+        (JSC::DFG::ConstantFoldingPhase::foldConstants): No need for the weirdo merge check since this fixes the root of the problem.
+        * dfg/DFGGraph.cpp:
+        (JSC::DFG::Graph::dumpBlockHeader): Better dumping.
+        (JSC::DFG::Graph::dump): Better dumping.
+        * dfg/DFGJITCompiler.h:
+        (JSC::DFG::JITCompiler::noticeOSREntry): Use the intersected abstract value.
+        * dfg/DFGSpeculativeJIT.cpp:
+        (JSC::DFG::SpeculativeJIT::compileCurrentBlock): Assert if the intersected state indicates the block shouldn't execute.
+
</ins><span class="cx"> 2014-06-12  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [ftlopt] A DFG inlined ById access variant should not speak of a chain, but only of what structures to test the base for, whether to use a constant as an alternate base for the actual access, and what structures to check on what additional cell constants
</span></span></pre></div>
<a id="branchesftloptSourceJavaScriptCorebytecodeOperandsh"></a>
<div class="modfile"><h4>Modified: branches/ftlopt/Source/JavaScriptCore/bytecode/Operands.h (170015 => 170016)</h4>
<pre class="diff"><span>
<span class="info">--- branches/ftlopt/Source/JavaScriptCore/bytecode/Operands.h        2014-06-16 17:41:40 UTC (rev 170015)
+++ branches/ftlopt/Source/JavaScriptCore/bytecode/Operands.h        2014-06-16 18:03:04 UTC (rev 170016)
</span><span class="lines">@@ -52,10 +52,10 @@
</span><span class="cx"> public:
</span><span class="cx">     Operands() { }
</span><span class="cx">     
</span><del>-    explicit Operands(size_t numArguments, size_t numLocals)
</del><ins>+    explicit Operands(size_t numArguments, size_t numLocals, const T&amp; initialValue = Traits::defaultValue())
</ins><span class="cx">     {
</span><del>-        m_arguments.fill(Traits::defaultValue(), numArguments);
-        m_locals.fill(Traits::defaultValue(), numLocals);
</del><ins>+        m_arguments.fill(initialValue, numArguments);
+        m_locals.fill(initialValue, numLocals);
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     template&lt;typename U, typename OtherTraits&gt;
</span><span class="lines">@@ -96,7 +96,7 @@
</span><span class="cx">         return local(idx);
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    void ensureLocals(size_t size)
</del><ins>+    void ensureLocals(size_t size, const T&amp; ensuredValue = Traits::defaultValue())
</ins><span class="cx">     {
</span><span class="cx">         if (size &lt;= m_locals.size())
</span><span class="cx">             return;
</span><span class="lines">@@ -104,7 +104,7 @@
</span><span class="cx">         size_t oldSize = m_locals.size();
</span><span class="cx">         m_locals.resize(size);
</span><span class="cx">         for (size_t i = oldSize; i &lt; m_locals.size(); ++i)
</span><del>-            m_locals[i] = Traits::defaultValue();
</del><ins>+            m_locals[i] = ensuredValue;
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     void setLocal(size_t idx, const T&amp; value)
</span></span></pre></div>
<a id="branchesftloptSourceJavaScriptCoredfgDFGAbstractValuecpp"></a>
<div class="modfile"><h4>Modified: branches/ftlopt/Source/JavaScriptCore/dfg/DFGAbstractValue.cpp (170015 => 170016)</h4>
<pre class="diff"><span>
<span class="info">--- branches/ftlopt/Source/JavaScriptCore/dfg/DFGAbstractValue.cpp        2014-06-16 17:41:40 UTC (rev 170015)
+++ branches/ftlopt/Source/JavaScriptCore/dfg/DFGAbstractValue.cpp        2014-06-16 18:03:04 UTC (rev 170016)
</span><span class="lines">@@ -229,6 +229,39 @@
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+FiltrationResult AbstractValue::filter(const AbstractValue&amp; other)
+{
+    m_type &amp;= other.m_type;
+    m_structure.filter(other.m_structure);
+    m_arrayModes &amp;= other.m_arrayModes;
+
+    m_structure.filter(m_type);
+    filterArrayModesByType();
+    filterValueByType();
+    
+    if (normalizeClarity() == Contradiction)
+        return Contradiction;
+    
+    if (m_value == other.m_value)
+        return FiltrationOK;
+    
+    // Neither of us are BOTTOM, so an empty value means TOP.
+    if (!m_value) {
+        // We previously didn't prove a value but now we have done so.
+        m_value = other.m_value; 
+        return FiltrationOK;
+    }
+    
+    if (!other.m_value) {
+        // We had proved a value but the other guy hadn't, so keep our proof.
+        return FiltrationOK;
+    }
+    
+    // We both proved there to be a specific value but they are different.
+    clear();
+    return Contradiction;
+}
+
</ins><span class="cx"> void AbstractValue::filterValueByType()
</span><span class="cx"> {
</span><span class="cx">     // We could go further, and ensure that if the futurePossibleStructure contravenes
</span></span></pre></div>
<a id="branchesftloptSourceJavaScriptCoredfgDFGAbstractValueh"></a>
<div class="modfile"><h4>Modified: branches/ftlopt/Source/JavaScriptCore/dfg/DFGAbstractValue.h (170015 => 170016)</h4>
<pre class="diff"><span>
<span class="info">--- branches/ftlopt/Source/JavaScriptCore/dfg/DFGAbstractValue.h        2014-06-16 17:41:40 UTC (rev 170015)
+++ branches/ftlopt/Source/JavaScriptCore/dfg/DFGAbstractValue.h        2014-06-16 18:03:04 UTC (rev 170016)
</span><span class="lines">@@ -73,6 +73,11 @@
</span><span class="cx">         makeTop(SpecBytecodeTop);
</span><span class="cx">     }
</span><span class="cx">     
</span><ins>+    void makeFullTop()
+    {
+        makeTop(SpecFullTop);
+    }
+    
</ins><span class="cx">     void clobberStructures()
</span><span class="cx">     {
</span><span class="cx">         if (m_type &amp; SpecCell) {
</span><span class="lines">@@ -174,6 +179,20 @@
</span><span class="cx">         return result;
</span><span class="cx">     }
</span><span class="cx">     
</span><ins>+    static AbstractValue bytecodeTop()
+    {
+        AbstractValue result;
+        result.makeBytecodeTop();
+        return result;
+    }
+    
+    static AbstractValue fullTop()
+    {
+        AbstractValue result;
+        result.makeFullTop();
+        return result;
+    }
+    
</ins><span class="cx">     void setOSREntryValue(Graph&amp;, const FrozenValue&amp;);
</span><span class="cx">     
</span><span class="cx">     void set(Graph&amp;, const FrozenValue&amp;, StructureClobberState);
</span><span class="lines">@@ -259,13 +278,12 @@
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     FiltrationResult filter(Graph&amp;, const StructureSet&amp;);
</span><del>-    
</del><span class="cx">     FiltrationResult filterArrayModes(ArrayModes arrayModes);
</span><del>-    
</del><span class="cx">     FiltrationResult filter(SpeculatedType type);
</span><del>-    
</del><span class="cx">     FiltrationResult filterByValue(const FrozenValue&amp; value);
</span><span class="cx">     
</span><ins>+    FiltrationResult filter(const AbstractValue&amp;);
+    
</ins><span class="cx">     bool validate(JSValue value) const
</span><span class="cx">     {
</span><span class="cx">         if (isHeapTop())
</span></span></pre></div>
<a id="branchesftloptSourceJavaScriptCoredfgDFGBasicBlockcpp"></a>
<div class="modfile"><h4>Modified: branches/ftlopt/Source/JavaScriptCore/dfg/DFGBasicBlock.cpp (170015 => 170016)</h4>
<pre class="diff"><span>
<span class="info">--- branches/ftlopt/Source/JavaScriptCore/dfg/DFGBasicBlock.cpp        2014-06-16 17:41:40 UTC (rev 170015)
+++ branches/ftlopt/Source/JavaScriptCore/dfg/DFGBasicBlock.cpp        2014-06-16 18:03:04 UTC (rev 170016)
</span><span class="lines">@@ -52,6 +52,8 @@
</span><span class="cx">     , variablesAtTail(numArguments, numLocals)
</span><span class="cx">     , valuesAtHead(numArguments, numLocals)
</span><span class="cx">     , valuesAtTail(numArguments, numLocals)
</span><ins>+    , intersectionOfPastValuesAtHead(numArguments, numLocals, AbstractValue::fullTop())
+    , intersectionOfCFAHasVisited(true)
</ins><span class="cx">     , executionCount(executionCount)
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -64,6 +66,7 @@
</span><span class="cx">     variablesAtTail.ensureLocals(newNumLocals);
</span><span class="cx">     valuesAtHead.ensureLocals(newNumLocals);
</span><span class="cx">     valuesAtTail.ensureLocals(newNumLocals);
</span><ins>+    intersectionOfPastValuesAtHead.ensureLocals(newNumLocals, AbstractValue::fullTop());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool BasicBlock::isInPhis(Node* node) const
</span></span></pre></div>
<a id="branchesftloptSourceJavaScriptCoredfgDFGBasicBlockh"></a>
<div class="modfile"><h4>Modified: branches/ftlopt/Source/JavaScriptCore/dfg/DFGBasicBlock.h (170015 => 170016)</h4>
<pre class="diff"><span>
<span class="info">--- branches/ftlopt/Source/JavaScriptCore/dfg/DFGBasicBlock.h        2014-06-16 17:41:40 UTC (rev 170015)
+++ branches/ftlopt/Source/JavaScriptCore/dfg/DFGBasicBlock.h        2014-06-16 18:03:04 UTC (rev 170016)
</span><span class="lines">@@ -134,6 +134,26 @@
</span><span class="cx">     Operands&lt;AbstractValue&gt; valuesAtHead;
</span><span class="cx">     Operands&lt;AbstractValue&gt; valuesAtTail;
</span><span class="cx">     
</span><ins>+    // The intersection of assumptions we have made previously at the head of this block. Note
+    // that under normal circumstances, each time we run the CFA, we will get strictly more precise
+    // results. But we don't actually require this to be the case. It's fine for the CFA to loosen
+    // up for any odd reason. It's fine when this happens, because anything that the CFA proves
+    // must be true from that point forward, except if some registered watchpoint fires, in which
+    // case the code won't ever run. So, the CFA proving something less precise later on is just an
+    // outcome of the CFA being imperfect; the more precise thing that it had proved earlier is no
+    // less true.
+    //
+    // But for the purpose of OSR entry, we need to make sure that we remember what assumptions we
+    // had used for optimizing any given basic block. That's what this is for.
+    //
+    // It's interesting that we could use this to make the CFA more precise: all future CFAs could
+    // filter their results with this thing to sort of maintain maximal precision. Because we
+    // expect CFA to usually be monotonically more precise each time we run it to fixpoint, this
+    // would not be a productive optimization: it would make setting up a basic block more
+    // expensive and would only benefit bizarre pathological cases.
+    Operands&lt;AbstractValue&gt; intersectionOfPastValuesAtHead;
+    bool intersectionOfCFAHasVisited;
+    
</ins><span class="cx">     float executionCount;
</span><span class="cx">     
</span><span class="cx">     // These fields are reserved for NaturalLoops.
</span></span></pre></div>
<a id="branchesftloptSourceJavaScriptCoredfgDFGCFAPhasecpp"></a>
<div class="modfile"><h4>Modified: branches/ftlopt/Source/JavaScriptCore/dfg/DFGCFAPhase.cpp (170015 => 170016)</h4>
<pre class="diff"><span>
<span class="info">--- branches/ftlopt/Source/JavaScriptCore/dfg/DFGCFAPhase.cpp        2014-06-16 17:41:40 UTC (rev 170015)
+++ branches/ftlopt/Source/JavaScriptCore/dfg/DFGCFAPhase.cpp        2014-06-16 18:03:04 UTC (rev 170016)
</span><span class="lines">@@ -79,6 +79,19 @@
</span><span class="cx">             performForwardCFA();
</span><span class="cx">         } while (m_changed);
</span><span class="cx">         
</span><ins>+        if (m_graph.m_form != SSA) {
+            // Make sure we record the intersection of all proofs that we ever allowed the
+            // compiler to rely upon.
+            for (BlockIndex blockIndex = m_graph.numBlocks(); blockIndex--;) {
+                BasicBlock* block = m_graph.block(blockIndex);
+                if (!block)
+                    continue;
+                block-&gt;intersectionOfCFAHasVisited &amp;= block-&gt;cfaHasVisited;
+                for (unsigned i = block-&gt;intersectionOfPastValuesAtHead.size(); i--;)
+                    block-&gt;intersectionOfPastValuesAtHead[i].filter(block-&gt;valuesAtHead[i]);
+            }
+        }
+        
</ins><span class="cx">         return true;
</span><span class="cx">     }
</span><span class="cx">     
</span></span></pre></div>
<a id="branchesftloptSourceJavaScriptCoredfgDFGConstantFoldingPhasecpp"></a>
<div class="modfile"><h4>Modified: branches/ftlopt/Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp (170015 => 170016)</h4>
<pre class="diff"><span>
<span class="info">--- branches/ftlopt/Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp        2014-06-16 17:41:40 UTC (rev 170015)
+++ branches/ftlopt/Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp        2014-06-16 18:03:04 UTC (rev 170016)
</span><span class="lines">@@ -281,17 +281,6 @@
</span><span class="cx">             if (!*value)
</span><span class="cx">                 continue;
</span><span class="cx">             
</span><del>-            // Check if merging the abstract value of the constant into the abstract value
-            // we've proven for this node wouldn't widen the proof. If it widens the proof
-            // (i.e. says that the set contains more things in it than it previously did)
-            // then we refuse to fold.
-            AbstractValue oldValue = m_state.forNode(node);
-            AbstractValue constantValue;
-            constantValue.set(m_graph, *value, m_state.structureClobberState());
-            constantValue.fixTypeForRepresentation(node);
-            if (oldValue.merge(constantValue))
-                continue;
-                
</del><span class="cx">             NodeOrigin origin = node-&gt;origin;
</span><span class="cx">             AdjacencyList children = node-&gt;children;
</span><span class="cx">             
</span></span></pre></div>
<a id="branchesftloptSourceJavaScriptCoredfgDFGGraphcpp"></a>
<div class="modfile"><h4>Modified: branches/ftlopt/Source/JavaScriptCore/dfg/DFGGraph.cpp (170015 => 170016)</h4>
<pre class="diff"><span>
<span class="info">--- branches/ftlopt/Source/JavaScriptCore/dfg/DFGGraph.cpp        2014-06-16 17:41:40 UTC (rev 170015)
+++ branches/ftlopt/Source/JavaScriptCore/dfg/DFGGraph.cpp        2014-06-16 18:03:04 UTC (rev 170016)
</span><span class="lines">@@ -364,7 +364,7 @@
</span><span class="cx"> 
</span><span class="cx"> void Graph::dumpBlockHeader(PrintStream&amp; out, const char* prefix, BasicBlock* block, PhiNodeDumpMode phiNodeDumpMode, DumpContext* context)
</span><span class="cx"> {
</span><del>-    out.print(prefix, &quot;Block &quot;, *block, &quot; (&quot;, inContext(block-&gt;at(0)-&gt;origin.semantic, context), &quot;):&quot;, block-&gt;isReachable ? &quot;&quot; : &quot; (skipped)&quot;, block-&gt;isOSRTarget ? &quot; (OSR target)&quot; : &quot;&quot;, block-&gt;cfaHasVisited ? &quot;&quot; : &quot; (CFA-unreachable)&quot;, &quot;\n&quot;);
</del><ins>+    out.print(prefix, &quot;Block &quot;, *block, &quot; (&quot;, inContext(block-&gt;at(0)-&gt;origin.semantic, context), &quot;):&quot;, block-&gt;isReachable ? &quot;&quot; : &quot; (skipped)&quot;, block-&gt;isOSRTarget ? &quot; (OSR target)&quot; : &quot;&quot;, &quot;\n&quot;);
</ins><span class="cx">     if (block-&gt;executionCount == block-&gt;executionCount)
</span><span class="cx">         out.print(prefix, &quot;  Execution count: &quot;, block-&gt;executionCount, &quot;\n&quot;);
</span><span class="cx">     out.print(prefix, &quot;  Predecessors:&quot;);
</span><span class="lines">@@ -447,7 +447,12 @@
</span><span class="cx">         if (!block)
</span><span class="cx">             continue;
</span><span class="cx">         dumpBlockHeader(out, &quot;&quot;, block, DumpAllPhis, context);
</span><del>-        out.print(&quot;  States: &quot;, block-&gt;cfaStructureClobberStateAtHead, &quot;\n&quot;);
</del><ins>+        out.print(&quot;  States: &quot;, block-&gt;cfaStructureClobberStateAtHead);
+        if (!block-&gt;cfaHasVisited)
+            out.print(&quot;, CurrentlyCFAUnreachable&quot;);
+        if (!block-&gt;intersectionOfCFAHasVisited)
+            out.print(&quot;, CFAUnreachable&quot;);
+        out.print(&quot;\n&quot;);
</ins><span class="cx">         switch (m_form) {
</span><span class="cx">         case LoadStore:
</span><span class="cx">         case ThreadedCPS: {
</span><span class="lines">@@ -457,6 +462,12 @@
</span><span class="cx">             else
</span><span class="cx">                 out.print(&quot;&lt;empty&gt;&quot;);
</span><span class="cx">             out.print(&quot;\n&quot;);
</span><ins>+            out.print(&quot;  Intersected Vars Before: &quot;);
+            if (block-&gt;intersectionOfCFAHasVisited)
+                out.print(inContext(block-&gt;intersectionOfPastValuesAtHead, context));
+            else
+                out.print(&quot;&lt;empty&gt;&quot;);
+            out.print(&quot;\n&quot;);
</ins><span class="cx">             out.print(&quot;  Var Links: &quot;, block-&gt;variablesAtHead, &quot;\n&quot;);
</span><span class="cx">             break;
</span><span class="cx">         }
</span><span class="lines">@@ -473,7 +484,10 @@
</span><span class="cx">             dump(out, &quot;&quot;, block-&gt;at(i), context);
</span><span class="cx">             lastNode = block-&gt;at(i);
</span><span class="cx">         }
</span><del>-        out.print(&quot;  States: &quot;, block-&gt;cfaBranchDirection, &quot;, &quot;, block-&gt;cfaStructureClobberStateAtTail, &quot;\n&quot;);
</del><ins>+        out.print(&quot;  States: &quot;, block-&gt;cfaBranchDirection, &quot;, &quot;, block-&gt;cfaStructureClobberStateAtTail);
+        if (!block-&gt;cfaDidFinish)
+            out.print(&quot;, CFAInvalidated&quot;);
+        out.print(&quot;\n&quot;);
</ins><span class="cx">         switch (m_form) {
</span><span class="cx">         case LoadStore:
</span><span class="cx">         case ThreadedCPS: {
</span></span></pre></div>
<a id="branchesftloptSourceJavaScriptCoredfgDFGJITCompilerh"></a>
<div class="modfile"><h4>Modified: branches/ftlopt/Source/JavaScriptCore/dfg/DFGJITCompiler.h (170015 => 170016)</h4>
<pre class="diff"><span>
<span class="info">--- branches/ftlopt/Source/JavaScriptCore/dfg/DFGJITCompiler.h        2014-06-16 17:41:40 UTC (rev 170015)
+++ branches/ftlopt/Source/JavaScriptCore/dfg/DFGJITCompiler.h        2014-06-16 18:03:04 UTC (rev 170016)
</span><span class="lines">@@ -270,12 +270,12 @@
</span><span class="cx">     void noticeOSREntry(BasicBlock&amp; basicBlock, JITCompiler::Label blockHead, LinkBuffer&amp; linkBuffer)
</span><span class="cx">     {
</span><span class="cx">         // OSR entry is not allowed into blocks deemed unreachable by control flow analysis.
</span><del>-        if (!basicBlock.cfaHasVisited)
</del><ins>+        if (!basicBlock.intersectionOfCFAHasVisited)
</ins><span class="cx">             return;
</span><span class="cx">         
</span><span class="cx">         OSREntryData* entry = m_jitCode-&gt;appendOSREntryData(basicBlock.bytecodeBegin, linkBuffer.offsetOf(blockHead));
</span><span class="cx">         
</span><del>-        entry-&gt;m_expectedValues = basicBlock.valuesAtHead;
</del><ins>+        entry-&gt;m_expectedValues = basicBlock.intersectionOfPastValuesAtHead;
</ins><span class="cx">         
</span><span class="cx">         // Fix the expected values: in our protocol, a dead variable will have an expected
</span><span class="cx">         // value of (None, []). But the old JIT may stash some values there. So we really
</span></span></pre></div>
<a id="branchesftloptSourceJavaScriptCoredfgDFGSpeculativeJITcpp"></a>
<div class="modfile"><h4>Modified: branches/ftlopt/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp (170015 => 170016)</h4>
<pre class="diff"><span>
<span class="info">--- branches/ftlopt/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp        2014-06-16 17:41:40 UTC (rev 170015)
+++ branches/ftlopt/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp        2014-06-16 18:03:04 UTC (rev 170016)
</span><span class="lines">@@ -1353,7 +1353,7 @@
</span><span class="cx">     
</span><span class="cx">     m_jit.blockHeads()[m_block-&gt;index] = m_jit.label();
</span><span class="cx"> 
</span><del>-    if (!m_block-&gt;cfaHasVisited) {
</del><ins>+    if (!m_block-&gt;intersectionOfCFAHasVisited) {
</ins><span class="cx">         // Don't generate code for basic blocks that are unreachable according to CFA.
</span><span class="cx">         // But to be sure that nobody has generated a jump to this block, drop in a
</span><span class="cx">         // breakpoint here.
</span></span></pre>
</div>
</div>

</body>
</html>