Chromium Code Reviews| 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); |
| } |
| } |
| } |