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

Unified Diff: runtime/vm/flow_graph.cc

Issue 11043016: Set previous instruction pointers when building the graph. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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
« no previous file with comments | « no previous file | runtime/vm/flow_graph_allocator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph.cc
diff --git a/runtime/vm/flow_graph.cc b/runtime/vm/flow_graph.cc
index 4397c938b2f179ad8ee905070e9a01e59df84d15..ce8960ccf46fa375e7c2eab3ef7119640b25f0aa 100644
--- a/runtime/vm/flow_graph.cc
+++ b/runtime/vm/flow_graph.cc
@@ -51,22 +51,11 @@ void FlowGraph::DiscoverBlocks() {
&assigned_vars_,
variable_count(),
num_non_copied_params());
- // Number blocks in reverse postorder.
+ // Create an array of blocks in reverse postorder.
intptr_t block_count = postorder_.length();
for (intptr_t i = 0; i < block_count; ++i) {
reverse_postorder_.Add(postorder_[block_count - i - 1]);
}
- // Link instructions backwards for optimized compilation.
- // TODO(zerny): The builder should do this at construction time.
- for (intptr_t i = 0; i < block_count; ++i) {
- BlockEntryInstr* entry = postorder_[i];
- Instruction* previous = entry;
- for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) {
- Instruction* current = it.Current();
- current->set_previous(previous);
- previous = current;
- }
- }
}
@@ -767,14 +756,6 @@ static void ReorderPhis(BlockEntryInstr* block) {
}
-// Helper to link two instructions in the graph.
-static void Link(Instruction* prev, Instruction* next) {
- ASSERT(prev != next);
- prev->set_next(next);
- next->set_previous(prev);
-}
-
-
// Helper to sort a list of blocks.
static int LowestBlockIdFirst(BlockEntryInstr* const* a,
BlockEntryInstr* const* b) {
@@ -833,8 +814,8 @@ void FlowGraph::InlineCall(Definition* call, FlowGraph* callee_graph) {
ASSERT(exit->previous() != NULL);
// For just one exit, replace the uses and remove the call from the graph.
call->ReplaceUsesWith(exit->value()->definition());
- Link(call->previous(), callee_entry->next());
- Link(exit->previous(), call->next());
+ call->previous()->LinkTo(callee_entry->next());
+ exit->previous()->LinkTo(call->next());
// In case of control flow, locally update the dominator tree.
if (callee_graph->preorder().length() > 2) {
// The caller block is split and the new block id is that of the exit
@@ -900,8 +881,8 @@ void FlowGraph::InlineCall(Definition* call, FlowGraph* callee_graph) {
call->ReplaceUsesWith(phi);
}
// Remove the call from the graph.
- Link(call->previous(), callee_entry->next());
- Link(join, call->next());
+ call->previous()->LinkTo(callee_entry->next());
+ join->LinkTo(call->next());
// The caller block is split and the new block id is that of the join
// block. If the caller block had outgoing edges, reorder the phis so they
// are still ordered by block id.
« no previous file with comments | « no previous file | runtime/vm/flow_graph_allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698