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

Unified Diff: runtime/vm/flow_graph.cc

Issue 10823411: Fixed issue 4580 introduced by revision 10894. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 | « no previous file | no next file » | 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 64936cc59458c927a7a30edee9c88e16d24df17a..1e86b0dda966c2fd2519f6ff633921d54beed968 100644
--- a/runtime/vm/flow_graph.cc
+++ b/runtime/vm/flow_graph.cc
@@ -271,11 +271,12 @@ void FlowGraph::Rename(GrowableArray<PhiInstr*>* live_phis) {
}
// All locals are initialized with #null.
- Definition* null_def = new BindInstr(BindInstr::kUsed,
- new ConstantVal(Object::ZoneHandle()));
- null_def->set_ssa_temp_index(alloc_ssa_temp_index()); // New SSA temp.
+ Definition* null_defn = new BindInstr(BindInstr::kUsed,
+ new ConstantVal(Object::ZoneHandle()));
+ // The null definition should not appear in input positions.
+ ASSERT(null_defn->ssa_temp_index() == -1);
while (start_env.length() < variable_count()) {
- start_env.Add(null_def);
+ start_env.Add(null_defn);
}
graph_entry_->set_start_env(
new Environment(start_env, non_copied_parameter_count_));
@@ -288,6 +289,16 @@ void FlowGraph::Rename(GrowableArray<PhiInstr*>* live_phis) {
}
+// Helper to either use the constant value of a defintion or the defintion.
srdjan 2012/08/20 16:54:20 s/defintion/definition/ (twice)
+static Value* UseDefinition(Definition* defn) {
+ if (defn->IsBind() && defn->AsBind()->computation()->IsConstant()) {
+ return defn->AsBind()->computation()->AsConstant();
+ } else {
+ return new UseVal(defn);
+ }
+}
+
+
void FlowGraph::RenameRecursive(BlockEntryInstr* block_entry,
GrowableArray<Definition*>* env,
GrowableArray<PhiInstr*>* live_phis) {
@@ -336,6 +347,8 @@ void FlowGraph::RenameRecursive(BlockEntryInstr* block_entry,
// Remove the use, its definition and copy the environment value.
v->RemoveFromUseList();
as_bind->RemoveFromGraph();
+ // Assert we are not referencing nulls in the initial environment.
+ ASSERT(input_defn->ssa_temp_index() != -1);
current->SetInputAt(i, new UseVal(input_defn));
}
}
@@ -419,7 +432,7 @@ void FlowGraph::RenameRecursive(BlockEntryInstr* block_entry,
PhiInstr* phi = (*successor->phis())[i];
if (phi != NULL) {
// Rename input operand.
- phi->SetInputAt(pred_index, new UseVal((*env)[i]));
+ phi->SetInputAt(pred_index, UseDefinition((*env)[i]));
}
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698