| OLD | NEW |
| 1 // Copyright (c) 2013, 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/intermediate_language.h" |
| 9 #include "vm/parser.h" | 10 #include "vm/parser.h" |
| 10 | 11 |
| 11 namespace dart { | 12 namespace dart { |
| 12 | 13 |
| 13 class BlockEntryInstr; | |
| 14 class ConstantInstr; | |
| 15 class Definition; | |
| 16 class FlowGraphBuilder; | 14 class FlowGraphBuilder; |
| 17 class GraphEntryInstr; | |
| 18 class PhiInstr; | |
| 19 class ReturnInstr; | |
| 20 class ValueInliningContext; | 15 class ValueInliningContext; |
| 21 | 16 |
| 22 class BlockIterator : public ValueObject { | 17 class BlockIterator : public ValueObject { |
| 23 public: | 18 public: |
| 24 explicit BlockIterator(const GrowableArray<BlockEntryInstr*>& block_order) | 19 explicit BlockIterator(const GrowableArray<BlockEntryInstr*>& block_order) |
| 25 : block_order_(block_order), current_(0) { } | 20 : block_order_(block_order), current_(0) { } |
| 26 | 21 |
| 27 BlockIterator(const BlockIterator& other) | 22 BlockIterator(const BlockIterator& other) |
| 28 : ValueObject(), | 23 : ValueObject(), |
| 29 block_order_(other.block_order_), | 24 block_order_(other.block_order_), |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 return constant_null_; | 105 return constant_null_; |
| 111 } | 106 } |
| 112 | 107 |
| 113 intptr_t alloc_ssa_temp_index() { return current_ssa_temp_index_++; } | 108 intptr_t alloc_ssa_temp_index() { return current_ssa_temp_index_++; } |
| 114 | 109 |
| 115 intptr_t InstructionCount() const; | 110 intptr_t InstructionCount() const; |
| 116 | 111 |
| 117 ConstantInstr* AddConstantToInitialDefinitions(const Object& object); | 112 ConstantInstr* AddConstantToInitialDefinitions(const Object& object); |
| 118 void AddToInitialDefinitions(Definition* defn); | 113 void AddToInitialDefinitions(Definition* defn); |
| 119 | 114 |
| 115 void InsertBefore(Instruction* next, |
| 116 Instruction* instr, |
| 117 Environment* env, |
| 118 Definition::UseKind use_kind); |
| 119 void InsertAfter(Instruction* prev, |
| 120 Instruction* instr, |
| 121 Environment* env, |
| 122 Definition::UseKind use_kind); |
| 123 |
| 120 // Operations on the flow graph. | 124 // Operations on the flow graph. |
| 121 void ComputeSSA(intptr_t next_virtual_register_number, | 125 void ComputeSSA(intptr_t next_virtual_register_number, |
| 122 GrowableArray<Definition*>* inlining_parameters); | 126 GrowableArray<Definition*>* inlining_parameters); |
| 123 void ComputeUseLists(); | 127 void ComputeUseLists(); |
| 124 | 128 |
| 125 // Finds natural loops in the flow graph and attaches a list of loop | 129 // Finds natural loops in the flow graph and attaches a list of loop |
| 126 // body blocks for each loop header. | 130 // body blocks for each loop header. |
| 127 void ComputeLoops(GrowableArray<BlockEntryInstr*>* loop_headers); | 131 void ComputeLoops(GrowableArray<BlockEntryInstr*>* loop_headers); |
| 128 | 132 |
| 129 void RepairGraphAfterInlining(); | 133 void RepairGraphAfterInlining(); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 GrowableArray<BlockEntryInstr*> preorder_; | 191 GrowableArray<BlockEntryInstr*> preorder_; |
| 188 GrowableArray<BlockEntryInstr*> postorder_; | 192 GrowableArray<BlockEntryInstr*> postorder_; |
| 189 GrowableArray<BlockEntryInstr*> reverse_postorder_; | 193 GrowableArray<BlockEntryInstr*> reverse_postorder_; |
| 190 bool invalid_dominator_tree_; | 194 bool invalid_dominator_tree_; |
| 191 ConstantInstr* constant_null_; | 195 ConstantInstr* constant_null_; |
| 192 }; | 196 }; |
| 193 | 197 |
| 194 } // namespace dart | 198 } // namespace dart |
| 195 | 199 |
| 196 #endif // VM_FLOW_GRAPH_H_ | 200 #endif // VM_FLOW_GRAPH_H_ |
| OLD | NEW |