| 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 2146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2157 void FlowGraphTypePropagator::PropagateTypes() { | 2157 void FlowGraphTypePropagator::PropagateTypes() { |
| 2158 // TODO(regis): Is there a way to make this more efficient, e.g. by visiting | 2158 // TODO(regis): Is there a way to make this more efficient, e.g. by visiting |
| 2159 // only blocks depending on blocks that have changed and not the whole graph. | 2159 // only blocks depending on blocks that have changed and not the whole graph. |
| 2160 do { | 2160 do { |
| 2161 still_changing_ = false; | 2161 still_changing_ = false; |
| 2162 VisitBlocks(); | 2162 VisitBlocks(); |
| 2163 } while (still_changing_); | 2163 } while (still_changing_); |
| 2164 } | 2164 } |
| 2165 | 2165 |
| 2166 | 2166 |
| 2167 void FlowGraphAnalyzer::Analyze() { | |
| 2168 is_leaf_ = true; | |
| 2169 for (intptr_t i = 0; i < blocks_.length(); ++i) { | |
| 2170 BlockEntryInstr* entry = blocks_[i]; | |
| 2171 for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) { | |
| 2172 LocationSummary* locs = it.Current()->locs(); | |
| 2173 if ((locs != NULL) && locs->can_call()) { | |
| 2174 is_leaf_ = false; | |
| 2175 return; | |
| 2176 } | |
| 2177 } | |
| 2178 } | |
| 2179 } | |
| 2180 | |
| 2181 | |
| 2182 static BlockEntryInstr* FindPreHeader(BlockEntryInstr* header) { | 2167 static BlockEntryInstr* FindPreHeader(BlockEntryInstr* header) { |
| 2183 for (intptr_t j = 0; j < header->PredecessorCount(); ++j) { | 2168 for (intptr_t j = 0; j < header->PredecessorCount(); ++j) { |
| 2184 BlockEntryInstr* candidate = header->PredecessorAt(j); | 2169 BlockEntryInstr* candidate = header->PredecessorAt(j); |
| 2185 if (header->dominator() == candidate) { | 2170 if (header->dominator() == candidate) { |
| 2186 return candidate; | 2171 return candidate; |
| 2187 } | 2172 } |
| 2188 } | 2173 } |
| 2189 return NULL; | 2174 return NULL; |
| 2190 } | 2175 } |
| 2191 | 2176 |
| (...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3293 | 3278 |
| 3294 if (FLAG_trace_constant_propagation) { | 3279 if (FLAG_trace_constant_propagation) { |
| 3295 OS::Print("\n==== After constant propagation ====\n"); | 3280 OS::Print("\n==== After constant propagation ====\n"); |
| 3296 FlowGraphPrinter printer(*graph_); | 3281 FlowGraphPrinter printer(*graph_); |
| 3297 printer.PrintBlocks(); | 3282 printer.PrintBlocks(); |
| 3298 } | 3283 } |
| 3299 } | 3284 } |
| 3300 | 3285 |
| 3301 | 3286 |
| 3302 } // namespace dart | 3287 } // namespace dart |
| OLD | NEW |