| 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/flow_graph_builder.h" | 9 #include "vm/flow_graph_builder.h" |
| 10 #include "vm/flow_graph_compiler.h" | 10 #include "vm/flow_graph_compiler.h" |
| (...skipping 6404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6415 !block_it.Done(); | 6415 !block_it.Done(); |
| 6416 block_it.Advance()) { | 6416 block_it.Advance()) { |
| 6417 BlockEntryInstr* block = block_it.Current(); | 6417 BlockEntryInstr* block = block_it.Current(); |
| 6418 for (ForwardInstructionIterator it(block); !it.Done(); it.Advance()) { | 6418 for (ForwardInstructionIterator it(block); !it.Done(); it.Advance()) { |
| 6419 AllocateObjectInstr* alloc = it.Current()->AsAllocateObject(); | 6419 AllocateObjectInstr* alloc = it.Current()->AsAllocateObject(); |
| 6420 if ((alloc != NULL) && IsAllocationSinkingCandidate(alloc)) { | 6420 if ((alloc != NULL) && IsAllocationSinkingCandidate(alloc)) { |
| 6421 if (FLAG_trace_optimization) { | 6421 if (FLAG_trace_optimization) { |
| 6422 OS::Print("discovered allocation sinking candidate: v%"Pd"\n", | 6422 OS::Print("discovered allocation sinking candidate: v%"Pd"\n", |
| 6423 alloc->ssa_temp_index()); | 6423 alloc->ssa_temp_index()); |
| 6424 } | 6424 } |
| 6425 |
| 6426 if (alloc->identity() == AllocateObjectInstr::kAliased) { |
| 6427 // Allocation might have been classified as aliased earlier due to |
| 6428 // some operations that are now eliminated. |
| 6429 alloc->set_identity(AllocateObjectInstr::kNotAliased); |
| 6430 } |
| 6431 |
| 6425 candidates.Add(alloc); | 6432 candidates.Add(alloc); |
| 6426 } | 6433 } |
| 6427 } | 6434 } |
| 6428 } | 6435 } |
| 6429 | 6436 |
| 6430 // Insert MaterializeObject instructions that will describe the state of the | 6437 // Insert MaterializeObject instructions that will describe the state of the |
| 6431 // object at all deoptimization points. Each inserted materialization looks | 6438 // object at all deoptimization points. Each inserted materialization looks |
| 6432 // like this (where v_0 is allocation that we are going to eliminate): | 6439 // like this (where v_0 is allocation that we are going to eliminate): |
| 6433 // v_1 <- LoadField(v_0, field_1) | 6440 // v_1 <- LoadField(v_0, field_1) |
| 6434 // ... | 6441 // ... |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6571 | 6578 |
| 6572 // Insert materializations at environment uses. | 6579 // Insert materializations at environment uses. |
| 6573 const Class& cls = Class::Handle(alloc->constructor().Owner()); | 6580 const Class& cls = Class::Handle(alloc->constructor().Owner()); |
| 6574 for (intptr_t i = 0; i < exits.length(); i++) { | 6581 for (intptr_t i = 0; i < exits.length(); i++) { |
| 6575 CreateMaterializationAt(exits[i], alloc, cls, *fields); | 6582 CreateMaterializationAt(exits[i], alloc, cls, *fields); |
| 6576 } | 6583 } |
| 6577 } | 6584 } |
| 6578 | 6585 |
| 6579 | 6586 |
| 6580 } // namespace dart | 6587 } // namespace dart |
| OLD | NEW |