| 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/flags.h" | 8 #include "vm/flags.h" |
| 9 #include "vm/intermediate_language.h" | 9 #include "vm/intermediate_language.h" |
| 10 #include "vm/longjump.h" | 10 #include "vm/longjump.h" |
| (...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1497 instr->false_successor()->block_number()); | 1497 instr->false_successor()->block_number()); |
| 1498 } | 1498 } |
| 1499 | 1499 |
| 1500 | 1500 |
| 1501 void FlowGraphBuilder::BuildGraph() { | 1501 void FlowGraphBuilder::BuildGraph() { |
| 1502 if (FLAG_print_ast) { | 1502 if (FLAG_print_ast) { |
| 1503 // Print the function ast before IL generation. | 1503 // Print the function ast before IL generation. |
| 1504 AstPrinter::PrintFunctionNodes(parsed_function()); | 1504 AstPrinter::PrintFunctionNodes(parsed_function()); |
| 1505 } | 1505 } |
| 1506 const Function& function = parsed_function().function(); | 1506 const Function& function = parsed_function().function(); |
| 1507 if ((function.num_optional_parameters() != 0)) { | |
| 1508 Bailout("function has optional parameters"); | |
| 1509 } | |
| 1510 EffectGraphVisitor for_effect(this, 0); | 1507 EffectGraphVisitor for_effect(this, 0); |
| 1511 for_effect.AddInstruction(new TargetEntryInstr()); | 1508 for_effect.AddInstruction(new TargetEntryInstr()); |
| 1512 parsed_function().node_sequence()->Visit(&for_effect); | 1509 parsed_function().node_sequence()->Visit(&for_effect); |
| 1513 // Check that the graph is properly terminated. | 1510 // Check that the graph is properly terminated. |
| 1514 ASSERT(!for_effect.is_open()); | 1511 ASSERT(!for_effect.is_open()); |
| 1515 if (for_effect.entry() != NULL) { | 1512 if (for_effect.entry() != NULL) { |
| 1516 // Accumulate basic block entries via postorder traversal. | 1513 // Accumulate basic block entries via postorder traversal. |
| 1517 for_effect.entry()->Postorder(&postorder_block_entries_); | 1514 for_effect.entry()->Postorder(&postorder_block_entries_); |
| 1518 // Number the blocks in reverse postorder starting with 0. | 1515 // Number the blocks in reverse postorder starting with 0. |
| 1519 intptr_t last_index = postorder_block_entries_.length() - 1; | 1516 intptr_t last_index = postorder_block_entries_.length() - 1; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1535 char* chars = reinterpret_cast<char*>( | 1532 char* chars = reinterpret_cast<char*>( |
| 1536 Isolate::Current()->current_zone()->Allocate(len)); | 1533 Isolate::Current()->current_zone()->Allocate(len)); |
| 1537 OS::SNPrint(chars, len, kFormat, function_name, reason); | 1534 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 1538 const Error& error = Error::Handle( | 1535 const Error& error = Error::Handle( |
| 1539 LanguageError::New(String::Handle(String::New(chars)))); | 1536 LanguageError::New(String::Handle(String::New(chars)))); |
| 1540 Isolate::Current()->long_jump_base()->Jump(1, error); | 1537 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 1541 } | 1538 } |
| 1542 | 1539 |
| 1543 | 1540 |
| 1544 } // namespace dart | 1541 } // namespace dart |
| OLD | NEW |