| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 it->RemoveCurrentFromGraph(); | 145 it->RemoveCurrentFromGraph(); |
| 146 } | 146 } |
| 147 | 147 |
| 148 | 148 |
| 149 void FlowGraphOptimizer::OptimizeComputations() { | 149 void FlowGraphOptimizer::OptimizeComputations() { |
| 150 for (intptr_t i = 0; i < block_order_.length(); ++i) { | 150 for (intptr_t i = 0; i < block_order_.length(); ++i) { |
| 151 BlockEntryInstr* entry = block_order_[i]; | 151 BlockEntryInstr* entry = block_order_[i]; |
| 152 entry->Accept(this); | 152 entry->Accept(this); |
| 153 for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) { | 153 for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) { |
| 154 Instruction* current = it.Current(); | 154 Instruction* current = it.Current(); |
| 155 Instruction* replacement = current->Canonicalize(); | 155 Instruction* replacement = current->Canonicalize(this); |
| 156 if (replacement != current) { | 156 if (replacement != current) { |
| 157 // For non-definitions Canonicalize should return either NULL or | 157 // For non-definitions Canonicalize should return either NULL or |
| 158 // this. | 158 // this. |
| 159 ASSERT((replacement == NULL) || current->IsDefinition()); | 159 ASSERT((replacement == NULL) || current->IsDefinition()); |
| 160 ReplaceCurrentInstruction(&it, current, replacement); | 160 ReplaceCurrentInstruction(&it, current, replacement); |
| 161 } | 161 } |
| 162 } | 162 } |
| 163 } | 163 } |
| 164 } | 164 } |
| 165 | 165 |
| (...skipping 3635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3801 | 3801 |
| 3802 if (FLAG_trace_constant_propagation) { | 3802 if (FLAG_trace_constant_propagation) { |
| 3803 OS::Print("\n==== After constant propagation ====\n"); | 3803 OS::Print("\n==== After constant propagation ====\n"); |
| 3804 FlowGraphPrinter printer(*graph_); | 3804 FlowGraphPrinter printer(*graph_); |
| 3805 printer.PrintBlocks(); | 3805 printer.PrintBlocks(); |
| 3806 } | 3806 } |
| 3807 } | 3807 } |
| 3808 | 3808 |
| 3809 | 3809 |
| 3810 } // namespace dart | 3810 } // namespace dart |
| OLD | NEW |