Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: runtime/vm/flow_graph.h

Issue 11856010: Change the inlining context from an enum to a class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 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 21
21 class BlockIterator : public ValueObject { 22 class BlockIterator : public ValueObject {
22 public: 23 public:
23 explicit BlockIterator(const GrowableArray<BlockEntryInstr*>& block_order) 24 explicit BlockIterator(const GrowableArray<BlockEntryInstr*>& block_order)
24 : block_order_(block_order), current_(0) { } 25 : block_order_(block_order), current_(0) { }
25 26
26 void Advance() { 27 void Advance() {
27 ASSERT(!Done()); 28 ASSERT(!Done());
28 current_++; 29 current_++;
29 } 30 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 } 92 }
92 93
93 intptr_t max_block_id() const { 94 intptr_t max_block_id() const {
94 return max_block_id_; 95 return max_block_id_;
95 } 96 }
96 97
97 GraphEntryInstr* graph_entry() const { 98 GraphEntryInstr* graph_entry() const {
98 return graph_entry_; 99 return graph_entry_;
99 } 100 }
100 101
101 ZoneGrowableArray<ReturnInstr*>* exits() const { return exits_; }
102 void set_exits(ZoneGrowableArray<ReturnInstr*>* exits) { exits_ = exits; }
103
104 intptr_t alloc_ssa_temp_index() { return current_ssa_temp_index_++; } 102 intptr_t alloc_ssa_temp_index() { return current_ssa_temp_index_++; }
105 103
106 intptr_t InstructionCount() const; 104 intptr_t InstructionCount() const;
107 105
108 ConstantInstr* AddConstantToInitialDefinitions(const Object& object); 106 ConstantInstr* AddConstantToInitialDefinitions(const Object& object);
109 void AddToInitialDefinitions(Definition* defn); 107 void AddToInitialDefinitions(Definition* defn);
110 108
111 // Operations on the flow graph. 109 // Operations on the flow graph.
112 void ComputeSSA(intptr_t next_virtual_register_number, 110 void ComputeSSA(intptr_t next_virtual_register_number,
113 GrowableArray<Definition*>* inlining_parameters); 111 GrowableArray<Definition*>* inlining_parameters);
114 void ComputeUseLists(); 112 void ComputeUseLists();
115 113
116 // Finds natural loops in the flow graph and attaches a list of loop 114 // Finds natural loops in the flow graph and attaches a list of loop
117 // body blocks for each loop header. 115 // body blocks for each loop header.
118 void ComputeLoops(GrowableArray<BlockEntryInstr*>* loop_headers); 116 void ComputeLoops(GrowableArray<BlockEntryInstr*>* loop_headers);
119 117
120 void InlineCall(Definition* call, FlowGraph* callee_graph); 118 void InlineCall(Definition* call,
119 FlowGraph* callee_graph,
120 ValueInliningContext* inlining_context);
121 void RepairGraphAfterInlining(); 121 void RepairGraphAfterInlining();
122 122
123 // TODO(zerny): Once the SSA is feature complete this should be removed. 123 // TODO(zerny): Once the SSA is feature complete this should be removed.
124 void Bailout(const char* reason) const; 124 void Bailout(const char* reason) const;
125 125
126 #ifdef DEBUG 126 #ifdef DEBUG
127 // Validation methods for debugging. 127 // Validation methods for debugging.
128 bool ResetUseLists(); 128 bool ResetUseLists();
129 bool ValidateUseLists(); 129 bool ValidateUseLists();
130 #endif // DEBUG 130 #endif // DEBUG
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 170
171 // Flow graph fields. 171 // Flow graph fields.
172 const ParsedFunction& parsed_function_; 172 const ParsedFunction& parsed_function_;
173 const intptr_t num_copied_params_; 173 const intptr_t num_copied_params_;
174 const intptr_t num_non_copied_params_; 174 const intptr_t num_non_copied_params_;
175 const intptr_t num_stack_locals_; 175 const intptr_t num_stack_locals_;
176 GraphEntryInstr* graph_entry_; 176 GraphEntryInstr* graph_entry_;
177 GrowableArray<BlockEntryInstr*> preorder_; 177 GrowableArray<BlockEntryInstr*> preorder_;
178 GrowableArray<BlockEntryInstr*> postorder_; 178 GrowableArray<BlockEntryInstr*> postorder_;
179 GrowableArray<BlockEntryInstr*> reverse_postorder_; 179 GrowableArray<BlockEntryInstr*> reverse_postorder_;
180 ZoneGrowableArray<ReturnInstr*>* exits_;
181 bool invalid_dominator_tree_; 180 bool invalid_dominator_tree_;
182 }; 181 };
183 182
184 } // namespace dart 183 } // namespace dart
185 184
186 #endif // VM_FLOW_GRAPH_H_ 185 #endif // VM_FLOW_GRAPH_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698