Commit e04f33ad authored by Mythri's avatar Mythri Committed by Commit Bot

[Turbofan] Change the revisit order to breadth first instead of depth first.

When there are some changes in the graph, we mark the uses of the reduced
node for revisiting. These are pushed onto a stack and hence follow a
depth first traversal. This sometimes leads to propogating the changes
down the graph and again revisiting the entire graph because of the
nodes that were marked for revisit earlier.

Bug: chromium:725664
Change-Id: I036fd7096c422565a2851b109aba2b4c438403c0
Reviewed-on: https://chromium-review.googlesource.com/563301Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Mythri Alle <mythria@google.com>
Cr-Commit-Position: refs/heads/master@{#46480}
parent 8951a9cd
...@@ -56,7 +56,7 @@ void GraphReducer::ReduceNode(Node* node) { ...@@ -56,7 +56,7 @@ void GraphReducer::ReduceNode(Node* node) {
ReduceTop(); ReduceTop();
} else if (!revisit_.empty()) { } else if (!revisit_.empty()) {
// If the stack becomes empty, revisit any nodes in the revisit queue. // If the stack becomes empty, revisit any nodes in the revisit queue.
Node* const node = revisit_.top(); Node* const node = revisit_.front();
revisit_.pop(); revisit_.pop();
if (state_.Get(node) == State::kRevisit) { if (state_.Get(node) == State::kRevisit) {
// state can change while in queue. // state can change while in queue.
......
...@@ -174,7 +174,7 @@ class V8_EXPORT_PRIVATE GraphReducer ...@@ -174,7 +174,7 @@ class V8_EXPORT_PRIVATE GraphReducer
Node* const dead_; Node* const dead_;
NodeMarker<State> state_; NodeMarker<State> state_;
ZoneVector<Reducer*> reducers_; ZoneVector<Reducer*> reducers_;
ZoneStack<Node*> revisit_; ZoneQueue<Node*> revisit_;
ZoneStack<NodeState> stack_; ZoneStack<NodeState> stack_;
DISALLOW_COPY_AND_ASSIGN(GraphReducer); DISALLOW_COPY_AND_ASSIGN(GraphReducer);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment