Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Unified Diff: src/compiler/graph.cc

Issue 2447993002: [wasm] Debug-time print for compiler graph (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/graph.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/compiler/graph.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698