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

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

Issue 830293003: Make control reducer revisit newly introduced merges. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Tweaks Created 5 years, 11 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 | test/mjsunit/compiler/regress-445876.js » ('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 acb2f06b04ea116e9c1ccbbf08978e72ae49d532..eef8a49fb12c8cfdf1486d28ec3039223ba80548 100644
--- a/src/compiler/control-reducer.cc
+++ b/src/compiler/control-reducer.cc
@@ -196,6 +196,9 @@ class ControlReducerImpl {
merge = graph()->NewNode(common_->Merge(2), merge, loop);
end->ReplaceInput(0, merge);
to_add = merge;
+ // Mark the node as visited so that we can revisit later.
+ EnsureStateSize(merge->id());
+ state_[merge->id()] = kVisited;
} else {
// Append a new input to the final merge at the end.
merge->AppendInput(graph()->zone(), loop);
@@ -293,14 +296,17 @@ class ControlReducerImpl {
if (replacement != node) Recurse(replacement);
}
+ void EnsureStateSize(size_t id) {
+ if (id >= state_.size()) {
+ state_.resize((3 * id) / 2, kUnvisited);
+ }
+ }
+
// Push a node onto the stack if its state is {kUnvisited} or {kRevisit}.
bool Recurse(Node* node) {
size_t id = static_cast<size_t>(node->id());
- if (id < state_.size()) {
- if (state_[id] != kRevisit && state_[id] != kUnvisited) return false;
- } else {
- state_.resize((3 * id) / 2, kUnvisited);
- }
+ EnsureStateSize(id);
+ if (state_[id] != kRevisit && state_[id] != kUnvisited) return false;
Push(node);
return true;
}
« no previous file with comments | « no previous file | test/mjsunit/compiler/regress-445876.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698