| 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 4942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4953 // this value is stored in a field, escapes to another function or | 4953 // this value is stored in a field, escapes to another function or |
| 4954 // participates in a phi. | 4954 // participates in a phi. |
| 4955 static bool CanBeAliased(AllocateObjectInstr* alloc) { | 4955 static bool CanBeAliased(AllocateObjectInstr* alloc) { |
| 4956 if (alloc->identity() == AllocateObjectInstr::kUnknown) { | 4956 if (alloc->identity() == AllocateObjectInstr::kUnknown) { |
| 4957 bool escapes = false; | 4957 bool escapes = false; |
| 4958 for (Value* use = alloc->input_use_list(); | 4958 for (Value* use = alloc->input_use_list(); |
| 4959 use != NULL; | 4959 use != NULL; |
| 4960 use = use->next_use()) { | 4960 use = use->next_use()) { |
| 4961 Instruction* instr = use->instruction(); | 4961 Instruction* instr = use->instruction(); |
| 4962 if (instr->IsPushArgument() || | 4962 if (instr->IsPushArgument() || |
| 4963 (instr->IsStoreVMField() | 4963 (instr->IsStoreVMField() && (use->use_index() != 1)) || |
| 4964 && (use->use_index() != StoreVMFieldInstr::kObjectPos)) || | 4964 (instr->IsStoreInstanceField() && (use->use_index() != 0)) || |
| 4965 (instr->IsStoreInstanceField() | |
| 4966 && (use->use_index() != StoreInstanceFieldInstr::kInstancePos)) || | |
| 4967 instr->IsStoreStaticField() || | 4965 instr->IsStoreStaticField() || |
| 4968 instr->IsPhi() || | 4966 instr->IsPhi() || |
| 4969 instr->IsAssertAssignable() || | 4967 instr->IsAssertAssignable() || |
| 4970 instr->IsRedefinition()) { | 4968 instr->IsRedefinition()) { |
| 4971 escapes = true; | 4969 escapes = true; |
| 4972 break; | 4970 break; |
| 4973 } | 4971 } |
| 4974 } | 4972 } |
| 4975 | 4973 |
| 4976 alloc->set_identity(escapes ? AllocateObjectInstr::kAliased | 4974 alloc->set_identity(escapes ? AllocateObjectInstr::kAliased |
| (...skipping 3171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8148 } | 8146 } |
| 8149 | 8147 |
| 8150 // Insert materializations at environment uses. | 8148 // Insert materializations at environment uses. |
| 8151 for (intptr_t i = 0; i < exits.length(); i++) { | 8149 for (intptr_t i = 0; i < exits.length(); i++) { |
| 8152 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields); | 8150 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields); |
| 8153 } | 8151 } |
| 8154 } | 8152 } |
| 8155 | 8153 |
| 8156 | 8154 |
| 8157 } // namespace dart | 8155 } // namespace dart |
| OLD | NEW |