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

Unified Diff: src/compiler/int64-lowering.cc

Issue 1798993002: [wasm] Int64Lowering: changing to DFS. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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/int64-lowering.h ('k') | test/unittests/compiler/int64-lowering-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/int64-lowering.cc
diff --git a/src/compiler/int64-lowering.cc b/src/compiler/int64-lowering.cc
index 4e592c1256f4fd3062ef0c0d3249b5b7c0fa5aba..71eb7d7d5ecd6c1d951460048b56f1ab776cef41 100644
--- a/src/compiler/int64-lowering.cc
+++ b/src/compiler/int64-lowering.cc
@@ -24,7 +24,7 @@ Int64Lowering::Int64Lowering(Graph* graph, MachineOperatorBuilder* machine,
graph_(graph),
machine_(machine),
common_(common),
- state_(graph, 4),
+ state_(graph, 3),
stack_(zone),
replacements_(zone->NewArray<Replacement>(graph->NodeCount())),
signature_(signature) {
@@ -35,25 +35,26 @@ void Int64Lowering::LowerGraph() {
if (!machine()->Is32()) {
return;
}
- stack_.push(graph()->end());
+ stack_.push({graph()->end(), 0});
state_.Set(graph()->end(), State::kOnStack);
while (!stack_.empty()) {
- Node* top = stack_.top();
- if (state_.Get(top) == State::kInputsPushed) {
- stack_.pop();
- state_.Set(top, State::kVisited);
+ NodeState top = stack_.top();
+ stack_.pop();
titzer 2016/03/14 14:14:13 You can move the pop into the true branch and drop
ahaas 2016/03/14 14:25:18 Done.
+ if (top.input_index == top.node->InputCount()) {
+ // if (state_.Get(top) == State::kInputsPushed) {
+ state_.Set(top.node, State::kVisited);
// All inputs of top have already been reduced, now reduce top.
- LowerNode(top);
+ LowerNode(top.node);
} else {
// Push all children onto the stack.
titzer 2016/03/14 14:14:13 Update comment.
ahaas 2016/03/14 14:25:18 Done.
- for (Node* input : top->inputs()) {
- if (state_.Get(input) == State::kUnvisited) {
- stack_.push(input);
- state_.Set(input, State::kOnStack);
- }
+ Node* input = top.node->InputAt(top.input_index);
titzer 2016/03/14 14:14:13 It's ok to through the ++ inside here, too.
ahaas 2016/03/14 14:25:18 Done.
+ top.input_index++;
+ stack_.push(top);
+ if (state_.Get(input) == State::kUnvisited) {
+ stack_.push({input, 0});
+ state_.Set(input, State::kOnStack);
}
- state_.Set(top, State::kInputsPushed);
}
}
}
« no previous file with comments | « src/compiler/int64-lowering.h ('k') | test/unittests/compiler/int64-lowering-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698