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_builder.h" | 5 #include "vm/flow_graph_builder.h" |
6 | 6 |
7 #include "vm/ast_printer.h" | 7 #include "vm/ast_printer.h" |
8 #include "vm/bit_vector.h" | 8 #include "vm/bit_vector.h" |
9 #include "vm/code_descriptors.h" | 9 #include "vm/code_descriptors.h" |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 2241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2252 &preorder_block_entries_, | 2252 &preorder_block_entries_, |
2253 &postorder_block_entries_, | 2253 &postorder_block_entries_, |
2254 &parent, | 2254 &parent, |
2255 &assigned_vars, | 2255 &assigned_vars, |
2256 variable_count); | 2256 variable_count); |
2257 // Number blocks in reverse postorder. | 2257 // Number blocks in reverse postorder. |
2258 intptr_t block_count = postorder_block_entries_.length(); | 2258 intptr_t block_count = postorder_block_entries_.length(); |
2259 for (intptr_t i = 0; i < block_count; ++i) { | 2259 for (intptr_t i = 0; i < block_count; ++i) { |
2260 postorder_block_entries_[i]->set_block_id(block_count - i - 1); | 2260 postorder_block_entries_[i]->set_block_id(block_count - i - 1); |
2261 } | 2261 } |
2262 if (for_optimized && use_ssa) { | 2262 |
| 2263 if (for_optimized) { |
2263 // Link instructions backwards for optimized compilation. | 2264 // Link instructions backwards for optimized compilation. |
2264 for (intptr_t i = 0; i < block_count; ++i) { | 2265 for (intptr_t i = 0; i < block_count; ++i) { |
2265 BlockEntryInstr* entry = postorder_block_entries_[i]; | 2266 BlockEntryInstr* entry = postorder_block_entries_[i]; |
2266 Instruction* previous = entry; | 2267 Instruction* previous = entry; |
2267 for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) { | 2268 for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) { |
2268 Instruction* current = it.Current(); | 2269 Instruction* current = it.Current(); |
2269 current->set_previous(previous); | 2270 current->set_previous(previous); |
2270 previous = current; | 2271 previous = current; |
2271 } | 2272 } |
2272 } | 2273 } |
| 2274 } |
| 2275 |
| 2276 if (for_optimized && use_ssa) { |
2273 GrowableArray<BitVector*> dominance_frontier; | 2277 GrowableArray<BitVector*> dominance_frontier; |
2274 ComputeDominators(&preorder_block_entries_, &parent, &dominance_frontier); | 2278 ComputeDominators(&preorder_block_entries_, &parent, &dominance_frontier); |
2275 InsertPhis(preorder_block_entries_, | 2279 InsertPhis(preorder_block_entries_, |
2276 assigned_vars, | 2280 assigned_vars, |
2277 variable_count, | 2281 variable_count, |
2278 dominance_frontier); | 2282 dominance_frontier); |
2279 Rename(variable_count); | 2283 Rename(variable_count); |
2280 } | 2284 } |
2281 if (FLAG_print_flow_graph || (Dart::flow_graph_writer() != NULL)) { | 2285 if (FLAG_print_flow_graph || (Dart::flow_graph_writer() != NULL)) { |
2282 intptr_t length = postorder_block_entries_.length(); | 2286 intptr_t length = postorder_block_entries_.length(); |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2661 char* chars = reinterpret_cast<char*>( | 2665 char* chars = reinterpret_cast<char*>( |
2662 Isolate::Current()->current_zone()->Allocate(len)); | 2666 Isolate::Current()->current_zone()->Allocate(len)); |
2663 OS::SNPrint(chars, len, kFormat, function_name, reason); | 2667 OS::SNPrint(chars, len, kFormat, function_name, reason); |
2664 const Error& error = Error::Handle( | 2668 const Error& error = Error::Handle( |
2665 LanguageError::New(String::Handle(String::New(chars)))); | 2669 LanguageError::New(String::Handle(String::New(chars)))); |
2666 Isolate::Current()->long_jump_base()->Jump(1, error); | 2670 Isolate::Current()->long_jump_base()->Jump(1, error); |
2667 } | 2671 } |
2668 | 2672 |
2669 | 2673 |
2670 } // namespace dart | 2674 } // namespace dart |
OLD | NEW |