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

Unified Diff: src/compiler/all-nodes.cc

Issue 2226293002: [turbolizer] Visualize also the dead nodes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@t-p2
Patch Set: Created 4 years, 4 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/all-nodes.h ('k') | src/compiler/escape-analysis-reducer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/all-nodes.cc
diff --git a/src/compiler/all-nodes.cc b/src/compiler/all-nodes.cc
index ed4a218c2bc42917aebbe332b72fbaea484ed209..8040897fd33be5507ad84bc261304456806aa6dc 100644
--- a/src/compiler/all-nodes.cc
+++ b/src/compiler/all-nodes.cc
@@ -10,25 +10,33 @@ namespace v8 {
namespace internal {
namespace compiler {
-AllNodes::AllNodes(Zone* local_zone, const Graph* graph)
- : live(local_zone), is_live(graph->NodeCount(), false, local_zone) {
+AllNodes::AllNodes(Zone* local_zone, const Graph* graph, bool only_inputs)
+ : reachable(local_zone),
+ is_reachable_(graph->NodeCount(), false, local_zone),
+ only_inputs_(only_inputs) {
Node* end = graph->end();
- is_live[end->id()] = true;
- live.push_back(end);
- // Find all live nodes reachable from end.
- for (size_t i = 0; i < live.size(); i++) {
- for (Node* const input : live[i]->inputs()) {
- if (input == nullptr) {
- // TODO(titzer): print a warning.
+ is_reachable_[end->id()] = true;
+ reachable.push_back(end);
+ // Find all nodes reachable from end.
+ for (size_t i = 0; i < reachable.size(); i++) {
+ for (Node* input : reachable[i]->inputs()) {
+ if (input == nullptr || input->id() >= graph->NodeCount()) {
continue;
}
- if (input->id() >= graph->NodeCount()) {
- // TODO(titzer): print a warning.
- continue;
+ if (!is_reachable_[input->id()]) {
+ is_reachable_[input->id()] = true;
+ reachable.push_back(input);
}
- if (!is_live[input->id()]) {
- is_live[input->id()] = true;
- live.push_back(input);
+ }
+ if (!only_inputs) {
+ for (Node* use : reachable[i]->uses()) {
+ if (use == nullptr || use->id() >= graph->NodeCount()) {
+ continue;
+ }
+ if (!is_reachable_[use->id()]) {
+ is_reachable_[use->id()] = true;
+ reachable.push_back(use);
+ }
}
}
}
« no previous file with comments | « src/compiler/all-nodes.h ('k') | src/compiler/escape-analysis-reducer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698