Chromium Code Reviews| Index: runtime/vm/flow_graph_optimizer.cc |
| diff --git a/runtime/vm/flow_graph_optimizer.cc b/runtime/vm/flow_graph_optimizer.cc |
| index 05707fe79a51e35209d3060aecdad3cb6a7c65bb..2bce3fe8fe0dae083ca945c2a74d137f2b6e469d 100644 |
| --- a/runtime/vm/flow_graph_optimizer.cc |
| +++ b/runtime/vm/flow_graph_optimizer.cc |
| @@ -266,22 +266,29 @@ static bool HasOneDouble(const ICData& ic_data) { |
| static bool ShouldSpecializeForDouble(const ICData& ic_data) { |
| - if (ic_data.NumberOfChecks() != 1) return false; |
| + if (ic_data.NumberOfChecks() < 1) return false; |
| if (ic_data.num_args_tested() != 2) return false; |
| - Function& target = Function::Handle(); |
| - GrowableArray<intptr_t> class_ids; |
| - ic_data.GetCheckAt(0, &class_ids, &target); |
| - ASSERT(class_ids.length() == 2); |
| + for (intptr_t check_idx = 0; |
| + check_idx < ic_data.NumberOfChecks(); |
| + check_idx++) { |
| + Function& target = Function::Handle(); |
| + GrowableArray<intptr_t> class_ids; |
| + ic_data.GetCheckAt(check_idx, &class_ids, &target); |
| + ASSERT(class_ids.length() == 2); |
| - const bool seen_double = |
| - (class_ids[0] == kDoubleCid) || (class_ids[1] == kDoubleCid); |
| + const bool seen_double = |
|
Florian Schneider
2012/09/21 13:23:07
It would be nice to have a helper that checks for
|
| + (class_ids[0] == kDoubleCid) || (class_ids[1] == kDoubleCid); |
| - const bool seen_only_smi_or_double = |
| - ((class_ids[0] == kDoubleCid) || (class_ids[0] == kSmiCid)) && |
| - ((class_ids[1] == kDoubleCid) || (class_ids[1] == kSmiCid)); |
| + const bool seen_only_smi_or_double = |
| + ((class_ids[0] == kDoubleCid) || (class_ids[0] == kSmiCid)) && |
| + ((class_ids[1] == kDoubleCid) || (class_ids[1] == kSmiCid)); |
| - return seen_double && seen_only_smi_or_double; |
| + if (!seen_double || !seen_only_smi_or_double) { |
| + return false; |
| + } |
| + } |
| + return true; |
| } |