| Index: runtime/vm/flow_graph_optimizer.cc
|
| diff --git a/runtime/vm/flow_graph_optimizer.cc b/runtime/vm/flow_graph_optimizer.cc
|
| index ba9a4d9fa9dbe68442e61735fcc7bd37da568e57..b2fc5b6ee596759c38c9a29df30d17651b045fd2 100644
|
| --- a/runtime/vm/flow_graph_optimizer.cc
|
| +++ b/runtime/vm/flow_graph_optimizer.cc
|
| @@ -770,6 +770,13 @@ intptr_t FlowGraphOptimizer::PrepareIndexedOp(InstanceCallInstr* call,
|
| call->env(),
|
| Definition::kEffect);
|
|
|
| + // Get the field if the array is loaded from a class field.
|
| + const Field* field = NULL;
|
| + if ((*array)->IsLoadField()) {
|
| + LoadFieldInstr* load_field_instr = (*array)->AsLoadField();
|
| + field = load_field_instr->field();
|
| + }
|
| +
|
| // Insert array length load and bounds check.
|
| const bool is_immutable =
|
| CheckArrayBoundInstr::IsFixedLengthArrayType(class_id);
|
| @@ -783,7 +790,8 @@ intptr_t FlowGraphOptimizer::PrepareIndexedOp(InstanceCallInstr* call,
|
| LoadFieldInstr::RecognizedKindFromArrayCid(class_id));
|
| InsertBefore(call, length, NULL, Definition::kValue);
|
| InsertBefore(call,
|
| - new CheckArrayBoundInstr(new Value(length),
|
| + new CheckArrayBoundInstr(field,
|
| + new Value(length),
|
| new Value(*index),
|
| call->deopt_id()),
|
| call->env(),
|
| @@ -1688,7 +1696,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(),
|
| @@ -2461,7 +2470,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(),
|
|
|