Chromium Code Reviews| Index: runtime/vm/flow_graph_optimizer.cc |
| =================================================================== |
| --- runtime/vm/flow_graph_optimizer.cc (revision 22468) |
| +++ runtime/vm/flow_graph_optimizer.cc (working copy) |
| @@ -1593,18 +1593,36 @@ |
| ReplaceCall(call, instr); |
| return true; |
| } |
| - if ((recognized_kind == MethodRecognizer::kStringBaseCharAt) && |
| - (ic_data.NumberOfChecks() == 1) && |
| - (class_ids[0] == kOneByteStringCid)) { |
| - // TODO(fschneider): Handle TwoByteString. |
| - LoadIndexedInstr* load_char_code = |
| - BuildStringCodeUnitAt(call, class_ids[0]); |
| - InsertBefore(call, load_char_code, NULL, Definition::kValue); |
| - StringFromCharCodeInstr* char_at = |
| - new StringFromCharCodeInstr(new Value(load_char_code), |
| - kOneByteStringCid); |
| - ReplaceCall(call, char_at); |
| - return true; |
| + if ((class_ids[0] == kOneByteStringCid) && (ic_data.NumberOfChecks() == 1)) { |
| + if (recognized_kind == MethodRecognizer::kStringBaseCharAt) { |
| + // TODO(fschneider): Handle TwoByteString. |
| + LoadIndexedInstr* load_char_code = |
| + BuildStringCodeUnitAt(call, class_ids[0]); |
| + InsertBefore(call, load_char_code, NULL, Definition::kValue); |
| + StringFromCharCodeInstr* char_at = |
| + new StringFromCharCodeInstr(new Value(load_char_code), |
| + kOneByteStringCid); |
| + ReplaceCall(call, char_at); |
| + return true; |
| + } else if (recognized_kind == MethodRecognizer::kOneByteStringSetAt) { |
|
Florian Schneider
2013/05/08 12:44:10
You could just use if instead of else-if because o
srdjan
2013/05/08 19:10:58
Done.
|
| + // This is an internal method, no need to check argument types nor |
| + // range. |
| + Definition* str = call->ArgumentAt(0); |
| + Definition* index = call->ArgumentAt(1); |
| + Definition* value = call->ArgumentAt(2); |
| + StoreIndexedInstr* store_op = new StoreIndexedInstr( |
| + new Value(str), |
| + new Value(index), |
| + new Value(value), |
| + kNoStoreBarrier, |
| + 1, // Index scale |
| + kOneByteStringCid, |
| + call->deopt_id()); |
| + ReplaceCall(call, store_op); |
| + return true; |
| + } else { |
|
Florian Schneider
2013/05/08 12:44:10
else not necessary because of the return
srdjan
2013/05/08 19:10:58
Done.
|
| + return false; |
| + } |
| } |
| if ((recognized_kind == MethodRecognizer::kIntegerToDouble) && |