fourthTier: Make Graph::substituteGetLocal() out-of-line
authoroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Jul 2013 04:04:09 +0000 (04:04 +0000)
committeroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Jul 2013 04:04:09 +0000 (04:04 +0000)
Rubber stamped by Geoffrey Garen.

* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::substituteGetLocal):
(DFG):
* dfg/DFGGraph.h:
(Graph):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153258 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/dfg/DFGGraph.cpp
Source/JavaScriptCore/dfg/DFGGraph.h

index 4bca5f6..7205959 100644 (file)
@@ -1,5 +1,17 @@
 2013-06-27  Filip Pizlo  <fpizlo@apple.com>
 
+        Make Graph::substituteGetLocal() out-of-line
+
+        Rubber stamped by Geoffrey Garen.
+
+        * dfg/DFGGraph.cpp:
+        (JSC::DFG::Graph::substituteGetLocal):
+        (DFG):
+        * dfg/DFGGraph.h:
+        (Graph):
+
+2013-06-27  Filip Pizlo  <fpizlo@apple.com>
+
         fourthTier: DFG should know how to find natural loops
         https://bugs.webkit.org/show_bug.cgi?id=118152
 
index 5d66bad..93f8c55 100644 (file)
@@ -465,6 +465,41 @@ void Graph::invalidateCFG()
     m_naturalLoops.invalidate();
 }
 
+void Graph::substituteGetLocal(BasicBlock& block, unsigned startIndexInBlock, VariableAccessData* variableAccessData, Node* newGetLocal)
+{
+    if (variableAccessData->isCaptured()) {
+        // Let CSE worry about this one.
+        return;
+    }
+    for (unsigned indexInBlock = startIndexInBlock; indexInBlock < block.size(); ++indexInBlock) {
+        Node* node = block[indexInBlock];
+        bool shouldContinue = true;
+        switch (node->op()) {
+        case SetLocal: {
+            if (node->local() == variableAccessData->local())
+                shouldContinue = false;
+            break;
+        }
+                
+        case GetLocal: {
+            if (node->variableAccessData() != variableAccessData)
+                continue;
+            substitute(block, indexInBlock, node, newGetLocal);
+            Node* oldTailNode = block.variablesAtTail.operand(variableAccessData->local());
+            if (oldTailNode == node)
+                block.variablesAtTail.operand(variableAccessData->local()) = newGetLocal;
+            shouldContinue = false;
+            break;
+        }
+                
+        default:
+            break;
+        }
+        if (!shouldContinue)
+            break;
+    }
+}
+    
 } } // namespace JSC::DFG
 
 #endif
index 89c66b4..5aceaf7 100644 (file)
@@ -647,40 +647,7 @@ public:
     // any GetLocals in the basic block.
     // FIXME: it may be appropriate, in the future, to generalize this to handle GetLocals
     // introduced anywhere in the basic block.
-    void substituteGetLocal(BasicBlock& block, unsigned startIndexInBlock, VariableAccessData* variableAccessData, Node* newGetLocal)
-    {
-        if (variableAccessData->isCaptured()) {
-            // Let CSE worry about this one.
-            return;
-        }
-        for (unsigned indexInBlock = startIndexInBlock; indexInBlock < block.size(); ++indexInBlock) {
-            Node* node = block[indexInBlock];
-            bool shouldContinue = true;
-            switch (node->op()) {
-            case SetLocal: {
-                if (node->local() == variableAccessData->local())
-                    shouldContinue = false;
-                break;
-            }
-                
-            case GetLocal: {
-                if (node->variableAccessData() != variableAccessData)
-                    continue;
-                substitute(block, indexInBlock, node, newGetLocal);
-                Node* oldTailNode = block.variablesAtTail.operand(variableAccessData->local());
-                if (oldTailNode == node)
-                    block.variablesAtTail.operand(variableAccessData->local()) = newGetLocal;
-                shouldContinue = false;
-                break;
-            }
-                
-            default:
-                break;
-            }
-            if (!shouldContinue)
-                break;
-        }
-    }
+    void substituteGetLocal(BasicBlock& block, unsigned startIndexInBlock, VariableAccessData* variableAccessData, Node* newGetLocal);
     
     void invalidateCFG();