| 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.h" | 5 #include "vm/flow_graph.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/flow_graph_builder.h" | 8 #include "vm/flow_graph_builder.h" |
| 9 #include "vm/intermediate_language.h" | 9 #include "vm/intermediate_language.h" |
| 10 #include "vm/longjump.h" | 10 #include "vm/longjump.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 graph_entry_->DiscoverBlocks(NULL, // Entry block predecessor. | 44 graph_entry_->DiscoverBlocks(NULL, // Entry block predecessor. |
| 45 &preorder_, | 45 &preorder_, |
| 46 &postorder_, | 46 &postorder_, |
| 47 &parent_, | 47 &parent_, |
| 48 &assigned_vars_, | 48 &assigned_vars_, |
| 49 variable_count(), | 49 variable_count(), |
| 50 num_non_copied_params()); | 50 num_non_copied_params()); |
| 51 // Number blocks in reverse postorder. | 51 // Number blocks in reverse postorder. |
| 52 intptr_t block_count = postorder_.length(); | 52 intptr_t block_count = postorder_.length(); |
| 53 for (intptr_t i = 0; i < block_count; ++i) { | 53 for (intptr_t i = 0; i < block_count; ++i) { |
| 54 postorder_[i]->set_block_id(block_count - i - 1); | |
| 55 reverse_postorder_.Add(postorder_[block_count - i - 1]); | 54 reverse_postorder_.Add(postorder_[block_count - i - 1]); |
| 56 } | 55 } |
| 57 // Link instructions backwards for optimized compilation. | 56 // Link instructions backwards for optimized compilation. |
| 58 // TODO(zerny): The builder should do this at construction time. | 57 // TODO(zerny): The builder should do this at construction time. |
| 59 for (intptr_t i = 0; i < block_count; ++i) { | 58 for (intptr_t i = 0; i < block_count; ++i) { |
| 60 BlockEntryInstr* entry = postorder_[i]; | 59 BlockEntryInstr* entry = postorder_[i]; |
| 61 Instruction* previous = entry; | 60 Instruction* previous = entry; |
| 62 for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) { | 61 for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) { |
| 63 Instruction* current = it.Current(); | 62 Instruction* current = it.Current(); |
| 64 current->set_previous(previous); | 63 current->set_previous(previous); |
| (...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 // TODO(zerny): Support multiple exits. | 789 // TODO(zerny): Support multiple exits. |
| 791 UNREACHABLE(); | 790 UNREACHABLE(); |
| 792 } | 791 } |
| 793 | 792 |
| 794 // TODO(zerny): Adjust pre/post orders. | 793 // TODO(zerny): Adjust pre/post orders. |
| 795 // TODO(zerny): Update dominator tree. | 794 // TODO(zerny): Update dominator tree. |
| 796 } | 795 } |
| 797 | 796 |
| 798 | 797 |
| 799 } // namespace dart | 798 } // namespace dart |
| OLD | NEW |