| 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 3116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3127 } | 3127 } |
| 3128 | 3128 |
| 3129 if (join != NULL) { | 3129 if (join != NULL) { |
| 3130 // Replace the branch with a jump to the reachable successor. | 3130 // Replace the branch with a jump to the reachable successor. |
| 3131 // Drop the comparison, which does not have side effects as long | 3131 // Drop the comparison, which does not have side effects as long |
| 3132 // as it is a strict compare (the only one we can determine is | 3132 // as it is a strict compare (the only one we can determine is |
| 3133 // constant with the current analysis). | 3133 // constant with the current analysis). |
| 3134 GotoInstr* jump = new GotoInstr(join); | 3134 GotoInstr* jump = new GotoInstr(join); |
| 3135 Instruction* previous = branch->previous(); | 3135 Instruction* previous = branch->previous(); |
| 3136 branch->set_previous(NULL); | 3136 branch->set_previous(NULL); |
| 3137 previous->set_next(jump); | 3137 previous->LinkTo(jump); |
| 3138 // Replace the false target entry with the new join entry. We will | 3138 // Replace the false target entry with the new join entry. We will |
| 3139 // recompute the dominators after this pass. | 3139 // recompute the dominators after this pass. |
| 3140 join->set_next(next); | 3140 join->LinkTo(next); |
| 3141 } | 3141 } |
| 3142 } | 3142 } |
| 3143 } | 3143 } |
| 3144 | 3144 |
| 3145 graph_->DiscoverBlocks(); | 3145 graph_->DiscoverBlocks(); |
| 3146 GrowableArray<BitVector*> dominance_frontier; | 3146 GrowableArray<BitVector*> dominance_frontier; |
| 3147 graph_->ComputeDominators(&dominance_frontier); | 3147 graph_->ComputeDominators(&dominance_frontier); |
| 3148 graph_->ComputeUseLists(); | 3148 graph_->ComputeUseLists(); |
| 3149 | 3149 |
| 3150 if (FLAG_trace_constant_propagation) { | 3150 if (FLAG_trace_constant_propagation) { |
| 3151 OS::Print("\n==== After constant propagation ====\n"); | 3151 OS::Print("\n==== After constant propagation ====\n"); |
| 3152 FlowGraphPrinter printer(*graph_); | 3152 FlowGraphPrinter printer(*graph_); |
| 3153 printer.PrintBlocks(); | 3153 printer.PrintBlocks(); |
| 3154 } | 3154 } |
| 3155 } | 3155 } |
| 3156 | 3156 |
| 3157 | 3157 |
| 3158 } // namespace dart | 3158 } // namespace dart |
| OLD | NEW |