Chromium Code Reviews| Index: runtime/vm/flow_graph_optimizer.cc |
| =================================================================== |
| --- runtime/vm/flow_graph_optimizer.cc (revision 12301) |
| +++ runtime/vm/flow_graph_optimizer.cc (working copy) |
| @@ -363,14 +363,18 @@ |
| new CheckSmiInstr(index->Copy(), call->deopt_id()), |
| call->env(), |
| Definition::kEffect); |
| - // Insert array bounds check. |
| - InsertBefore(call, |
| - new CheckArrayBoundInstr(array->Copy(), |
| - index->Copy(), |
| - class_id, |
| - call), |
| - call->env(), |
| - Definition::kEffect); |
| + // If both index and array are constants, then the bound check always |
| + // succeeded. |
| + if (!(array->BindsToConstant() && index->BindsToConstant())) { |
|
Vyacheslav Egorov (Google)
2012/09/13 09:27:51
Please add todo so that we remove it when constant
srdjan
2012/09/13 09:46:45
Done.
|
| + // Insert array bounds check. |
| + InsertBefore(call, |
| + new CheckArrayBoundInstr(array->Copy(), |
| + index->Copy(), |
| + class_id, |
| + call), |
| + call->env(), |
| + Definition::kEffect); |
| + } |
| if (class_id == kGrowableObjectArrayCid) { |
| // Insert data elements load. |
| LoadFieldInstr* elements = |