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

Unified Diff: runtime/vm/flow_graph.cc

Issue 11265005: Set previous pointer to graph entry for initial definitions. (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 | « runtime/vm/flow_graph.h ('k') | 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 70596f9ef57d00cf27ec76896114e48d7b6cf0a5..95961cb8dffc46024e77ba0c31b5faeadf032ced 100644
--- a/runtime/vm/flow_graph.cc
+++ b/runtime/vm/flow_graph.cc
@@ -49,10 +49,17 @@ ConstantInstr* FlowGraph::AddConstantToInitialDefinitions(
// Otherwise, allocate and add it to the pool.
ConstantInstr* constant = new ConstantInstr(object);
constant->set_ssa_temp_index(alloc_ssa_temp_index());
- graph_entry_->initial_definitions()->Add(constant);
+ AddToInitialDefinitions(constant);
return constant;
}
+void FlowGraph::AddToInitialDefinitions(Definition* defn) {
+ // TODO(zerny): Set previous to the graph entry so it is accessible by
+ // GetBlock. Remove this once there is a direct pointer to the block.
+ defn->set_previous(graph_entry_);
+ graph_entry_->initial_definitions()->Add(defn);
+}
+
void FlowGraph::DiscoverBlocks() {
// Initialize state.
@@ -502,9 +509,8 @@ void FlowGraph::Rename(GrowableArray<PhiInstr*>* live_phis,
GrowableArray<Definition*> env(variable_count());
// Add global constants to the initial definitions.
- ConstantInstr* constant_null = new ConstantInstr(Object::ZoneHandle());
- constant_null->set_ssa_temp_index(alloc_ssa_temp_index());
- graph_entry_->initial_definitions()->Add(constant_null);
+ ConstantInstr* constant_null =
+ AddConstantToInitialDefinitions(Object::ZoneHandle());
// Add parameters to the initial definitions and renaming environment.
if (inlining_parameters != NULL) {
@@ -513,7 +519,7 @@ void FlowGraph::Rename(GrowableArray<PhiInstr*>* live_phis,
for (intptr_t i = 0; i < parameter_count(); ++i) {
Definition* defn = (*inlining_parameters)[i];
defn->set_ssa_temp_index(alloc_ssa_temp_index()); // New SSA temp.
- graph_entry_->initial_definitions()->Add(defn);
+ AddToInitialDefinitions(defn);
env.Add(defn);
}
} else {
@@ -521,7 +527,7 @@ void FlowGraph::Rename(GrowableArray<PhiInstr*>* live_phis,
for (intptr_t i = 0; i < parameter_count(); ++i) {
ParameterInstr* param = new ParameterInstr(i, graph_entry_);
param->set_ssa_temp_index(alloc_ssa_temp_index()); // New SSA temp.
- graph_entry_->initial_definitions()->Add(param);
+ AddToInitialDefinitions(param);
env.Add(param);
}
}
« no previous file with comments | « runtime/vm/flow_graph.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698