| 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 2337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2348 BuildLoadContext(node->context_var()); | 2348 BuildLoadContext(node->context_var()); |
| 2349 EffectGraphVisitor for_finally_block(owner(), temp_index()); | 2349 EffectGraphVisitor for_finally_block(owner(), temp_index()); |
| 2350 node->finally_block()->Visit(&for_finally_block); | 2350 node->finally_block()->Visit(&for_finally_block); |
| 2351 Append(for_finally_block); | 2351 Append(for_finally_block); |
| 2352 if (try_index >= 0) { | 2352 if (try_index >= 0) { |
| 2353 owner()->set_try_index(try_index); | 2353 owner()->set_try_index(try_index); |
| 2354 } | 2354 } |
| 2355 } | 2355 } |
| 2356 | 2356 |
| 2357 | 2357 |
| 2358 void FlowGraphBuilder::BuildGraph(bool for_optimized) { | 2358 void FlowGraphBuilder::BuildGraph(bool for_optimized, bool use_ssa) { |
| 2359 if (FLAG_print_ast) { | 2359 if (FLAG_print_ast) { |
| 2360 // Print the function ast before IL generation. | 2360 // Print the function ast before IL generation. |
| 2361 AstPrinter::PrintFunctionNodes(parsed_function()); | 2361 AstPrinter::PrintFunctionNodes(parsed_function()); |
| 2362 } | 2362 } |
| 2363 // Compilation can be nested, preserve the computation-id. | 2363 // Compilation can be nested, preserve the computation-id. |
| 2364 const Function& function = parsed_function().function(); | 2364 const Function& function = parsed_function().function(); |
| 2365 TargetEntryInstr* normal_entry = new TargetEntryInstr(); | 2365 TargetEntryInstr* normal_entry = new TargetEntryInstr(); |
| 2366 graph_entry_ = new GraphEntryInstr(normal_entry); | 2366 graph_entry_ = new GraphEntryInstr(normal_entry); |
| 2367 EffectGraphVisitor for_effect(this, 0); | 2367 EffectGraphVisitor for_effect(this, 0); |
| 2368 for_effect.AddInstruction(normal_entry); | 2368 for_effect.AddInstruction(normal_entry); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2380 &preorder_block_entries_, | 2380 &preorder_block_entries_, |
| 2381 &postorder_block_entries_, | 2381 &postorder_block_entries_, |
| 2382 &parent, | 2382 &parent, |
| 2383 &assigned_vars, | 2383 &assigned_vars, |
| 2384 variable_count); | 2384 variable_count); |
| 2385 // Number blocks in reverse postorder. | 2385 // Number blocks in reverse postorder. |
| 2386 intptr_t block_count = postorder_block_entries_.length(); | 2386 intptr_t block_count = postorder_block_entries_.length(); |
| 2387 for (intptr_t i = 0; i < block_count; ++i) { | 2387 for (intptr_t i = 0; i < block_count; ++i) { |
| 2388 postorder_block_entries_[i]->set_block_id(block_count - i - 1); | 2388 postorder_block_entries_[i]->set_block_id(block_count - i - 1); |
| 2389 } | 2389 } |
| 2390 if (for_optimized && FLAG_use_ssa) { | 2390 if (for_optimized && use_ssa) { |
| 2391 GrowableArray<BitVector*> dominance_frontier; | 2391 GrowableArray<BitVector*> dominance_frontier; |
| 2392 ComputeDominators(&preorder_block_entries_, &parent, &dominance_frontier); | 2392 ComputeDominators(&preorder_block_entries_, &parent, &dominance_frontier); |
| 2393 InsertPhis(preorder_block_entries_, | 2393 InsertPhis(preorder_block_entries_, |
| 2394 assigned_vars, | 2394 assigned_vars, |
| 2395 variable_count, | 2395 variable_count, |
| 2396 dominance_frontier); | 2396 dominance_frontier); |
| 2397 Rename(variable_count); | 2397 Rename(variable_count); |
| 2398 } | 2398 } |
| 2399 if (FLAG_print_flow_graph || (Dart::flow_graph_writer() != NULL)) { | 2399 if (FLAG_print_flow_graph || (Dart::flow_graph_writer() != NULL)) { |
| 2400 intptr_t length = postorder_block_entries_.length(); | 2400 intptr_t length = postorder_block_entries_.length(); |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2767 char* chars = reinterpret_cast<char*>( | 2767 char* chars = reinterpret_cast<char*>( |
| 2768 Isolate::Current()->current_zone()->Allocate(len)); | 2768 Isolate::Current()->current_zone()->Allocate(len)); |
| 2769 OS::SNPrint(chars, len, kFormat, function_name, reason); | 2769 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 2770 const Error& error = Error::Handle( | 2770 const Error& error = Error::Handle( |
| 2771 LanguageError::New(String::Handle(String::New(chars)))); | 2771 LanguageError::New(String::Handle(String::New(chars)))); |
| 2772 Isolate::Current()->long_jump_base()->Jump(1, error); | 2772 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 2773 } | 2773 } |
| 2774 | 2774 |
| 2775 | 2775 |
| 2776 } // namespace dart | 2776 } // namespace dart |
| OLD | NEW |