OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/graph-visualizer.h" | 5 #include "src/compiler/graph-visualizer.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 void GraphVisualizer::Print() { | 354 void GraphVisualizer::Print() { |
355 os_ << "digraph D {\n" | 355 os_ << "digraph D {\n" |
356 << " node [fontsize=8,height=0.25]\n" | 356 << " node [fontsize=8,height=0.25]\n" |
357 << " rankdir=\"BT\"\n" | 357 << " rankdir=\"BT\"\n" |
358 << " ranksep=\"1.2 equally\"\n" | 358 << " ranksep=\"1.2 equally\"\n" |
359 << " overlap=\"false\"\n" | 359 << " overlap=\"false\"\n" |
360 << " splines=\"true\"\n" | 360 << " splines=\"true\"\n" |
361 << " concentrate=\"true\"\n" | 361 << " concentrate=\"true\"\n" |
362 << " \n"; | 362 << " \n"; |
363 | 363 |
| 364 // Find all nodes that are not reachable from end that use live nodes. |
| 365 std::set<Node*> gray; |
| 366 for (Node* const node : all_.live) { |
| 367 for (Node* const use : node->uses()) { |
| 368 if (!all_.IsLive(use)) gray.insert(use); |
| 369 } |
| 370 } |
| 371 |
364 // Make sure all nodes have been output before writing out the edges. | 372 // Make sure all nodes have been output before writing out the edges. |
365 for (Node* const node : all_.live) PrintNode(node, false); | 373 for (Node* const node : all_.live) PrintNode(node, false); |
366 for (Node* const node : all_.gray) PrintNode(node, true); | 374 for (Node* const node : gray) PrintNode(node, true); |
367 | 375 |
368 // With all the nodes written, add the edges. | 376 // With all the nodes written, add the edges. |
369 for (Node* const node : all_.live) { | 377 for (Node* const node : all_.live) { |
370 for (Edge edge : node->use_edges()) { | 378 for (Edge edge : node->use_edges()) { |
371 PrintEdge(edge); | 379 PrintEdge(edge); |
372 } | 380 } |
373 } | 381 } |
374 os_ << "}\n"; | 382 os_ << "}\n"; |
375 } | 383 } |
376 | 384 |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 os << "#" << SafeId(i) << ":" << SafeMnemonic(i); | 815 os << "#" << SafeId(i) << ":" << SafeMnemonic(i); |
808 } | 816 } |
809 os << ")" << std::endl; | 817 os << ")" << std::endl; |
810 } | 818 } |
811 } | 819 } |
812 return os; | 820 return os; |
813 } | 821 } |
814 } | 822 } |
815 } | 823 } |
816 } // namespace v8::internal::compiler | 824 } // namespace v8::internal::compiler |
OLD | NEW |