Index: src/compiler/graph-replay.cc |
diff --git a/src/compiler/graph-replay.cc b/src/compiler/graph-replay.cc |
index 3a0b7836fcba8a2c33929f86761ab7ca01891e36..06771ff8244d4cb21c64ce3469f0653fea1405a6 100644 |
--- a/src/compiler/graph-replay.cc |
+++ b/src/compiler/graph-replay.cc |
@@ -4,9 +4,9 @@ |
#include "src/compiler/graph-replay.h" |
+#include "src/compiler/all-nodes.h" |
#include "src/compiler/common-operator.h" |
#include "src/compiler/graph.h" |
-#include "src/compiler/graph-inl.h" |
#include "src/compiler/node.h" |
#include "src/compiler/operator.h" |
#include "src/compiler/operator-properties.h" |
@@ -20,22 +20,26 @@ namespace compiler { |
void GraphReplayPrinter::PrintReplay(Graph* graph) { |
GraphReplayPrinter replay; |
PrintF(" Node* nil = graph.NewNode(common_builder.Dead());\n"); |
- graph->VisitNodeInputsFromEnd(&replay); |
-} |
- |
+ Zone zone; |
+ AllNodes nodes(&zone, graph); |
-void GraphReplayPrinter::Pre(Node* node) { |
- PrintReplayOpCreator(node->op()); |
- PrintF(" Node* n%d = graph.NewNode(op", node->id()); |
- for (int i = 0; i < node->InputCount(); ++i) { |
- PrintF(", nil"); |
+ // Allocate the nodes first. |
+ for (Node* node : nodes.live) { |
+ PrintReplayOpCreator(node->op()); |
+ PrintF(" Node* n%d = graph.NewNode(op", node->id()); |
+ for (int i = 0; i < node->InputCount(); ++i) { |
+ PrintF(", nil"); |
+ } |
+ PrintF("); USE(n%d);\n", node->id()); |
} |
- PrintF("); USE(n%d);\n", node->id()); |
-} |
- |
-void GraphReplayPrinter::PostEdge(Node* from, int index, Node* to) { |
- PrintF(" n%d->ReplaceInput(%d, n%d);\n", from->id(), index, to->id()); |
+ // Connect the nodes to their inputs. |
+ for (Node* node : nodes.live) { |
+ for (int i = 0; i < node->InputCount(); i++) { |
+ PrintF(" n%d->ReplaceInput(%d, n%d);\n", node->id(), i, |
+ node->InputAt(i)->id()); |
+ } |
+ } |
} |