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

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: Removed wrong dependency 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/cctest/wasm/test-run-wasm-64.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 116e261fcf0aa5c3cda989962b77ceb899e14881..1ef2e2140581afce1c2a9bb02b76d01fd368fffc 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,23 @@ 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) {
+ NodeState& top = stack_.top();
+ if (top.input_index == top.node->InputCount()) {
+ // All inputs of top have already been lowered, now lower top.
stack_.pop();
- state_.Set(top, State::kVisited);
- // All inputs of top have already been reduced, now reduce top.
- LowerNode(top);
+ state_.Set(top.node, State::kVisited);
+ LowerNode(top.node);
} else {
- // Push all children onto the stack.
- for (Node* input : top->inputs()) {
- if (state_.Get(input) == State::kUnvisited) {
- stack_.push(input);
- state_.Set(input, State::kOnStack);
- }
+ // Push the next input onto the stack.
+ Node* input = top.node->InputAt(top.input_index++);
+ 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/cctest/wasm/test-run-wasm-64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698