Chromium Code Reviews| 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,35 @@ |
| } |
| +void FlowGraphOptimizer::VisitAllocateContext(AllocateContextInstr* instr) { |
|
srdjan
2014/08/11 21:42:34
Why don't you do that in the FlowGraphBuilder inst
Florian Schneider
2014/08/13 14:56:12
I only want the inlined code for unoptimized code
|
| + // 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()); |
| + |
| + Definition* def = |
| + new(I) StoreInstanceFieldInstr(Context::parent_offset(), |
| + new Value(replacement), |
| + new Value(flow_graph_->constant_null()), |
| + kNoStoreBarrier, |
| + instr->token_pos()); |
| + flow_graph_->InsertAfter(replacement, def, NULL, FlowGraph::kEffect); |
| + Definition* cursor = def; |
| + for (intptr_t i = 0; i < instr->num_context_variables(); ++i) { |
| + def = |
| + new(I) StoreInstanceFieldInstr(Context::variable_offset(i), |
| + new Value(replacement), |
| + new Value(flow_graph_->constant_null()), |
| + kNoStoreBarrier, |
| + instr->token_pos()); |
| + flow_graph_->InsertAfter(cursor, def, NULL, FlowGraph::kEffect); |
| + cursor = def; |
| + } |
| +} |
| + |
| + |
| bool FlowGraphOptimizer::TryInlineInstanceSetter(InstanceCallInstr* instr, |
| const ICData& unary_ic_data) { |
| ASSERT((unary_ic_data.NumberOfChecks() > 0) && |
| @@ -8647,6 +8676,12 @@ |
| } |
| +void ConstantPropagator::VisitAllocateUninitializedContext( |
| + AllocateUninitializedContextInstr* instr) { |
| + SetValue(instr, non_constant_); |
| +} |
| + |
| + |
| void ConstantPropagator::VisitCloneContext(CloneContextInstr* instr) { |
| SetValue(instr, non_constant_); |
| } |