Chromium Code Reviews| Index: runtime/vm/flow_graph_optimizer.cc |
| =================================================================== |
| --- runtime/vm/flow_graph_optimizer.cc (revision 13680) |
| +++ runtime/vm/flow_graph_optimizer.cc (working copy) |
| @@ -2131,19 +2131,26 @@ |
| // i.e. the receiver argument or the constructor phase argument. |
| AbstractType& param_type = AbstractType::Handle(Type::DynamicType()); |
| param->SetPropagatedCid(kDynamicCid); |
| - if (param->index() < 2) { |
| + bool param_type_is_known = false; |
| + if (param->index() == 0) { |
| const Function& function = parsed_function().function(); |
| - if (((param->index() == 0) && function.IsDynamicFunction()) || |
|
regis
2012/10/16 16:10:11
It looks like your change is only inserting || fun
srdjan
2012/10/16 16:18:19
Yes. IMO, it was hard to read and I thought that w
|
| - ((param->index() == 1) && function.IsConstructor())) { |
| - // 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) { |
| - const intptr_t cid = Class::Handle(param_type.type_class()).id(); |
| - if (!CHA::HasSubclasses(cid)) { |
| - // Receiver's class has no subclasses. |
| - param->SetPropagatedCid(cid); |
| - } |
| + if ((function.IsDynamicFunction() || function.IsConstructor())) { |
| + // Parameter is the receiver . |
| + param_type_is_known = true; |
| + } |
| + } |
| + if ((param->index() == 1) && parsed_function().function().IsConstructor()) { |
|
regis
2012/10/16 16:10:11
How about an else here?
srdjan
2012/10/16 16:18:19
Done.
|
| + // Parameter is the constructor phase. |
| + param_type_is_known = true; |
| + } |
| + if (param_type_is_known) { |
| + LocalScope* scope = parsed_function().node_sequence()->scope(); |
| + param_type = scope->VariableAt(param->index())->type().raw(); |
| + if (FLAG_use_cha) { |
| + const intptr_t cid = Class::Handle(param_type.type_class()).id(); |
| + if (!CHA::HasSubclasses(cid)) { |
| + // Receiver's class has no subclasses. |
| + param->SetPropagatedCid(cid); |
| } |
| } |
| } |