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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 346823003: VM: Optimized context allocation on all platforms. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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_optimizer.h ('k') | runtime/vm/flow_graph_type_propagator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_optimizer.cc
===================================================================
--- runtime/vm/flow_graph_optimizer.cc (revision 38897)
+++ runtime/vm/flow_graph_optimizer.cc (working copy)
@@ -4410,6 +4410,37 @@
}
+void FlowGraphOptimizer::VisitAllocateContext(AllocateContextInstr* instr) {
+ // Replace generic allocation with a sequence of inlined allocation and
+ // explicit initalizing stores.
+ AllocateUninitializedContextInstr* replacement =
+ new AllocateUninitializedContextInstr(instr->token_pos(),
+ instr->num_context_variables());
+ instr->ReplaceWith(replacement, current_iterator());
+
+ StoreInstanceFieldInstr* store =
+ new(I) StoreInstanceFieldInstr(Context::parent_offset(),
+ new Value(replacement),
+ new Value(flow_graph_->constant_null()),
+ kNoStoreBarrier,
+ instr->token_pos());
+ store->set_is_initialization(true); // Won't be eliminated by DSE.
+ flow_graph_->InsertAfter(replacement, store, NULL, FlowGraph::kEffect);
+ Definition* cursor = store;
+ for (intptr_t i = 0; i < instr->num_context_variables(); ++i) {
+ store =
+ new(I) StoreInstanceFieldInstr(Context::variable_offset(i),
+ new Value(replacement),
+ new Value(flow_graph_->constant_null()),
+ kNoStoreBarrier,
+ instr->token_pos());
+ store->set_is_initialization(true); // Won't be eliminated by DSE.
+ flow_graph_->InsertAfter(cursor, store, NULL, FlowGraph::kEffect);
+ cursor = store;
+ }
+}
+
+
bool FlowGraphOptimizer::TryInlineInstanceSetter(InstanceCallInstr* instr,
const ICData& unary_ic_data) {
ASSERT((unary_ic_data.NumberOfChecks() > 0) &&
@@ -8647,6 +8678,12 @@
}
+void ConstantPropagator::VisitAllocateUninitializedContext(
+ AllocateUninitializedContextInstr* instr) {
+ SetValue(instr, non_constant_);
+}
+
+
void ConstantPropagator::VisitCloneContext(CloneContextInstr* instr) {
SetValue(instr, non_constant_);
}
« no previous file with comments | « runtime/vm/flow_graph_optimizer.h ('k') | runtime/vm/flow_graph_type_propagator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698