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

Unified Diff: src/compiler/control-reducer.cc

Issue 1080023002: [turbofan] Clean up cached nodes in JSGraph. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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 | « no previous file | src/compiler/js-graph.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/control-reducer.cc
diff --git a/src/compiler/control-reducer.cc b/src/compiler/control-reducer.cc
index 9856eee6957602b0cb677acbf9b1d878dcfd86ce..fb4405cc9aba917cedb2475a252b56a11484b28b 100644
--- a/src/compiler/control-reducer.cc
+++ b/src/compiler/control-reducer.cc
@@ -100,7 +100,7 @@ class ControlReducerImpl {
// Gather all nodes backwards-reachable from end (through inputs).
ReachabilityMarker marked(graph());
NodeVector nodes(zone_);
- AddNodesReachableFromEnd(marked, nodes);
+ AddNodesReachableFromRoots(marked, nodes);
// Walk forward through control nodes, looking for back edges to nodes
// that are not connected to end. Those are non-terminating loops (NTLs).
@@ -158,7 +158,6 @@ class ControlReducerImpl {
}
// Trim references from dead nodes to live nodes first.
- jsgraph_->GetCachedNodes(&nodes);
TrimNodes(marked, nodes);
// Any control nodes not reachable from start are dead, even loops.
@@ -251,13 +250,14 @@ class ControlReducerImpl {
return ret;
}
- void AddNodesReachableFromEnd(ReachabilityMarker& marked, NodeVector& nodes) {
+ void AddNodesReachableFromRoots(ReachabilityMarker& marked,
+ NodeVector& nodes) {
+ jsgraph_->GetCachedNodes(&nodes); // Consider cached nodes roots.
Node* end = graph()->end();
marked.SetReachableFromEnd(end);
- if (!end->IsDead()) {
- nodes.push_back(end);
- AddBackwardsReachableNodes(marked, nodes, nodes.size() - 1);
- }
+ if (!end->IsDead()) nodes.push_back(end); // Consider end to be a root.
+ for (Node* node : nodes) marked.SetReachableFromEnd(node);
+ AddBackwardsReachableNodes(marked, nodes, 0);
}
void AddBackwardsReachableNodes(ReachabilityMarker& marked, NodeVector& nodes,
@@ -276,10 +276,8 @@ class ControlReducerImpl {
// Gather all nodes backwards-reachable from end through inputs.
ReachabilityMarker marked(graph());
NodeVector nodes(zone_);
- AddNodesReachableFromEnd(marked, nodes);
-
- // Process cached nodes in the JSGraph too.
jsgraph_->GetCachedNodes(&nodes);
+ AddNodesReachableFromRoots(marked, nodes);
TrimNodes(marked, nodes);
}
« no previous file with comments | « no previous file | src/compiler/js-graph.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698