Chromium Code Reviews| Index: runtime/vm/flow_graph_builder.cc |
| =================================================================== |
| --- runtime/vm/flow_graph_builder.cc (revision 27611) |
| +++ runtime/vm/flow_graph_builder.cc (working copy) |
| @@ -45,6 +45,7 @@ |
| FlowGraphBuilder::FlowGraphBuilder(ParsedFunction* parsed_function, |
| const Array& ic_data_array, |
| InlineExitCollector* exit_collector, |
| + GrowableArray<const Field*>* guarded_fields, |
| intptr_t osr_id) |
| : parsed_function_(parsed_function), |
| ic_data_array_(ic_data_array), |
| @@ -55,6 +56,7 @@ |
| : 0), |
| num_stack_locals_(parsed_function->num_stack_locals()), |
| exit_collector_(exit_collector), |
| + guarded_fields_(guarded_fields), |
| last_used_block_id_(0), // 0 is used for the graph entry. |
| context_level_(0), |
| try_index_(CatchClauseNode::kInvalidTryIndex), |
| @@ -70,6 +72,20 @@ |
| } |
| +void FlowGraphBuilder::AddToGuardedFields(const Field& field) const { |
| + if ((field.guarded_cid() == kDynamicCid) || |
| + (field.guarded_cid() == kIllegalCid)) { |
| + return; |
| + } |
| + for (intptr_t j = 0; j < guarded_fields_->length(); j++) { |
| + if ((*guarded_fields_)[j]->raw() == field.raw()) { |
| + return; |
| + } |
| + } |
| + guarded_fields_->Add(&field); |
| +} |
| + |
| + |
| void InlineExitCollector::PrepareGraphs(FlowGraph* callee_graph) { |
| ASSERT(callee_graph->graph_entry()->SuccessorCount() == 1); |
| ASSERT(callee_graph->max_block_id() > caller_graph_->max_block_id()); |
| @@ -3039,6 +3055,17 @@ |
| node->field().Offset(), |
| AbstractType::ZoneHandle(node->field().type())); |
| load->set_field(&node->field()); |
| + if (owner()->exit_collector() != NULL) { |
|
Kevin Millikin (Google)
2013/09/18 13:03:59
Won't this register too many guarded fields --- in
Florian Schneider
2013/09/18 13:32:37
That's a good idea. I'll add the callee's guarded
|
| + // While inlining into an optimized function, the field has |
| + // to be added to the list of guarded fields of the caller. |
| + if (node->field().guarded_cid() != kIllegalCid) { |
| + if (!node->field().is_nullable() || |
| + (node->field().guarded_cid() == kNullCid)) { |
| + load->set_result_cid(node->field().guarded_cid()); |
| + } |
| + owner()->AddToGuardedFields(node->field()); |
| + } |
| + } |
| ReturnDefinition(load); |
| } |