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

Unified Diff: runtime/vm/intermediate_language.cc

Issue 617933003: Iterative graph traversal in FlowGraph::DiscoverBlocks() (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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
« runtime/vm/flow_graph.cc ('K') | « runtime/vm/intermediate_language.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language.cc
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
index f56cdde24e4f88b1aa023129b57c3293307c1445..9fa3f62772860cb569544e4ee2cf996e3b10af5a 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -838,10 +838,8 @@ static bool IsMarked(BlockEntryInstr* block,
void BlockEntryInstr::DiscoverBlocks(
BlockEntryInstr* predecessor,
GrowableArray<BlockEntryInstr*>* preorder,
- GrowableArray<BlockEntryInstr*>* postorder,
GrowableArray<intptr_t>* parent,
- intptr_t variable_count,
- intptr_t fixed_parameter_count) {
+ GrowableArray<BlockEntryEdge>* block_stack) {
// If this block has a predecessor (i.e., is not the graph entry) we can
// assume the preorder array is non-empty.
ASSERT((predecessor == NULL) || !preorder->is_empty());
@@ -885,20 +883,11 @@ void BlockEntryInstr::DiscoverBlocks(
}
set_last_instruction(last);
- // Visit the block's successors in reverse so that they appear forwards
- // the reverse postorder block ordering.
+ // Push the block's successors in reverse so that they are visited from left
+ // to right.
for (intptr_t i = last->SuccessorCount() - 1; i >= 0; --i) {
- last->SuccessorAt(i)->DiscoverBlocks(this,
- preorder,
- postorder,
- parent,
- variable_count,
- fixed_parameter_count);
+ block_stack->Add(BlockEntryEdge(this, last->SuccessorAt(i)));
}
-
- // 6. Assign postorder number and add the block entry to the list.
- set_postorder_number(postorder->length());
- postorder->Add(this);
}
« runtime/vm/flow_graph.cc ('K') | « runtime/vm/intermediate_language.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698