Chromium Code Reviews| Index: runtime/vm/flow_graph_optimizer.cc |
| =================================================================== |
| --- runtime/vm/flow_graph_optimizer.cc (revision 28090) |
| +++ runtime/vm/flow_graph_optimizer.cc (working copy) |
| @@ -4148,7 +4148,7 @@ |
| switch (instr->tag()) { |
| case Instruction::kLoadField: { |
| LoadFieldInstr* load_field = instr->AsLoadField(); |
| - instance_ = load_field->instance()->definition(); |
| + instance_ = Unwrap(load_field->instance()->definition()); |
| if (load_field->field() != NULL) { |
| kind_ = kField; |
| field_ = load_field->field(); |
| @@ -4164,7 +4164,7 @@ |
| StoreInstanceFieldInstr* store_instance_field = |
| instr->AsStoreInstanceField(); |
| kind_ = kField; |
| - instance_ = store_instance_field->instance()->definition(); |
| + instance_ = Unwrap(store_instance_field->instance()->definition()); |
| field_ = &store_instance_field->field(); |
| break; |
| } |
| @@ -4172,7 +4172,7 @@ |
| case Instruction::kStoreVMField: { |
| StoreVMFieldInstr* store_vm_field = instr->AsStoreVMField(); |
| kind_ = kVMField; |
| - instance_ = store_vm_field->dest()->definition(); |
| + instance_ = Unwrap(store_vm_field->dest()->definition()); |
| offset_in_bytes_ = store_vm_field->offset_in_bytes(); |
| break; |
| } |
| @@ -4191,7 +4191,7 @@ |
| case Instruction::kLoadIndexed: { |
| LoadIndexedInstr* load_indexed = instr->AsLoadIndexed(); |
| kind_ = kIndexed; |
| - instance_ = load_indexed->array()->definition(); |
| + instance_ = Unwrap(load_indexed->array()->definition()); |
| index_ = load_indexed->index()->definition(); |
| *is_load = true; |
| break; |
| @@ -4200,7 +4200,7 @@ |
| case Instruction::kStoreIndexed: { |
| StoreIndexedInstr* store_indexed = instr->AsStoreIndexed(); |
| kind_ = kIndexed; |
| - instance_ = store_indexed->array()->definition(); |
| + instance_ = Unwrap(store_indexed->array()->definition()); |
| index_ = store_indexed->index()->definition(); |
| break; |
| } |
| @@ -4231,7 +4231,7 @@ |
| void set_instance(Definition* def) { |
| ASSERT((kind_ == kField) || (kind_ == kVMField) || (kind_ == kIndexed)); |
| - instance_ = def; |
| + instance_ = Unwrap(def); |
| } |
| const Field& field() const { |
| @@ -4302,6 +4302,13 @@ |
| static Place* Wrap(const Place& place); |
| private: |
| + static Definition* Unwrap(Definition* defn) { |
|
Kevin Millikin (Google)
2013/10/02 12:36:19
Even though it's only used locally, this name is t
Florian Schneider
2013/10/02 12:58:41
Done.
|
| + while (defn->IsRedefinition()) { |
| + defn = defn->AsRedefinition()->value()->definition(); |
| + } |
| + return defn; |
| + } |
| + |
| bool SameField(Place* other) const { |
| return (kind_ == kField) ? (field().raw() == other->field().raw()) |
| : (offset_in_bytes_ == other->offset_in_bytes_); |
| @@ -6280,6 +6287,11 @@ |
| void ConstantPropagator::VisitLoadClassId(LoadClassIdInstr* instr) { |
| + intptr_t cid = instr->object()->Type()->ToCid(); |
| + if (cid != kDynamicCid) { |
| + SetValue(instr, Smi::ZoneHandle(Smi::New(cid))); |
| + return; |
| + } |
| SetValue(instr, non_constant_); |
|
Kevin Millikin (Google)
2013/10/02 12:36:19
You could also try this: if instr->object() has a
Florian Schneider
2013/10/02 12:58:41
Done.
|
| } |