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 dee0f58a564b39a27c0cd0116965d7ab6cbc4176..3d69bba2a6f353a19d8845565899d9db660136ce 100644 |
| --- a/runtime/vm/flow_graph_optimizer.cc |
| +++ b/runtime/vm/flow_graph_optimizer.cc |
| @@ -770,51 +770,32 @@ intptr_t FlowGraphOptimizer::PrepareIndexedOp(InstanceCallInstr* call, |
| call->env(), |
| Definition::kEffect); |
| - bool emit_bounds_check = true; |
| // Get the field for the array. |
| const Field* field = NULL; |
| if ((*array)->IsLoadField()) { |
| LoadFieldInstr* load_field_instr = (*array)->AsLoadField(); |
| field = load_field_instr->field(); |
| } |
| - // Extract the guarded array length. |
| - intptr_t guarded_array_length = -1; |
| - if (field != NULL) { |
| - if (field->guarded_list_length() >= 0) { |
| - guarded_array_length = field->guarded_list_length(); |
| - } |
| - } |
| - Definition* i = *index; |
| - // Check if we can skip emitting the bounds check. |
| - if (i->IsConstant() && guarded_array_length >= 0) { |
| - ConstantInstr* constant = i->AsConstant(); |
| - ASSERT(constant != NULL); |
| - intptr_t ci = Smi::Cast(constant->value()).Value(); |
| - if (ci < guarded_array_length) { |
| - emit_bounds_check = false; |
| - } |
| - } |
| - if (emit_bounds_check) { |
| - // Insert array length load and bounds check. |
| - const bool is_immutable = |
| - CheckArrayBoundInstr::IsFixedLengthArrayType(class_id); |
| - LoadFieldInstr* length = |
| - new LoadFieldInstr(new Value(*array), |
| - CheckArrayBoundInstr::LengthOffsetFor(class_id), |
| - Type::ZoneHandle(Type::SmiType()), |
| - is_immutable); |
| - length->set_result_cid(kSmiCid); |
| - length->set_recognized_kind( |
| - LoadFieldInstr::RecognizedKindFromArrayCid(class_id)); |
| - InsertBefore(call, length, NULL, Definition::kValue); |
| - InsertBefore(call, |
| - new CheckArrayBoundInstr(new Value(length), |
| - new Value(*index), |
| - call->deopt_id()), |
| - call->env(), |
| - Definition::kEffect); |
| - } |
| + // Insert array length load and bounds check. |
| + const bool is_immutable = |
| + CheckArrayBoundInstr::IsFixedLengthArrayType(class_id); |
| + LoadFieldInstr* length = |
|
Florian Schneider
2013/08/27 12:51:34
If the field has a guarded_list_length: could you
|
| + new LoadFieldInstr(new Value(*array), |
| + CheckArrayBoundInstr::LengthOffsetFor(class_id), |
| + Type::ZoneHandle(Type::SmiType()), |
| + is_immutable); |
| + length->set_result_cid(kSmiCid); |
| + length->set_recognized_kind( |
| + LoadFieldInstr::RecognizedKindFromArrayCid(class_id)); |
| + InsertBefore(call, length, NULL, Definition::kValue); |
| + InsertBefore(call, |
| + new CheckArrayBoundInstr(field, |
| + new Value(length), |
| + new Value(*index), |
| + call->deopt_id()), |
| + call->env(), |
| + Definition::kEffect); |
| if (class_id == kGrowableObjectArrayCid) { |
| @@ -1716,7 +1697,8 @@ LoadIndexedInstr* FlowGraphOptimizer::BuildStringCodeUnitAt( |
| LoadFieldInstr* length = BuildLoadStringLength(str); |
| InsertBefore(call, length, NULL, Definition::kValue); |
| InsertBefore(call, |
| - new CheckArrayBoundInstr(new Value(length), |
| + new CheckArrayBoundInstr(NULL, |
| + new Value(length), |
| new Value(index), |
| call->deopt_id()), |
| call->env(), |
| @@ -2489,7 +2471,8 @@ void FlowGraphOptimizer::PrepareByteArrayViewOp( |
| // Check byte_index < len_in_bytes. |
| InsertBefore(call, |
| - new CheckArrayBoundInstr(new Value(len_in_bytes), |
| + new CheckArrayBoundInstr(NULL, |
| + new Value(len_in_bytes), |
| new Value(byte_index), |
| call->deopt_id()), |
| call->env(), |