| 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 #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 Definition; | 14 class Definition; |
| 15 class FlowGraphBuilder; | 15 class FlowGraphBuilder; |
| 16 class GraphEntryInstr; | 16 class GraphEntryInstr; |
| 17 class PhiInstr; | 17 class PhiInstr; |
| 18 class ReturnInstr; | 18 class ReturnInstr; |
| 19 class StaticCallInstr; | |
| 20 | |
| 21 | 19 |
| 22 class BlockIterator : public ValueObject { | 20 class BlockIterator : public ValueObject { |
| 23 public: | 21 public: |
| 24 explicit BlockIterator(const GrowableArray<BlockEntryInstr*>& block_order) | 22 explicit BlockIterator(const GrowableArray<BlockEntryInstr*>& block_order) |
| 25 : block_order_(block_order), current_(0) { } | 23 : block_order_(block_order), current_(0) { } |
| 26 | 24 |
| 27 void Advance() { | 25 void Advance() { |
| 28 ASSERT(!Done()); | 26 ASSERT(!Done()); |
| 29 current_++; | 27 current_++; |
| 30 } | 28 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 GraphEntryInstr* graph_entry() const { | 88 GraphEntryInstr* graph_entry() const { |
| 91 return graph_entry_; | 89 return graph_entry_; |
| 92 } | 90 } |
| 93 | 91 |
| 94 ZoneGrowableArray<ReturnInstr*>* exits() const { return exits_; } | 92 ZoneGrowableArray<ReturnInstr*>* exits() const { return exits_; } |
| 95 void set_exits(ZoneGrowableArray<ReturnInstr*>* exits) { exits_ = exits; } | 93 void set_exits(ZoneGrowableArray<ReturnInstr*>* exits) { exits_ = exits; } |
| 96 | 94 |
| 97 intptr_t alloc_ssa_temp_index() { return current_ssa_temp_index_++; } | 95 intptr_t alloc_ssa_temp_index() { return current_ssa_temp_index_++; } |
| 98 | 96 |
| 99 // Operations on the flow graph. | 97 // Operations on the flow graph. |
| 100 void ComputeSSA(intptr_t next_virtual_register_number = 0); | 98 void ComputeSSA(intptr_t next_virtual_register_number); |
| 101 void ComputeUseLists(); | 99 void ComputeUseLists(); |
| 102 | 100 |
| 103 // Finds natural loops in the flow graph and attaches a list of loop | 101 // Finds natural loops in the flow graph and attaches a list of loop |
| 104 // body blocks for each loop header. | 102 // body blocks for each loop header. |
| 105 void ComputeLoops(GrowableArray<BlockEntryInstr*>* loop_headers); | 103 void ComputeLoops(GrowableArray<BlockEntryInstr*>* loop_headers); |
| 106 | 104 |
| 107 void InlineCall(StaticCallInstr* call, FlowGraph* callee_graph); | 105 void InlineCall(Definition* call, FlowGraph* callee_graph); |
| 108 | 106 |
| 109 // TODO(zerny): Once the SSA is feature complete this should be removed. | 107 // TODO(zerny): Once the SSA is feature complete this should be removed. |
| 110 void Bailout(const char* reason) const; | 108 void Bailout(const char* reason) const; |
| 111 | 109 |
| 112 #ifdef DEBUG | 110 #ifdef DEBUG |
| 113 // Validation methods for debugging. | 111 // Validation methods for debugging. |
| 114 bool ResetUseLists(); | 112 bool ResetUseLists(); |
| 115 bool ValidateUseLists(); | 113 bool ValidateUseLists(); |
| 116 #endif // DEBUG | 114 #endif // DEBUG |
| 117 | 115 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 GraphEntryInstr* graph_entry_; | 158 GraphEntryInstr* graph_entry_; |
| 161 GrowableArray<BlockEntryInstr*> preorder_; | 159 GrowableArray<BlockEntryInstr*> preorder_; |
| 162 GrowableArray<BlockEntryInstr*> postorder_; | 160 GrowableArray<BlockEntryInstr*> postorder_; |
| 163 GrowableArray<BlockEntryInstr*> reverse_postorder_; | 161 GrowableArray<BlockEntryInstr*> reverse_postorder_; |
| 164 ZoneGrowableArray<ReturnInstr*>* exits_; | 162 ZoneGrowableArray<ReturnInstr*>* exits_; |
| 165 }; | 163 }; |
| 166 | 164 |
| 167 } // namespace dart | 165 } // namespace dart |
| 168 | 166 |
| 169 #endif // VM_FLOW_GRAPH_H_ | 167 #endif // VM_FLOW_GRAPH_H_ |
| OLD | NEW |