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

Unified Diff: runtime/vm/flow_graph_builder.cc

Issue 10855101: RemoveFromGraph on definitions asserts empty use lists. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Corrected invariants of def-use chains. Created 8 years, 4 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 | « runtime/vm/flow_graph_allocator.cc ('k') | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_builder.cc
diff --git a/runtime/vm/flow_graph_builder.cc b/runtime/vm/flow_graph_builder.cc
index ea3c452243c0acafec742c862d1b071c96e608ad..28c563ef91ca767b804f718ed464fb836a93cbc5 100644
--- a/runtime/vm/flow_graph_builder.cc
+++ b/runtime/vm/flow_graph_builder.cc
@@ -2710,6 +2710,12 @@ void FlowGraphBuilder::RenameRecursive(BlockEntryInstr* block_entry,
if ((as_bind != NULL) &&
(as_bind->computation()->IsLoadLocal() ||
as_bind->computation()->IsStoreLocal())) {
+ // Assert exactly one use.
+ ASSERT(as_bind->use_list() == v);
+ ASSERT(as_bind->use_list()->next_use() == NULL);
+ // Remove the use, its defintion and copy the environment value.
+ v->RemoveFromUseList();
+ as_bind->RemoveFromGraph();
current->SetInputAt(i, CopyValue(input_value));
}
}
@@ -2747,11 +2753,16 @@ void FlowGraphBuilder::RenameRecursive(BlockEntryInstr* block_entry,
}
}
}
- // Update expression stack and remove from graph.
+ // Update expression stack or remove from graph.
if (bind->is_used()) {
+ // Assert exactly one use.
+ ASSERT(bind->use_list() != NULL);
+ ASSERT(bind->use_list()->next_use() == NULL);
env->Add(CopyValue((*env)[index]));
+ // We remove load/store instructions when we find their use in 2a.
+ } else {
+ it.RemoveCurrentFromGraph();
}
- it.RemoveCurrentFromGraph();
} else {
// Not a load or store.
if (bind->is_used()) {
@@ -2790,10 +2801,7 @@ void FlowGraphBuilder::RenameRecursive(BlockEntryInstr* block_entry,
PhiInstr* phi = (*successor->phis())[i];
if (phi != NULL) {
// Rename input operand and make a copy if it is a UseVal.
- Value* new_val = (*env)[i]->IsUse()
- ? new UseVal((*env)[i]->AsUse()->definition())
- : (*env)[i];
- phi->SetInputAt(pred_index, new_val);
+ phi->SetInputAt(pred_index, CopyValue((*env)[i]));
}
}
}
« no previous file with comments | « runtime/vm/flow_graph_allocator.cc ('k') | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698