OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/flow_graph_optimizer.h" | 5 #include "vm/flow_graph_optimizer.h" |
6 | 6 |
7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
8 #include "vm/cha.h" | 8 #include "vm/cha.h" |
9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
10 #include "vm/flow_graph_builder.h" | 10 #include "vm/flow_graph_builder.h" |
(...skipping 4302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4313 (representation_ == other->representation_) && | 4313 (representation_ == other->representation_) && |
4314 (instance_ == other->instance_) && | 4314 (instance_ == other->instance_) && |
4315 SameField(other); | 4315 SameField(other); |
4316 } | 4316 } |
4317 | 4317 |
4318 // Create a zone allocated copy of this place. | 4318 // Create a zone allocated copy of this place. |
4319 static Place* Wrap(const Place& place); | 4319 static Place* Wrap(const Place& place); |
4320 | 4320 |
4321 private: | 4321 private: |
4322 static Definition* OriginalDefinition(Definition* defn) { | 4322 static Definition* OriginalDefinition(Definition* defn) { |
4323 while (defn->IsRedefinition()) { | 4323 while (defn->IsRedefinition() || defn->IsAssertAssignable()) { |
4324 defn = defn->AsRedefinition()->value()->definition(); | 4324 if (defn->IsRedefinition()) { |
| 4325 defn = defn->AsRedefinition()->value()->definition(); |
| 4326 } else { |
| 4327 defn = defn->AsAssertAssignable()->value()->definition(); |
| 4328 } |
4325 } | 4329 } |
4326 return defn; | 4330 return defn; |
4327 } | 4331 } |
4328 | 4332 |
4329 bool SameField(Place* other) const { | 4333 bool SameField(Place* other) const { |
4330 return (kind_ == kField) ? (field().raw() == other->field().raw()) | 4334 return (kind_ == kField) ? (field().raw() == other->field().raw()) |
4331 : (offset_in_bytes_ == other->offset_in_bytes_); | 4335 : (offset_in_bytes_ == other->offset_in_bytes_); |
4332 } | 4336 } |
4333 | 4337 |
4334 intptr_t FieldHashcode() const { | 4338 intptr_t FieldHashcode() const { |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4532 static bool CanBeAliased(AllocateObjectInstr* alloc) { | 4536 static bool CanBeAliased(AllocateObjectInstr* alloc) { |
4533 if (alloc->identity() == AllocateObjectInstr::kUnknown) { | 4537 if (alloc->identity() == AllocateObjectInstr::kUnknown) { |
4534 bool escapes = false; | 4538 bool escapes = false; |
4535 for (Value* use = alloc->input_use_list(); | 4539 for (Value* use = alloc->input_use_list(); |
4536 use != NULL; | 4540 use != NULL; |
4537 use = use->next_use()) { | 4541 use = use->next_use()) { |
4538 Instruction* instr = use->instruction(); | 4542 Instruction* instr = use->instruction(); |
4539 if (instr->IsPushArgument() || | 4543 if (instr->IsPushArgument() || |
4540 (instr->IsStoreVMField() && (use->use_index() != 1)) || | 4544 (instr->IsStoreVMField() && (use->use_index() != 1)) || |
4541 (instr->IsStoreInstanceField() && (use->use_index() != 0)) || | 4545 (instr->IsStoreInstanceField() && (use->use_index() != 0)) || |
4542 (instr->IsStoreStaticField()) || | 4546 instr->IsStoreStaticField() || |
4543 (instr->IsPhi())) { | 4547 instr->IsPhi() || |
| 4548 instr->IsAssertAssignable() || |
| 4549 instr->IsRedefinition()) { |
4544 escapes = true; | 4550 escapes = true; |
4545 break; | 4551 break; |
4546 } | 4552 } |
4547 } | 4553 } |
4548 | 4554 |
4549 alloc->set_identity(escapes ? AllocateObjectInstr::kAliased | 4555 alloc->set_identity(escapes ? AllocateObjectInstr::kAliased |
4550 : AllocateObjectInstr::kNotAliased); | 4556 : AllocateObjectInstr::kNotAliased); |
4551 } | 4557 } |
4552 | 4558 |
4553 return alloc->identity() != AllocateObjectInstr::kNotAliased; | 4559 return alloc->identity() != AllocateObjectInstr::kNotAliased; |
(...skipping 3204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7758 } | 7764 } |
7759 | 7765 |
7760 // Insert materializations at environment uses. | 7766 // Insert materializations at environment uses. |
7761 for (intptr_t i = 0; i < exits.length(); i++) { | 7767 for (intptr_t i = 0; i < exits.length(); i++) { |
7762 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields); | 7768 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields); |
7763 } | 7769 } |
7764 } | 7770 } |
7765 | 7771 |
7766 | 7772 |
7767 } // namespace dart | 7773 } // namespace dart |
OLD | NEW |