Title: [139586] trunk/Source/_javascript_Core
Revision
139586
Author
[email protected]
Date
2013-01-13 22:58:57 -0800 (Sun, 13 Jan 2013)

Log Message

DFG phases that store per-node information should store it in Node itself rather than using a secondary vector
https://bugs.webkit.org/show_bug.cgi?id=106753

Reviewed by Geoffrey Garen.

* dfg/DFGAbstractState.cpp:
(JSC::DFG::AbstractState::AbstractState):
(JSC::DFG::AbstractState::beginBasicBlock):
(JSC::DFG::AbstractState::dump):
* dfg/DFGAbstractState.h:
(JSC::DFG::AbstractState::forNode):
(AbstractState):
* dfg/DFGCFGSimplificationPhase.cpp:
* dfg/DFGCSEPhase.cpp:
(JSC::DFG::CSEPhase::CSEPhase):
(JSC::DFG::CSEPhase::performSubstitution):
(JSC::DFG::CSEPhase::setReplacement):
(CSEPhase):
* dfg/DFGNode.h:
(Node):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (139585 => 139586)


--- trunk/Source/_javascript_Core/ChangeLog	2013-01-14 06:33:21 UTC (rev 139585)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-01-14 06:58:57 UTC (rev 139586)
@@ -1,3 +1,26 @@
+2013-01-13  Filip Pizlo  <[email protected]>
+
+        DFG phases that store per-node information should store it in Node itself rather than using a secondary vector
+        https://bugs.webkit.org/show_bug.cgi?id=106753
+
+        Reviewed by Geoffrey Garen.
+
+        * dfg/DFGAbstractState.cpp:
+        (JSC::DFG::AbstractState::AbstractState):
+        (JSC::DFG::AbstractState::beginBasicBlock):
+        (JSC::DFG::AbstractState::dump):
+        * dfg/DFGAbstractState.h:
+        (JSC::DFG::AbstractState::forNode):
+        (AbstractState):
+        * dfg/DFGCFGSimplificationPhase.cpp:
+        * dfg/DFGCSEPhase.cpp:
+        (JSC::DFG::CSEPhase::CSEPhase):
+        (JSC::DFG::CSEPhase::performSubstitution):
+        (JSC::DFG::CSEPhase::setReplacement):
+        (CSEPhase):
+        * dfg/DFGNode.h:
+        (Node):
+
 2013-01-12  Tim Horton  <[email protected]>
 
         Unreviewed build fix.

Modified: trunk/Source/_javascript_Core/dfg/DFGAbstractState.cpp (139585 => 139586)


--- trunk/Source/_javascript_Core/dfg/DFGAbstractState.cpp	2013-01-14 06:33:21 UTC (rev 139585)
+++ trunk/Source/_javascript_Core/dfg/DFGAbstractState.cpp	2013-01-14 06:58:57 UTC (rev 139586)
@@ -42,7 +42,6 @@
     , m_variables(m_codeBlock->numParameters(), graph.m_localVars)
     , m_block(0)
 {
-    m_nodes.resize(graph.size());
 }
 
 AbstractState::~AbstractState() { }
@@ -55,12 +54,8 @@
     ASSERT(basicBlock->variablesAtTail.numberOfLocals() == basicBlock->valuesAtTail.numberOfLocals());
     ASSERT(basicBlock->variablesAtHead.numberOfLocals() == basicBlock->variablesAtTail.numberOfLocals());
     
-    // This is usually a no-op, but it is possible that the graph has grown since the
-    // abstract state was last used.
-    m_nodes.resize(m_graph.size());
-    
     for (size_t i = 0; i < basicBlock->size(); i++)
-        m_nodes[basicBlock->at(i)].clear();
+        forNode(basicBlock->at(i)).clear();
 
     m_variables = basicBlock->valuesAtHead;
     m_haveStructures = false;
@@ -2031,7 +2026,7 @@
     bool first = true;
     for (size_t i = 0; i < m_block->size(); ++i) {
         NodeIndex index = m_block->at(i);
-        AbstractValue& value = m_nodes[index];
+        AbstractValue& value = forNode(index);
         if (value.isClear())
             continue;
         if (first)

Modified: trunk/Source/_javascript_Core/dfg/DFGAbstractState.h (139585 => 139586)


--- trunk/Source/_javascript_Core/dfg/DFGAbstractState.h	2013-01-14 06:33:21 UTC (rev 139585)
+++ trunk/Source/_javascript_Core/dfg/DFGAbstractState.h	2013-01-14 06:58:57 UTC (rev 139586)
@@ -99,7 +99,7 @@
     
     AbstractValue& forNode(NodeIndex nodeIndex)
     {
-        return m_nodes[nodeIndex];
+        return m_graph[nodeIndex].value;
     }
     
     AbstractValue& forNode(Edge nodeUse)
@@ -262,7 +262,6 @@
     CodeBlock* m_codeBlock;
     Graph& m_graph;
     
-    Vector<AbstractValue, 64> m_nodes;
     Operands<AbstractValue> m_variables;
     BasicBlock* m_block;
     bool m_haveStructures;

Modified: trunk/Source/_javascript_Core/dfg/DFGCFGSimplificationPhase.cpp (139585 => 139586)


--- trunk/Source/_javascript_Core/dfg/DFGCFGSimplificationPhase.cpp	2013-01-14 06:33:21 UTC (rev 139585)
+++ trunk/Source/_javascript_Core/dfg/DFGCFGSimplificationPhase.cpp	2013-01-14 06:58:57 UTC (rev 139586)
@@ -34,6 +34,7 @@
 #include "DFGInsertionSet.h"
 #include "DFGPhase.h"
 #include "DFGValidate.h"
+#include "Operations.h"
 
 namespace JSC { namespace DFG {
 

Modified: trunk/Source/_javascript_Core/dfg/DFGCSEPhase.cpp (139585 => 139586)


--- trunk/Source/_javascript_Core/dfg/DFGCSEPhase.cpp	2013-01-14 06:33:21 UTC (rev 139585)
+++ trunk/Source/_javascript_Core/dfg/DFGCSEPhase.cpp	2013-01-14 06:58:57 UTC (rev 139586)
@@ -39,11 +39,8 @@
     CSEPhase(Graph& graph)
         : Phase(graph, "common subexpression elimination")
     {
-        // Replacements are used to implement local common subexpression elimination.
-        m_replacements.resize(m_graph.size());
-        
         for (unsigned i = 0; i < m_graph.size(); ++i)
-            m_replacements[i] = NoNode;
+            m_graph[i].replacement = NoNode;
         
         m_relevantToOSR.resize(m_graph.size());
     }
@@ -1005,7 +1002,7 @@
             return;
         
         // Check if there is any replacement.
-        NodeIndex replacement = m_replacements[child.index()];
+        NodeIndex replacement = m_graph[child.index()].replacement;
         if (replacement == NoNode)
             return;
         
@@ -1013,7 +1010,7 @@
         
         // There is definitely a replacement. Assert that the replacement does not
         // have a replacement.
-        ASSERT(m_replacements[child.index()] == NoNode);
+        ASSERT(m_graph[child.index()].replacement == NoNode);
         
         if (addRef)
             m_graph.ref(child);
@@ -1060,7 +1057,7 @@
         eliminateIrrelevantPhantomChildren(node);
         
         // At this point we will eliminate all references to this node.
-        m_replacements[m_compileIndex] = replacement;
+        m_graph[m_compileIndex].replacement = replacement;
         
         m_changed = true;
         
@@ -1459,7 +1456,6 @@
     BasicBlock* m_currentBlock;
     NodeIndex m_compileIndex;
     unsigned m_indexInBlock;
-    Vector<NodeIndex, 16> m_replacements;
     FixedArray<unsigned, LastNodeType> m_lastSeen;
     FastBitVector m_relevantToOSR;
     bool m_changed; // Only tracks changes that have a substantive effect on other optimizations.

Modified: trunk/Source/_javascript_Core/dfg/DFGNode.h (139585 => 139586)


--- trunk/Source/_javascript_Core/dfg/DFGNode.h	2013-01-14 06:33:21 UTC (rev 139585)
+++ trunk/Source/_javascript_Core/dfg/DFGNode.h	2013-01-14 06:58:57 UTC (rev 139586)
@@ -32,6 +32,7 @@
 
 #include "CodeBlock.h"
 #include "CodeOrigin.h"
+#include "DFGAbstractValue.h"
 #include "DFGAdjacencyList.h"
 #include "DFGArrayMode.h"
 #include "DFGCommon.h"
@@ -1192,6 +1193,11 @@
     unsigned m_opInfo2;
     // The prediction ascribed to this node after propagation.
     SpeculatedType m_prediction;
+
+public:
+    // Fields used by various analyses.
+    AbstractValue value;
+    NodeIndex replacement;
 };
 
 } } // namespace JSC::DFG
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to