Chromium Code Reviews| 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 BindInstr; | |
| 13 class BlockEntryInstr; | 14 class BlockEntryInstr; |
| 15 class StaticCallComp; | |
| 14 class Definition; | 16 class Definition; |
| 15 class FlowGraphBuilder; | 17 class FlowGraphBuilder; |
| 16 class GraphEntryInstr; | 18 class GraphEntryInstr; |
| 17 class PhiInstr; | 19 class PhiInstr; |
| 20 class ReturnInstr; | |
| 18 | 21 |
| 19 // Class to incapsulate the construction and manipulation of the flow graph. | 22 // Class to incapsulate the construction and manipulation of the flow graph. |
| 20 class FlowGraph: public ZoneAllocated { | 23 class FlowGraph: public ZoneAllocated { |
| 21 public: | 24 public: |
| 22 FlowGraph(const FlowGraphBuilder& builder, GraphEntryInstr* graph_entry); | 25 FlowGraph(const FlowGraphBuilder& builder, GraphEntryInstr* graph_entry); |
| 23 | 26 |
| 24 // Function properties. | 27 // Function properties. |
| 25 const ParsedFunction& parsed_function() const { | 28 const ParsedFunction& parsed_function() const { |
| 26 return parsed_function_; | 29 return parsed_function_; |
| 27 } | 30 } |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 53 } | 56 } |
| 54 | 57 |
| 55 intptr_t max_virtual_register_number() const { | 58 intptr_t max_virtual_register_number() const { |
| 56 return current_ssa_temp_index(); | 59 return current_ssa_temp_index(); |
| 57 } | 60 } |
| 58 | 61 |
| 59 GraphEntryInstr* graph_entry() const { | 62 GraphEntryInstr* graph_entry() const { |
| 60 return graph_entry_; | 63 return graph_entry_; |
| 61 } | 64 } |
| 62 | 65 |
| 66 ZoneGrowableArray<ReturnInstr*>* exits() const { return exits_; } | |
| 67 void set_exits(ZoneGrowableArray<ReturnInstr*>* exits) { exits_ = exits; } | |
| 68 | |
| 63 intptr_t alloc_ssa_temp_index() { return current_ssa_temp_index_++; } | 69 intptr_t alloc_ssa_temp_index() { return current_ssa_temp_index_++; } |
| 64 | 70 |
| 65 // Operations on the flow graph. | 71 // Operations on the flow graph. |
| 66 void ComputeSSA(); | 72 void ComputeSSA(intptr_t next_virtual_register_number = 0); |
|
srdjan
2012/09/05 17:40:05
Avoid using default arguments. There is only one c
zerny-google
2012/09/07 14:08:43
Done. (In next CL for inlining monomorphic calls.)
| |
| 67 void ComputeUseLists(); | 73 void ComputeUseLists(); |
| 68 | 74 |
| 75 void InlineCall(BindInstr* caller_instr, | |
| 76 StaticCallComp* caller_comp, | |
| 77 FlowGraph* callee_graph); | |
| 78 | |
| 69 // TODO(zerny): Once the SSA is feature complete this should be removed. | 79 // TODO(zerny): Once the SSA is feature complete this should be removed. |
| 70 void Bailout(const char* reason) const; | 80 void Bailout(const char* reason) const; |
| 71 | 81 |
| 72 #ifdef DEBUG | 82 #ifdef DEBUG |
| 73 // Validation methods for debugging. | 83 // Validation methods for debugging. |
| 74 bool ResetUseLists(); | 84 bool ResetUseLists(); |
| 75 bool ValidateUseLists(); | 85 bool ValidateUseLists(); |
| 76 #endif // DEBUG | 86 #endif // DEBUG |
| 77 | 87 |
| 78 private: | 88 private: |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 | 124 |
| 115 // Flow graph fields. | 125 // Flow graph fields. |
| 116 const ParsedFunction& parsed_function_; | 126 const ParsedFunction& parsed_function_; |
| 117 const intptr_t copied_parameter_count_; | 127 const intptr_t copied_parameter_count_; |
| 118 const intptr_t non_copied_parameter_count_; | 128 const intptr_t non_copied_parameter_count_; |
| 119 const intptr_t stack_local_count_; | 129 const intptr_t stack_local_count_; |
| 120 GraphEntryInstr* graph_entry_; | 130 GraphEntryInstr* graph_entry_; |
| 121 GrowableArray<BlockEntryInstr*> preorder_; | 131 GrowableArray<BlockEntryInstr*> preorder_; |
| 122 GrowableArray<BlockEntryInstr*> postorder_; | 132 GrowableArray<BlockEntryInstr*> postorder_; |
| 123 GrowableArray<BlockEntryInstr*> reverse_postorder_; | 133 GrowableArray<BlockEntryInstr*> reverse_postorder_; |
| 134 ZoneGrowableArray<ReturnInstr*>* exits_; | |
| 124 }; | 135 }; |
| 125 | 136 |
| 126 } // namespace dart | 137 } // namespace dart |
| 127 | 138 |
| 128 #endif // VM_FLOW_GRAPH_H_ | 139 #endif // VM_FLOW_GRAPH_H_ |
| OLD | NEW |