OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 #ifndef VM_FLOW_GRAPH_H_ | 5 #ifndef VM_FLOW_GRAPH_H_ |
6 #define VM_FLOW_GRAPH_H_ | 6 #define VM_FLOW_GRAPH_H_ |
7 | 7 |
8 #include "vm/growable_array.h" | 8 #include "vm/growable_array.h" |
9 #include "vm/parser.h" | 9 #include "vm/parser.h" |
10 | 10 |
11 namespace dart { | 11 namespace dart { |
12 | 12 |
13 class BlockEntryInstr; | 13 class BlockEntryInstr; |
14 class ConstantInstr; | 14 class ConstantInstr; |
15 class Definition; | 15 class Definition; |
16 class FlowGraphBuilder; | 16 class FlowGraphBuilder; |
17 class GraphEntryInstr; | 17 class GraphEntryInstr; |
18 class PhiInstr; | 18 class PhiInstr; |
19 class ReturnInstr; | 19 class ReturnInstr; |
20 class ValueInliningContext; | 20 class ValueInliningContext; |
21 | 21 |
22 class BlockIterator : public ValueObject { | 22 class BlockIterator : public ValueObject { |
23 public: | 23 public: |
24 explicit BlockIterator(const GrowableArray<BlockEntryInstr*>& block_order) | 24 explicit BlockIterator(const GrowableArray<BlockEntryInstr*>& block_order) |
25 : block_order_(block_order), current_(0) { } | 25 : block_order_(block_order), current_(0) { } |
26 | 26 |
| 27 BlockIterator(const BlockIterator& other) |
| 28 : ValueObject(), |
| 29 block_order_(other.block_order_), |
| 30 current_(other.current_) { } |
| 31 |
27 void Advance() { | 32 void Advance() { |
28 ASSERT(!Done()); | 33 ASSERT(!Done()); |
29 current_++; | 34 current_++; |
30 } | 35 } |
31 | 36 |
32 bool Done() const { return current_ >= block_order_.length(); } | 37 bool Done() const { return current_ >= block_order_.length(); } |
33 | 38 |
34 BlockEntryInstr* Current() const { return block_order_[current_]; } | 39 BlockEntryInstr* Current() const { return block_order_[current_]; } |
35 | 40 |
36 private: | 41 private: |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 GraphEntryInstr* graph_entry_; | 181 GraphEntryInstr* graph_entry_; |
177 GrowableArray<BlockEntryInstr*> preorder_; | 182 GrowableArray<BlockEntryInstr*> preorder_; |
178 GrowableArray<BlockEntryInstr*> postorder_; | 183 GrowableArray<BlockEntryInstr*> postorder_; |
179 GrowableArray<BlockEntryInstr*> reverse_postorder_; | 184 GrowableArray<BlockEntryInstr*> reverse_postorder_; |
180 bool invalid_dominator_tree_; | 185 bool invalid_dominator_tree_; |
181 }; | 186 }; |
182 | 187 |
183 } // namespace dart | 188 } // namespace dart |
184 | 189 |
185 #endif // VM_FLOW_GRAPH_H_ | 190 #endif // VM_FLOW_GRAPH_H_ |
OLD | NEW |