Chromium Code Reviews| Index: runtime/vm/flow_graph_optimizer.cc |
| =================================================================== |
| --- runtime/vm/flow_graph_optimizer.cc (revision 10775) |
| +++ runtime/vm/flow_graph_optimizer.cc (working copy) |
| @@ -661,6 +661,12 @@ |
| } |
| +// TODO(srdjan): Investigate if the propagated cid should be more specific. |
| +void FlowGraphTypePropagator::VisitPushArgument(PushArgumentInstr* push) { |
| + if (!push->has_propagated_cid()) push->SetPropagatedCid(kDynamicCid); |
| +} |
| + |
| + |
| void FlowGraphTypePropagator::VisitBind(BindInstr* bind) { |
| // No need to propagate the input types of the bound computation, as long as |
| // PhiInstr's are handled as part of JoinEntryInstr. |
| @@ -672,6 +678,12 @@ |
| if (changed) { |
| still_changing_ = true; |
| } |
| + // Propagate class ids. |
| + intptr_t cid = bind->computation()->ResultCid(); |
| + changed = bind->SetPropagatedCid(cid); |
| + if (changed) { |
| + still_changing_ = true; |
| + } |
| } |
| @@ -686,6 +698,32 @@ |
| if (changed) { |
| still_changing_ = true; |
| } |
| + |
| + // Merge class ids: if any two inputs have different class ids then result |
| + // is kDynamicCid. |
| + intptr_t merged_cid = kIllegalCid; |
| + for (intptr_t i = 0; i < phi->InputCount(); i++) { |
| + // Result cid of UseVal can be kIllegalCid if the referred definition |
| + // has not been visited yet. |
| + intptr_t cid = phi->InputAt(i)->ResultCid(); |
| + if (cid == kIllegalCid) { |
| + still_changing_ = true; |
| + continue; |
| + } |
| + if (merged_cid == kIllegalCid) { |
| + // First time set. |
| + merged_cid = cid; |
| + } else if (merged_cid != cid) { |
| + merged_cid = kDynamicCid; |
| + } |
| + } |
| + if (merged_cid == kIllegalCid) { |
| + merged_cid = kDynamicCid; |
| + } |
| + changed = phi->SetPropagatedCid(merged_cid); |
| + if (changed) { |
| + still_changing_ = true; |
| + } |
| } |
| @@ -709,6 +747,7 @@ |
| if (changed) { |
| still_changing_ = true; |
| } |
| + param->SetPropagatedCid(Class::Handle(param_type.type_class()).id()); |
|
srdjan
2012/08/16 01:32:31
This is incorrect (inexact information), removing
|
| } |