| 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 4143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4154 offset_in_bytes_ = load_field->offset_in_bytes(); | 4154 offset_in_bytes_ = load_field->offset_in_bytes(); |
| 4155 } | 4155 } |
| 4156 *is_load = true; | 4156 *is_load = true; |
| 4157 break; | 4157 break; |
| 4158 } | 4158 } |
| 4159 | 4159 |
| 4160 case Instruction::kStoreInstanceField: { | 4160 case Instruction::kStoreInstanceField: { |
| 4161 StoreInstanceFieldInstr* store_instance_field = | 4161 StoreInstanceFieldInstr* store_instance_field = |
| 4162 instr->AsStoreInstanceField(); | 4162 instr->AsStoreInstanceField(); |
| 4163 kind_ = kField; | 4163 kind_ = kField; |
| 4164 // Value is at input index 1. | 4164 representation_ = store_instance_field-> |
| 4165 representation_ = store_instance_field->RequiredInputRepresentation(1); | 4165 RequiredInputRepresentation(StoreInstanceFieldInstr::kValuePos); |
| 4166 instance_ = | 4166 instance_ = |
| 4167 OriginalDefinition(store_instance_field->instance()->definition()); | 4167 OriginalDefinition(store_instance_field->instance()->definition()); |
| 4168 field_ = &store_instance_field->field(); | 4168 field_ = &store_instance_field->field(); |
| 4169 break; | 4169 break; |
| 4170 } | 4170 } |
| 4171 | 4171 |
| 4172 case Instruction::kStoreVMField: { | 4172 case Instruction::kStoreVMField: { |
| 4173 StoreVMFieldInstr* store_vm_field = instr->AsStoreVMField(); | 4173 StoreVMFieldInstr* store_vm_field = instr->AsStoreVMField(); |
| 4174 kind_ = kVMField; | 4174 kind_ = kVMField; |
| 4175 // Value is at input index 0. | 4175 representation_ = store_vm_field-> |
| 4176 representation_ = store_vm_field->RequiredInputRepresentation(0); | 4176 RequiredInputRepresentation(StoreVMFieldInstr::kValuePos); |
| 4177 instance_ = OriginalDefinition(store_vm_field->dest()->definition()); | 4177 instance_ = OriginalDefinition(store_vm_field->dest()->definition()); |
| 4178 offset_in_bytes_ = store_vm_field->offset_in_bytes(); | 4178 offset_in_bytes_ = store_vm_field->offset_in_bytes(); |
| 4179 break; | 4179 break; |
| 4180 } | 4180 } |
| 4181 | 4181 |
| 4182 case Instruction::kLoadStaticField: | 4182 case Instruction::kLoadStaticField: |
| 4183 kind_ = kField; | 4183 kind_ = kField; |
| 4184 representation_ = instr->AsLoadStaticField()->representation(); | 4184 representation_ = instr->AsLoadStaticField()->representation(); |
| 4185 field_ = &instr->AsLoadStaticField()->StaticField(); | 4185 field_ = &instr->AsLoadStaticField()->StaticField(); |
| 4186 *is_load = true; | 4186 *is_load = true; |
| 4187 break; | 4187 break; |
| 4188 | 4188 |
| 4189 case Instruction::kStoreStaticField: | 4189 case Instruction::kStoreStaticField: |
| 4190 kind_ = kField; | 4190 kind_ = kField; |
| 4191 // Value is at input index 0. | 4191 representation_ = instr->AsStoreStaticField()-> |
| 4192 representation_ = | 4192 RequiredInputRepresentation(StoreStaticFieldInstr::kValuePos); |
| 4193 instr->AsStoreStaticField()->RequiredInputRepresentation(0); | |
| 4194 field_ = &instr->AsStoreStaticField()->field(); | 4193 field_ = &instr->AsStoreStaticField()->field(); |
| 4195 break; | 4194 break; |
| 4196 | 4195 |
| 4197 case Instruction::kLoadIndexed: { | 4196 case Instruction::kLoadIndexed: { |
| 4198 LoadIndexedInstr* load_indexed = instr->AsLoadIndexed(); | 4197 LoadIndexedInstr* load_indexed = instr->AsLoadIndexed(); |
| 4199 kind_ = kIndexed; | 4198 kind_ = kIndexed; |
| 4200 representation_ = load_indexed->representation(); | 4199 representation_ = load_indexed->representation(); |
| 4201 instance_ = OriginalDefinition(load_indexed->array()->definition()); | 4200 instance_ = OriginalDefinition(load_indexed->array()->definition()); |
| 4202 index_ = load_indexed->index()->definition(); | 4201 index_ = load_indexed->index()->definition(); |
| 4203 *is_load = true; | 4202 *is_load = true; |
| 4204 break; | 4203 break; |
| 4205 } | 4204 } |
| 4206 | 4205 |
| 4207 case Instruction::kStoreIndexed: { | 4206 case Instruction::kStoreIndexed: { |
| 4208 StoreIndexedInstr* store_indexed = instr->AsStoreIndexed(); | 4207 StoreIndexedInstr* store_indexed = instr->AsStoreIndexed(); |
| 4209 kind_ = kIndexed; | 4208 kind_ = kIndexed; |
| 4210 // Value is at input index 2. | 4209 representation_ = store_indexed-> |
| 4211 representation_ = store_indexed->RequiredInputRepresentation(2); | 4210 RequiredInputRepresentation(StoreIndexedInstr::kValuePos); |
| 4212 instance_ = OriginalDefinition(store_indexed->array()->definition()); | 4211 instance_ = OriginalDefinition(store_indexed->array()->definition()); |
| 4213 index_ = store_indexed->index()->definition(); | 4212 index_ = store_indexed->index()->definition(); |
| 4214 break; | 4213 break; |
| 4215 } | 4214 } |
| 4216 | 4215 |
| 4217 case Instruction::kCurrentContext: | 4216 case Instruction::kCurrentContext: |
| 4218 kind_ = kContext; | 4217 kind_ = kContext; |
| 4219 ASSERT(instr->AsCurrentContext()->representation() == kTagged); | 4218 ASSERT(instr->AsCurrentContext()->representation() == kTagged); |
| 4220 representation_ = kTagged; | 4219 representation_ = kTagged; |
| 4221 *is_load = true; | 4220 *is_load = true; |
| 4222 break; | 4221 break; |
| 4223 | 4222 |
| 4224 case Instruction::kStoreContext: | 4223 case Instruction::kStoreContext: |
| 4225 kind_ = kContext; | 4224 kind_ = kContext; |
| 4226 ASSERT(instr->AsStoreContext()->RequiredInputRepresentation(0) == | 4225 ASSERT(instr->AsStoreContext()->RequiredInputRepresentation( |
| 4227 kTagged); | 4226 StoreContextInstr::kValuePos) == kTagged); |
| 4228 representation_ = kTagged; | 4227 representation_ = kTagged; |
| 4229 break; | 4228 break; |
| 4230 | 4229 |
| 4231 default: | 4230 default: |
| 4232 break; | 4231 break; |
| 4233 } | 4232 } |
| 4234 } | 4233 } |
| 4235 | 4234 |
| 4236 intptr_t id() const { return id_; } | 4235 intptr_t id() const { return id_; } |
| 4237 void set_id(intptr_t id) { id_ = id; } | 4236 void set_id(intptr_t id) { id_ = id; } |
| (...skipping 3526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7764 } | 7763 } |
| 7765 | 7764 |
| 7766 // Insert materializations at environment uses. | 7765 // Insert materializations at environment uses. |
| 7767 for (intptr_t i = 0; i < exits.length(); i++) { | 7766 for (intptr_t i = 0; i < exits.length(); i++) { |
| 7768 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields); | 7767 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields); |
| 7769 } | 7768 } |
| 7770 } | 7769 } |
| 7771 | 7770 |
| 7772 | 7771 |
| 7773 } // namespace dart | 7772 } // namespace dart |
| OLD | NEW |