Chromium Code Reviews| Index: runtime/vm/flow_graph_optimizer.cc |
| =================================================================== |
| --- runtime/vm/flow_graph_optimizer.cc (revision 11068) |
| +++ runtime/vm/flow_graph_optimizer.cc (working copy) |
| @@ -18,6 +18,7 @@ |
| DECLARE_FLAG(bool, enable_type_checks); |
| DEFINE_FLAG(bool, trace_optimization, false, "Print optimization details."); |
| DECLARE_FLAG(bool, trace_type_check_elimination); |
| +DEFINE_FLAG(bool, use_cha, true, "Use class hierarchy analysis."); |
| void FlowGraphOptimizer::ApplyICData() { |
| VisitBlocks(); |
| @@ -868,6 +869,7 @@ |
| // it to the DynamicType, unless the argument is a compiler generated value, |
| // i.e. the receiver argument or the constructor phase argument. |
| AbstractType& param_type = AbstractType::Handle(Type::DynamicType()); |
| + param->SetPropagatedCid(kDynamicCid); |
| if (param->index() < 2) { |
| const Function& function = parsed_function().function(); |
| if (((param->index() == 0) && function.IsDynamicFunction()) || |
| @@ -875,13 +877,19 @@ |
| // Parameter is the receiver or the constructor phase. |
| LocalScope* scope = parsed_function().node_sequence()->scope(); |
| param_type = scope->VariableAt(param->index())->type().raw(); |
| + if (FLAG_use_cha) { |
| + intptr_t cid = Class::Handle(param_type.type_class()).id(); |
|
regis
2012/08/21 20:52:21
const
srdjan
2012/08/21 22:08:15
Done.
|
| + if (!Isolate::Current()->class_table()->HasSubclasses(cid)) { |
| + // Receiver's class has no subclasses. |
| + param->SetPropagatedCid(cid); |
| + } |
| + } |
| } |
| } |
| bool changed = param->SetPropagatedType(param_type); |
| if (changed) { |
| still_changing_ = true; |
| } |
| - param->SetPropagatedCid(kDynamicCid); |
| } |