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

Unified Diff: src/compiler/graph-visualizer.cc

Issue 1514323002: [tubofan] Remove .dot output of --trace-turbo (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix tests Created 5 years 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-visualizer.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/graph-visualizer.cc
diff --git a/src/compiler/graph-visualizer.cc b/src/compiler/graph-visualizer.cc
index 1b0997a6bd899b23164bf0a4167fb39f204887bd..36462e85c8fe08479a3e9cc29c2be72ee4818211 100644
--- a/src/compiler/graph-visualizer.cc
+++ b/src/compiler/graph-visualizer.cc
@@ -207,190 +207,6 @@ std::ostream& operator<<(std::ostream& os, const AsJSON& ad) {
}
-class GraphVisualizer {
- public:
- GraphVisualizer(std::ostream& os, Zone* zone, const Graph* graph)
- : all_(zone, graph), os_(os) {}
-
- void Print();
-
- void PrintNode(Node* node, bool gray);
-
- private:
- void PrintEdge(Edge edge);
-
- AllNodes all_;
- std::ostream& os_;
-
- DISALLOW_COPY_AND_ASSIGN(GraphVisualizer);
-};
-
-
-static Node* GetControlCluster(Node* node) {
- if (OperatorProperties::IsBasicBlockBegin(node->op())) {
- return node;
- } else if (node->op()->ControlInputCount() == 1) {
- Node* control = NodeProperties::GetControlInput(node, 0);
- return control != NULL &&
- OperatorProperties::IsBasicBlockBegin(control->op())
- ? control
- : NULL;
- } else {
- return NULL;
- }
-}
-
-
-void GraphVisualizer::PrintNode(Node* node, bool gray) {
- Node* control_cluster = GetControlCluster(node);
- if (control_cluster != NULL) {
- os_ << " subgraph cluster_BasicBlock" << control_cluster->id() << " {\n";
- }
- os_ << " ID" << SafeId(node) << " [\n";
-
- os_ << " shape=\"record\"\n";
- switch (node->opcode()) {
- case IrOpcode::kEnd:
- case IrOpcode::kDead:
- case IrOpcode::kStart:
- os_ << " style=\"diagonals\"\n";
- break;
- case IrOpcode::kMerge:
- case IrOpcode::kIfTrue:
- case IrOpcode::kIfFalse:
- case IrOpcode::kLoop:
- os_ << " style=\"rounded\"\n";
- break;
- default:
- break;
- }
-
- if (gray) {
- os_ << " style=\"filled\"\n"
- << " fillcolor=\"" DEAD_COLOR "\"\n";
- }
-
- std::ostringstream label;
- label << *node->op();
- os_ << " label=\"{{#" << SafeId(node) << ":" << Escaped(label);
-
- auto i = node->input_edges().begin();
- for (int j = node->op()->ValueInputCount(); j > 0; ++i, j--) {
- os_ << "|<I" << (*i).index() << ">#" << SafeId((*i).to());
- }
- for (int j = OperatorProperties::GetContextInputCount(node->op()); j > 0;
- ++i, j--) {
- os_ << "|<I" << (*i).index() << ">X #" << SafeId((*i).to());
- }
- for (int j = OperatorProperties::GetFrameStateInputCount(node->op()); j > 0;
- ++i, j--) {
- os_ << "|<I" << (*i).index() << ">F #" << SafeId((*i).to());
- }
- for (int j = node->op()->EffectInputCount(); j > 0; ++i, j--) {
- os_ << "|<I" << (*i).index() << ">E #" << SafeId((*i).to());
- }
-
- if (OperatorProperties::IsBasicBlockBegin(node->op()) ||
- GetControlCluster(node) == NULL) {
- for (int j = node->op()->ControlInputCount(); j > 0; ++i, j--) {
- os_ << "|<I" << (*i).index() << ">C #" << SafeId((*i).to());
- }
- }
- os_ << "}";
-
- if (FLAG_trace_turbo_types && NodeProperties::IsTyped(node)) {
- Type* type = NodeProperties::GetType(node);
- std::ostringstream type_out;
- type->PrintTo(type_out);
- os_ << "|" << Escaped(type_out);
- }
- os_ << "}\"\n";
-
- os_ << " ]\n";
- if (control_cluster != NULL) os_ << " }\n";
-}
-
-
-static bool IsLikelyBackEdge(Node* from, int index, Node* to) {
- if (NodeProperties::IsPhi(from)) {
- Node* control = NodeProperties::GetControlInput(from, 0);
- return control != NULL && control->opcode() != IrOpcode::kMerge &&
- control != to && index != 0;
- } else if (from->opcode() == IrOpcode::kLoop) {
- return index != 0;
- } else {
- return false;
- }
-}
-
-
-void GraphVisualizer::PrintEdge(Edge edge) {
- Node* from = edge.from();
- int index = edge.index();
- Node* to = edge.to();
-
- if (!all_.IsLive(to)) return; // skip inputs that point to dead or NULL.
-
- bool unconstrained = IsLikelyBackEdge(from, index, to);
- os_ << " ID" << SafeId(from);
-
- if (OperatorProperties::IsBasicBlockBegin(from->op()) ||
- GetControlCluster(from) == NULL ||
- (from->op()->ControlInputCount() > 0 &&
- NodeProperties::GetControlInput(from) != to)) {
- os_ << ":I" << index << ":n -> ID" << SafeId(to) << ":s"
- << "[" << (unconstrained ? "constraint=false, " : "")
- << (NodeProperties::IsControlEdge(edge) ? "style=bold, " : "")
- << (NodeProperties::IsEffectEdge(edge) ? "style=dotted, " : "")
- << (NodeProperties::IsContextEdge(edge) ? "style=dashed, " : "") << "]";
- } else {
- os_ << " -> ID" << SafeId(to) << ":s [color=transparent, "
- << (unconstrained ? "constraint=false, " : "")
- << (NodeProperties::IsControlEdge(edge) ? "style=dashed, " : "") << "]";
- }
- os_ << "\n";
-}
-
-
-void GraphVisualizer::Print() {
- os_ << "digraph D {\n"
- << " node [fontsize=8,height=0.25]\n"
- << " rankdir=\"BT\"\n"
- << " ranksep=\"1.2 equally\"\n"
- << " overlap=\"false\"\n"
- << " splines=\"true\"\n"
- << " concentrate=\"true\"\n"
- << " \n";
-
- // Find all nodes that are not reachable from end that use live nodes.
- std::set<Node*> gray;
- for (Node* const node : all_.live) {
- for (Node* const use : node->uses()) {
- if (!all_.IsLive(use)) gray.insert(use);
- }
- }
-
- // Make sure all nodes have been output before writing out the edges.
- for (Node* const node : all_.live) PrintNode(node, false);
- for (Node* const node : gray) PrintNode(node, true);
-
- // With all the nodes written, add the edges.
- for (Node* const node : all_.live) {
- for (Edge edge : node->use_edges()) {
- PrintEdge(edge);
- }
- }
- os_ << "}\n";
-}
-
-
-std::ostream& operator<<(std::ostream& os, const AsDOT& ad) {
- Zone tmp_zone;
- GraphVisualizer(os, &tmp_zone, &ad.graph).Print();
- return os;
-}
-
-
class GraphC1Visualizer {
public:
GraphC1Visualizer(std::ostream& os, Zone* zone); // NOLINT
« no previous file with comments | « src/compiler/graph-visualizer.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698