Chromium Code Reviews| Index: runtime/vm/flow_graph_optimizer.cc |
| =================================================================== |
| --- runtime/vm/flow_graph_optimizer.cc (revision 12196) |
| +++ runtime/vm/flow_graph_optimizer.cc (working copy) |
| @@ -348,6 +348,16 @@ |
| call), |
| call->env(), |
| Definition::kEffect); |
| + if (class_id == kGrowableObjectArrayCid) { |
| + // Insert data elements load. |
| + // TODO(fschneider): type of load should be GrowableObjectArrayType. |
| + LoadVMFieldInstr* elements = |
| + new LoadVMFieldInstr(array->Copy(), |
| + GrowableObjectArray::data_offset(), |
| + AbstractType::ZoneHandle()); |
|
srdjan
2012/09/12 07:06:40
Add:
elements->set_result_cid(kArrayCid);
As
Florian Schneider
2012/09/12 08:27:29
Done.
|
| + InsertBefore(call, elements, NULL, Definition::kValue); |
| + array = new Value(elements); |
| + } |
| Definition* array_op = NULL; |
| if (op_kind == Token::kINDEX) { |
| array_op = new LoadIndexedInstr(array, index, class_id); |
| @@ -614,10 +624,12 @@ |
| return false; |
| } |
| intptr_t length_offset = -1; |
| + bool is_immutable = false; |
| switch (recognized_kind) { |
| case MethodRecognizer::kObjectArrayLength: |
| case MethodRecognizer::kImmutableArrayLength: |
| length_offset = Array::length_offset(); |
| + is_immutable = true; |
| break; |
| case MethodRecognizer::kGrowableArrayLength: |
| length_offset = GrowableObjectArray::length_offset(); |
| @@ -631,7 +643,8 @@ |
| LoadVMFieldInstr* load = new LoadVMFieldInstr( |
| call->ArgumentAt(0)->value(), |
| length_offset, |
| - Type::ZoneHandle(Type::SmiType())); |
| + Type::ZoneHandle(Type::SmiType()), |
| + is_immutable); |
| load->set_result_cid(kSmiCid); |
| call->ReplaceWith(load, current_iterator()); |
| RemovePushArguments(call); |
| @@ -669,10 +682,12 @@ |
| // Check receiver class. |
| AddCheckClass(call, call->ArgumentAt(0)->value()->Copy()); |
| + const bool is_immutable = true; // String length is immutable. |
| LoadVMFieldInstr* load = new LoadVMFieldInstr( |
| call->ArgumentAt(0)->value(), |
| String::length_offset(), |
| - Type::ZoneHandle(Type::SmiType())); |
| + Type::ZoneHandle(Type::SmiType()), |
| + is_immutable); |
| load->set_result_cid(kSmiCid); |
| call->ReplaceWith(load, current_iterator()); |
| RemovePushArguments(call); |
| @@ -1308,7 +1323,7 @@ |
| Definition* current = it.Current()->AsDefinition(); |
| if (current != NULL && |
| !current->IsPushArgument() && |
| - !current->HasSideEffect()) { |
| + !current->AffectedBySideEffect()) { |
| bool inputs_loop_invariant = true; |
| for (int i = 0; i < current->InputCount(); ++i) { |
| Definition* input_def = current->InputAt(i)->definition(); |
| @@ -1342,7 +1357,7 @@ |
| DirectChainedHashMap<Definition*>* map) { |
| for (ForwardInstructionIterator it(block); !it.Done(); it.Advance()) { |
| Definition* defn = it.Current()->AsDefinition(); |
| - if ((defn == NULL) || defn->HasSideEffect()) continue; |
| + if ((defn == NULL) || defn->AffectedBySideEffect()) continue; |
| Definition* result = map->Lookup(defn); |
| if (result == NULL) { |
| map->Insert(defn); |