| 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/flags.h" | 7 #include "vm/flags.h" |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 #include "vm/os.h" | 9 #include "vm/os.h" |
| 10 #include "vm/parser.h" | 10 #include "vm/parser.h" |
| (...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 872 parsed_function().function().ToFullyQualifiedCString()); | 872 parsed_function().function().ToFullyQualifiedCString()); |
| 873 | 873 |
| 874 for (intptr_t i = postorder_block_entries_.length() - 1; i >= 0; --i) { | 874 for (intptr_t i = postorder_block_entries_.length() - 1; i >= 0; --i) { |
| 875 // Print the block entry. | 875 // Print the block entry. |
| 876 Instruction* current = postorder_block_entries_[i]->Print(); | 876 Instruction* current = postorder_block_entries_[i]->Print(); |
| 877 // And all the successors until an exit, branch, or a block entry. | 877 // And all the successors until an exit, branch, or a block entry. |
| 878 while ((current != NULL) && !current->IsBlockEntry()) { | 878 while ((current != NULL) && !current->IsBlockEntry()) { |
| 879 OS::Print("\n"); | 879 OS::Print("\n"); |
| 880 current = current->Print(); | 880 current = current->Print(); |
| 881 } | 881 } |
| 882 if (current != NULL && current->IsBlockEntry()) { | 882 if ((current != NULL) && current->IsBlockEntry()) { |
| 883 OS::Print(" goto %d", current->GetBlockNumber()); | 883 OS::Print(" goto %d", BlockEntryInstr::cast(current)->block_number()); |
| 884 } | 884 } |
| 885 OS::Print("\n"); | 885 OS::Print("\n"); |
| 886 } | 886 } |
| 887 } | 887 } |
| 888 | 888 |
| 889 | 889 |
| 890 void FlowGraphBuilder::BuildGraph() { | 890 void FlowGraphBuilder::BuildGraph() { |
| 891 EffectGraphVisitor for_effect(this, 0); | 891 EffectGraphVisitor for_effect(this, 0); |
| 892 for_effect.AddInstruction(new TargetEntryInstr()); | 892 for_effect.AddInstruction(new TargetEntryInstr()); |
| 893 parsed_function().node_sequence()->Visit(&for_effect); | 893 parsed_function().node_sequence()->Visit(&for_effect); |
| 894 TraceBailout(); | 894 TraceBailout(); |
| 895 if (!HasBailedOut() && (for_effect.entry() != NULL)) { | 895 if (!HasBailedOut() && (for_effect.entry() != NULL)) { |
| 896 // Accumulate basic block entries via postorder traversal. | 896 // Accumulate basic block entries via postorder traversal. |
| 897 for_effect.entry()->Postorder(&postorder_block_entries_); | 897 for_effect.entry()->Postorder(&postorder_block_entries_); |
| 898 // Number the blocks in reverse postorder starting with 0. | 898 // Number the blocks in reverse postorder starting with 0. |
| 899 intptr_t last_index = postorder_block_entries_.length() - 1; | 899 intptr_t last_index = postorder_block_entries_.length() - 1; |
| 900 for (intptr_t i = last_index; i >= 0; --i) { | 900 for (intptr_t i = last_index; i >= 0; --i) { |
| 901 postorder_block_entries_[i]->SetBlockNumber(last_index - i); | 901 postorder_block_entries_[i]->set_block_number(last_index - i); |
| 902 } | 902 } |
| 903 } | 903 } |
| 904 PrintGraph(); | 904 PrintGraph(); |
| 905 } | 905 } |
| 906 | 906 |
| 907 } // namespace dart | 907 } // namespace dart |
| OLD | NEW |