Chromium Code Reviews| Index: runtime/vm/intermediate_language.cc |
| diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc |
| index b681cd70f7edf22162f8a9226765859c265c4a7c..e49542354c42d846cdd6a4b37bc55b2696eb5a99 100644 |
| --- a/runtime/vm/intermediate_language.cc |
| +++ b/runtime/vm/intermediate_language.cc |
| @@ -1366,6 +1366,16 @@ Definition* LoadFieldInstr::Canonicalize(FlowGraph* flow_graph) { |
| IsFixedLengthArrayCid(call->Type()->ToCid())) { |
| return call->ArgumentAt(1); |
| } |
| + // For arrays with guarded lengths, replace the length load |
| + // with a constant. |
| + LoadFieldInstr* load_array = instance()->definition()->AsLoadField(); |
| + if (load_array != NULL) { |
| + const Field* field = load_array->field(); |
|
srdjan
2013/08/28 15:15:08
'field' can be null, do you need to check?
Cutch
2013/08/29 07:23:26
Done. Conceptual/context question: What does a Loa
|
| + if (field->guarded_list_length() >= 0) { |
| + return flow_graph->GetConstant( |
| + Smi::Handle(Smi::New(field->guarded_list_length()))); |
| + } |
| + } |
| return this; |
| } |