| 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 3773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3784 instance_ = store_indexed->array()->definition(); | 3784 instance_ = store_indexed->array()->definition(); |
| 3785 index_ = store_indexed->index()->definition(); | 3785 index_ = store_indexed->index()->definition(); |
| 3786 break; | 3786 break; |
| 3787 } | 3787 } |
| 3788 | 3788 |
| 3789 case Instruction::kCurrentContext: | 3789 case Instruction::kCurrentContext: |
| 3790 kind_ = kContext; | 3790 kind_ = kContext; |
| 3791 *is_load = true; | 3791 *is_load = true; |
| 3792 break; | 3792 break; |
| 3793 | 3793 |
| 3794 case Instruction::kChainContext: | |
| 3795 case Instruction::kStoreContext: | 3794 case Instruction::kStoreContext: |
| 3796 kind_ = kContext; | 3795 kind_ = kContext; |
| 3797 break; | 3796 break; |
| 3798 | 3797 |
| 3799 default: | 3798 default: |
| 3800 break; | 3799 break; |
| 3801 } | 3800 } |
| 3802 } | 3801 } |
| 3803 | 3802 |
| 3804 intptr_t id() const { return id_; } | 3803 intptr_t id() const { return id_; } |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4010 Definition* instance = store_instance_field->instance()->definition(); | 4009 Definition* instance = store_instance_field->instance()->definition(); |
| 4011 return Alias::Field(GetInstanceFieldId(instance, | 4010 return Alias::Field(GetInstanceFieldId(instance, |
| 4012 store_instance_field->field())); | 4011 store_instance_field->field())); |
| 4013 } | 4012 } |
| 4014 | 4013 |
| 4015 StoreVMFieldInstr* store_vm_field = instr->AsStoreVMField(); | 4014 StoreVMFieldInstr* store_vm_field = instr->AsStoreVMField(); |
| 4016 if (store_vm_field != NULL) { | 4015 if (store_vm_field != NULL) { |
| 4017 return Alias::VMField(store_vm_field->offset_in_bytes()); | 4016 return Alias::VMField(store_vm_field->offset_in_bytes()); |
| 4018 } | 4017 } |
| 4019 | 4018 |
| 4020 if (instr->IsStoreContext() || instr->IsChainContext()) { | 4019 if (instr->IsStoreContext()) { |
| 4021 return Alias::CurrentContext(); | 4020 return Alias::CurrentContext(); |
| 4022 } | 4021 } |
| 4023 | 4022 |
| 4024 StoreStaticFieldInstr* store_static_field = instr->AsStoreStaticField(); | 4023 StoreStaticFieldInstr* store_static_field = instr->AsStoreStaticField(); |
| 4025 if (store_static_field != NULL) { | 4024 if (store_static_field != NULL) { |
| 4026 return Alias::Field(GetStaticFieldId(store_static_field->field())); | 4025 return Alias::Field(GetStaticFieldId(store_static_field->field())); |
| 4027 } | 4026 } |
| 4028 | 4027 |
| 4029 return Alias::None(); | 4028 return Alias::None(); |
| 4030 } | 4029 } |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4252 StoreVMFieldInstr* store_vm_field = instr->AsStoreVMField(); | 4251 StoreVMFieldInstr* store_vm_field = instr->AsStoreVMField(); |
| 4253 if (store_vm_field != NULL) { | 4252 if (store_vm_field != NULL) { |
| 4254 return store_vm_field->value()->definition(); | 4253 return store_vm_field->value()->definition(); |
| 4255 } | 4254 } |
| 4256 | 4255 |
| 4257 StoreStaticFieldInstr* store_static_field = instr->AsStoreStaticField(); | 4256 StoreStaticFieldInstr* store_static_field = instr->AsStoreStaticField(); |
| 4258 if (store_static_field != NULL) { | 4257 if (store_static_field != NULL) { |
| 4259 return store_static_field->value()->definition(); | 4258 return store_static_field->value()->definition(); |
| 4260 } | 4259 } |
| 4261 | 4260 |
| 4262 if (instr->IsStoreContext() || instr->IsChainContext()) { | 4261 if (instr->IsStoreContext()) { |
| 4263 return instr->InputAt(0)->definition(); | 4262 return instr->InputAt(0)->definition(); |
| 4264 } | 4263 } |
| 4265 | 4264 |
| 4266 UNREACHABLE(); // Should only be called for supported store instructions. | 4265 UNREACHABLE(); // Should only be called for supported store instructions. |
| 4267 return NULL; | 4266 return NULL; |
| 4268 } | 4267 } |
| 4269 | 4268 |
| 4270 | 4269 |
| 4271 static bool IsPhiDependentPlace(Place* place) { | 4270 static bool IsPhiDependentPlace(Place* place) { |
| 4272 return ((place->kind() == Place::kField) || | 4271 return ((place->kind() == Place::kField) || |
| (...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5503 } | 5502 } |
| 5504 } | 5503 } |
| 5505 | 5504 |
| 5506 | 5505 |
| 5507 // -------------------------------------------------------------------------- | 5506 // -------------------------------------------------------------------------- |
| 5508 // Analysis of non-definition instructions. They do not have values so they | 5507 // Analysis of non-definition instructions. They do not have values so they |
| 5509 // cannot have constant values. | 5508 // cannot have constant values. |
| 5510 void ConstantPropagator::VisitStoreContext(StoreContextInstr* instr) { } | 5509 void ConstantPropagator::VisitStoreContext(StoreContextInstr* instr) { } |
| 5511 | 5510 |
| 5512 | 5511 |
| 5513 void ConstantPropagator::VisitChainContext(ChainContextInstr* instr) { } | |
| 5514 | |
| 5515 | |
| 5516 void ConstantPropagator::VisitCatchEntry(CatchEntryInstr* instr) { } | 5512 void ConstantPropagator::VisitCatchEntry(CatchEntryInstr* instr) { } |
| 5517 | 5513 |
| 5518 | 5514 |
| 5519 void ConstantPropagator::VisitCheckStackOverflow( | 5515 void ConstantPropagator::VisitCheckStackOverflow( |
| 5520 CheckStackOverflowInstr* instr) { } | 5516 CheckStackOverflowInstr* instr) { } |
| 5521 | 5517 |
| 5522 | 5518 |
| 5523 void ConstantPropagator::VisitCheckClass(CheckClassInstr* instr) { } | 5519 void ConstantPropagator::VisitCheckClass(CheckClassInstr* instr) { } |
| 5524 | 5520 |
| 5525 void ConstantPropagator::VisitGuardField(GuardFieldInstr* instr) { } | 5521 void ConstantPropagator::VisitGuardField(GuardFieldInstr* instr) { } |
| (...skipping 1658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7184 | 7180 |
| 7185 // Insert materializations at environment uses. | 7181 // Insert materializations at environment uses. |
| 7186 const Class& cls = Class::Handle(alloc->constructor().Owner()); | 7182 const Class& cls = Class::Handle(alloc->constructor().Owner()); |
| 7187 for (intptr_t i = 0; i < exits.length(); i++) { | 7183 for (intptr_t i = 0; i < exits.length(); i++) { |
| 7188 CreateMaterializationAt(exits[i], alloc, cls, *fields); | 7184 CreateMaterializationAt(exits[i], alloc, cls, *fields); |
| 7189 } | 7185 } |
| 7190 } | 7186 } |
| 7191 | 7187 |
| 7192 | 7188 |
| 7193 } // namespace dart | 7189 } // namespace dart |
| OLD | NEW |