Chromium Code Reviews| Index: src/compiler/graph.cc |
| diff --git a/src/compiler/graph.cc b/src/compiler/graph.cc |
| index ff1a17ef3ea9457d79843f5406395e9538cf8a6c..e85ffea46bbd3967a004699313b3b5b313fb31c7 100644 |
| --- a/src/compiler/graph.cc |
| +++ b/src/compiler/graph.cc |
| @@ -2,13 +2,13 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "src/compiler/graph.h" |
|
Michael Starzinger
2016/10/25 09:16:03
nit: Please keep the graph.h include at the top wi
Mircea Trofin
2016/10/25 15:27:19
Done.
|
| - |
| #include <algorithm> |
| #include "src/base/bits.h" |
| -#include "src/compiler/node.h" |
| +#include "src/compiler/all-nodes.h" |
| +#include "src/compiler/graph.h" |
| #include "src/compiler/node-properties.h" |
| +#include "src/compiler/node.h" |
| #include "src/compiler/verifier.h" |
| namespace v8 { |
| @@ -72,6 +72,16 @@ NodeId Graph::NextNodeId() { |
| return id; |
| } |
| +void Graph::Print() const { |
| + AllNodes all(zone(), this); |
| + // Get all the nodes in a map keyed by their ID. That ensures we have them |
| + // sorted by ID, which makes it easy to find nodes (e.g. inputs) by their |
| + // ID, in the printout. |
| + std::map<int, Node*> map; |
| + for (Node* node : all.reachable) map.insert(std::make_pair(node->id(), node)); |
| + for (auto& pair : map) pair.second->Print(); |
|
Michael Starzinger
2016/10/25 09:16:03
How would you feel about using "OFStream os(stdout
Mircea Trofin
2016/10/25 15:27:19
Happy to, and done - it is unfortunate the API isn
|
| +} |
| + |
| } // namespace compiler |
| } // namespace internal |
| } // namespace v8 |