No subject


Tue Jan 27 15:54:36 PST 2015


but it likely just noise.

* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::setDirect):
(JSC::DFG::ByteCodeParser::setLocal):
(JSC::DFG::ByteCodeParser::setArgument):
(JSC::DFG::ByteCodeParser::currentNodeOrigin):
(JSC::DFG::ByteCodeParser::addToGraph):
(JSC::DFG::ByteCodeParser::DelayedSetLocal::DelayedSetLocal):
(JSC::DFG::ByteCodeParser::DelayedSetLocal::execute):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGByteCodeParsercpp">trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (180545 => 180546)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog	2015-02-24 03:32:03 UTC (rev 180545)
+++ trunk/Source/JavaScriptCore/ChangeLog	2015-02-24 03:33:01 UTC (rev 180546)
</span><span class="lines">@@ -1,5 +1,32 @@
</span><span class="cx"> 2015-02-23  Benjamin Poulain  &lt;bpoulain at apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Set the semantic origin of delayed SetLocal to the Bytecode that originated it
+        https://bugs.webkit.org/show_bug.cgi?id=141727
+
+        Reviewed by Filip Pizlo.
+
+        Previously, delayed SetLocals would have the NodeOrigin of the next
+        bytecode. This was because delayed SetLocal are...delayed... and
+        currentCodeOrigin() is the one where the node is emitted.
+
+        This made debugging a little awkward since the OSR exits on SetLocal
+        were reported for the next bytecode. This patch changes the semantic
+        origin to keep the original bytecode.
+
+        From benchmarks, this looks like it could be a tiny bit faster
+        but it likely just noise.
+
+        * dfg/DFGByteCodeParser.cpp:
+        (JSC::DFG::ByteCodeParser::setDirect):
+        (JSC::DFG::ByteCodeParser::setLocal):
+        (JSC::DFG::ByteCodeParser::setArgument):
+        (JSC::DFG::ByteCodeParser::currentNodeOrigin):
+        (JSC::DFG::ByteCodeParser::addToGraph):
+        (JSC::DFG::ByteCodeParser::DelayedSetLocal::DelayedSetLocal):
+        (JSC::DFG::ByteCodeParser::DelayedSetLocal::execute):
+
+2015-02-23  Benjamin Poulain  &lt;bpoulain at apple.com&gt;
+
</ins><span class="cx">         Remove DFGNode::predictHeap()
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=141864
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGByteCodeParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp (180545 => 180546)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp	2015-02-24 03:32:03 UTC (rev 180545)
+++ trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp	2015-02-24 03:33:01 UTC (rev 180546)
</span><span class="lines">@@ -301,9 +301,9 @@
</span><span class="cx">     Node* setDirect(VirtualRegister operand, Node* value, SetMode setMode = NormalSet)
</span><span class="cx">     {
</span><span class="cx">         addToGraph(MovHint, OpInfo(operand.offset()), value);
</span><ins>+
+        DelayedSetLocal delayed(currentCodeOrigin(), operand, value);
</ins><span class="cx">         
</span><del>-        DelayedSetLocal delayed = DelayedSetLocal(operand, value);
-        
</del><span class="cx">         if (setMode == NormalSet) {
</span><span class="cx">             m_setLocalQueue.append(delayed);
</span><span class="cx">             return 0;
</span><span class="lines">@@ -383,8 +383,11 @@
</span><span class="cx">         return node;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    Node* setLocal(VirtualRegister operand, Node* value, SetMode setMode = NormalSet)
</del><ins>+    Node* setLocal(const CodeOrigin&amp; semanticOrigin, VirtualRegister operand, Node* value, SetMode setMode = NormalSet)
</ins><span class="cx">     {
</span><ins>+        CodeOrigin oldSemanticOrigin = m_currentSemanticOrigin;
+        m_currentSemanticOrigin = semanticOrigin;
+
</ins><span class="cx">         unsigned local = operand.toLocal();
</span><span class="cx">         bool isCaptured = m_codeBlock-&gt;isCaptured(operand, inlineCallFrame());
</span><span class="cx">         
</span><span class="lines">@@ -396,11 +399,13 @@
</span><span class="cx"> 
</span><span class="cx">         VariableAccessData* variableAccessData = newVariableAccessData(operand, isCaptured);
</span><span class="cx">         variableAccessData-&gt;mergeStructureCheckHoistingFailed(
</span><del>-            m_inlineStackTop-&gt;m_exitProfile.hasExitSite(m_currentIndex, BadCache));
</del><ins>+            m_inlineStackTop-&gt;m_exitProfile.hasExitSite(semanticOrigin.bytecodeIndex, BadCache));
</ins><span class="cx">         variableAccessData-&gt;mergeCheckArrayHoistingFailed(
</span><del>-            m_inlineStackTop-&gt;m_exitProfile.hasExitSite(m_currentIndex, BadIndexingType));
</del><ins>+            m_inlineStackTop-&gt;m_exitProfile.hasExitSite(semanticOrigin.bytecodeIndex, BadIndexingType));
</ins><span class="cx">         Node* node = addToGraph(SetLocal, OpInfo(variableAccessData), value);
</span><span class="cx">         m_currentBlock-&gt;variablesAtTail.local(local) = node;
</span><ins>+
+        m_currentSemanticOrigin = oldSemanticOrigin;
</ins><span class="cx">         return node;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -436,8 +441,11 @@
</span><span class="cx">         m_currentBlock-&gt;variablesAtTail.argument(argument) = node;
</span><span class="cx">         return node;
</span><span class="cx">     }
</span><del>-    Node* setArgument(VirtualRegister operand, Node* value, SetMode setMode = NormalSet)
</del><ins>+    Node* setArgument(const CodeOrigin&amp; semanticOrigin, VirtualRegister operand, Node* value, SetMode setMode = NormalSet)
</ins><span class="cx">     {
</span><ins>+        CodeOrigin oldSemanticOrigin = m_currentSemanticOrigin;
+        m_currentSemanticOrigin = semanticOrigin;
+
</ins><span class="cx">         unsigned argument = operand.toArgument();
</span><span class="cx">         ASSERT(argument &lt; m_numArguments);
</span><span class="cx">         
</span><span class="lines">@@ -454,11 +462,13 @@
</span><span class="cx">             variableAccessData-&gt;mergeShouldNeverUnbox(true);
</span><span class="cx">         
</span><span class="cx">         variableAccessData-&gt;mergeStructureCheckHoistingFailed(
</span><del>-            m_inlineStackTop-&gt;m_exitProfile.hasExitSite(m_currentIndex, BadCache));
</del><ins>+            m_inlineStackTop-&gt;m_exitProfile.hasExitSite(semanticOrigin.bytecodeIndex, BadCache));
</ins><span class="cx">         variableAccessData-&gt;mergeCheckArrayHoistingFailed(
</span><del>-            m_inlineStackTop-&gt;m_exitProfile.hasExitSite(m_currentIndex, BadIndexingType));
</del><ins>+            m_inlineStackTop-&gt;m_exitProfile.hasExitSite(semanticOrigin.bytecodeIndex, BadIndexingType));
</ins><span class="cx">         Node* node = addToGraph(SetLocal, OpInfo(variableAccessData), value);
</span><span class="cx">         m_currentBlock-&gt;variablesAtTail.argument(argument) = node;
</span><ins>+
+        m_currentSemanticOrigin = oldSemanticOrigin;
</ins><span class="cx">         return node;
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="lines">@@ -602,6 +612,13 @@
</span><span class="cx">     {
</span><span class="cx">         return CodeOrigin(m_currentIndex, inlineCallFrame());
</span><span class="cx">     }
</span><ins>+
+    NodeOrigin currentNodeOrigin()
+    {
+        if (m_currentSemanticOrigin.isSet())
+            return NodeOrigin(m_currentSemanticOrigin, currentCodeOrigin());
+        return NodeOrigin(currentCodeOrigin());
+    }
</ins><span class="cx">     
</span><span class="cx">     BranchData* branchData(unsigned taken, unsigned notTaken)
</span><span class="cx">     {
</span><span class="lines">@@ -616,7 +633,7 @@
</span><span class="cx">     Node* addToGraph(NodeType op, Node* child1 = 0, Node* child2 = 0, Node* child3 = 0)
</span><span class="cx">     {
</span><span class="cx">         Node* result = m_graph.addNode(
</span><del>-            SpecNone, op, NodeOrigin(currentCodeOrigin()), Edge(child1), Edge(child2),
</del><ins>+            SpecNone, op, currentNodeOrigin(), Edge(child1), Edge(child2),
</ins><span class="cx">             Edge(child3));
</span><span class="cx">         ASSERT(op != Phi);
</span><span class="cx">         m_currentBlock-&gt;append(result);
</span><span class="lines">@@ -625,7 +642,7 @@
</span><span class="cx">     Node* addToGraph(NodeType op, Edge child1, Edge child2 = Edge(), Edge child3 = Edge())
</span><span class="cx">     {
</span><span class="cx">         Node* result = m_graph.addNode(
</span><del>-            SpecNone, op, NodeOrigin(currentCodeOrigin()), child1, child2, child3);
</del><ins>+            SpecNone, op, currentNodeOrigin(), child1, child2, child3);
</ins><span class="cx">         ASSERT(op != Phi);
</span><span class="cx">         m_currentBlock-&gt;append(result);
</span><span class="cx">         return result;
</span><span class="lines">@@ -633,7 +650,7 @@
</span><span class="cx">     Node* addToGraph(NodeType op, OpInfo info, Node* child1 = 0, Node* child2 = 0, Node* child3 = 0)
</span><span class="cx">     {
</span><span class="cx">         Node* result = m_graph.addNode(
</span><del>-            SpecNone, op, NodeOrigin(currentCodeOrigin()), info, Edge(child1), Edge(child2),
</del><ins>+            SpecNone, op, currentNodeOrigin(), info, Edge(child1), Edge(child2),
</ins><span class="cx">             Edge(child3));
</span><span class="cx">         ASSERT(op != Phi);
</span><span class="cx">         m_currentBlock-&gt;append(result);
</span><span class="lines">@@ -642,7 +659,7 @@
</span><span class="cx">     Node* addToGraph(NodeType op, OpInfo info1, OpInfo info2, Node* child1 = 0, Node* child2 = 0, Node* child3 = 0)
</span><span class="cx">     {
</span><span class="cx">         Node* result = m_graph.addNode(
</span><del>-            SpecNone, op, NodeOrigin(currentCodeOrigin()), info1, info2,
</del><ins>+            SpecNone, op, currentNodeOrigin(), info1, info2,
</ins><span class="cx">             Edge(child1), Edge(child2), Edge(child3));
</span><span class="cx">         ASSERT(op != Phi);
</span><span class="cx">         m_currentBlock-&gt;append(result);
</span><span class="lines">@@ -652,7 +669,7 @@
</span><span class="cx">     Node* addToGraph(Node::VarArgTag, NodeType op, OpInfo info1, OpInfo info2)
</span><span class="cx">     {
</span><span class="cx">         Node* result = m_graph.addNode(
</span><del>-            SpecNone, Node::VarArg, op, NodeOrigin(currentCodeOrigin()), info1, info2,
</del><ins>+            SpecNone, Node::VarArg, op, currentNodeOrigin(), info1, info2,
</ins><span class="cx">             m_graph.m_varArgChildren.size() - m_numPassedVarArgs, m_numPassedVarArgs);
</span><span class="cx">         ASSERT(op != Phi);
</span><span class="cx">         m_currentBlock-&gt;append(result);
</span><span class="lines">@@ -844,6 +861,8 @@
</span><span class="cx">     BasicBlock* m_currentBlock;
</span><span class="cx">     // The bytecode index of the current instruction being generated.
</span><span class="cx">     unsigned m_currentIndex;
</span><ins>+    // The semantic origin of the current node if different from the current Index.
+    CodeOrigin m_currentSemanticOrigin;
</ins><span class="cx"> 
</span><span class="cx">     FrozenValue* m_constantUndefined;
</span><span class="cx">     FrozenValue* m_constantNull;
</span><span class="lines">@@ -962,12 +981,14 @@
</span><span class="cx">     InlineStackEntry* m_inlineStackTop;
</span><span class="cx">     
</span><span class="cx">     struct DelayedSetLocal {
</span><ins>+        CodeOrigin m_origin;
</ins><span class="cx">         VirtualRegister m_operand;
</span><span class="cx">         Node* m_value;
</span><span class="cx">         
</span><span class="cx">         DelayedSetLocal() { }
</span><del>-        DelayedSetLocal(VirtualRegister operand, Node* value)
-            : m_operand(operand)
</del><ins>+        DelayedSetLocal(const CodeOrigin&amp; origin, VirtualRegister operand, Node* value)
+            : m_origin(origin)
+            , m_operand(operand)
</ins><span class="cx">             , m_value(value)
</span><span class="cx">         {
</span><span class="cx">         }
</span><span class="lines">@@ -975,8 +996,8 @@
</span><span class="cx">         Node* execute(ByteCodeParser* parser, SetMode setMode = NormalSet)
</span><span class="cx">         {
</span><span class="cx">             if (m_operand.isArgument())
</span><del>-                return parser-&gt;setArgument(m_operand, m_value, setMode);
-            return parser-&gt;setLocal(m_operand, m_value, setMode);
</del><ins>+                return parser-&gt;setArgument(m_origin, m_operand, m_value, setMode);
+            return parser-&gt;setLocal(m_origin, m_operand, m_value, setMode);
</ins><span class="cx">         }
</span><span class="cx">     };
</span><span class="cx">     
</span></span></pre>
</div>
</div>

</body>
</html>


More information about the webkit-changes mailing list