Chromium Code Reviews| Index: runtime/vm/flow_graph_optimizer.cc |
| =================================================================== |
| --- runtime/vm/flow_graph_optimizer.cc (revision 17771) |
| +++ runtime/vm/flow_graph_optimizer.cc (working copy) |
| @@ -733,6 +733,8 @@ |
| bool FlowGraphOptimizer::TryReplaceWithLoadIndexed(InstanceCallInstr* call) { |
| const intptr_t class_id = ReceiverClassId(call); |
| + // Set deopt_id to a valid id if the LoadIndexedInstr can cause deopt. |
| + intptr_t deopt_id = Isolate::kNoDeoptId; |
| switch (class_id) { |
| case kArrayCid: |
| case kImmutableArrayCid: |
| @@ -753,6 +755,17 @@ |
| if ((kSmiBits < 32) && !FlowGraphCompiler::SupportsUnboxedMints()) { |
| return false; |
| } |
| + // Set deopt_id if we can optimistically assume that the result is Smi. |
| + // TODO(srdjan): Add better signal if this instruction caused |
|
Florian Schneider
2013/01/29 19:57:58
call->ic_data().deopt_reason() should contain the
|
| + // deoptimization. This solution: only if no deoptimization occured in |
| + // this method is it guaranteed that this instruction did not cause |
| + // deoptimization. |
| + if (flow_graph_->parsed_function().function().deoptimization_counter() |
| + > 0) { |
| + deopt_id = Isolate::kNoDeoptId; |
| + } else { |
| + deopt_id = call->deopt_id(); |
| + } |
| break; |
| default: |
| return false; |
| @@ -760,7 +773,8 @@ |
| Value* array = NULL; |
| Value* index = NULL; |
| intptr_t array_cid = PrepareIndexedOp(call, class_id, &array, &index); |
| - Definition* array_op = new LoadIndexedInstr(array, index, array_cid); |
| + Definition* array_op = |
| + new LoadIndexedInstr(array, index, array_cid, deopt_id); |
| call->ReplaceWith(array_op, current_iterator()); |
| RemovePushArguments(call); |
| return true; |
| @@ -1289,7 +1303,7 @@ |
| call->env(), |
| Definition::kEffect); |
| } |
| - return new LoadIndexedInstr(str, index, cid); |
| + return new LoadIndexedInstr(str, index, cid, Isolate::kNoDeoptId); |
| } |