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/bit_vector.h" | 8 #include "vm/bit_vector.h" |
9 #include "vm/growable_array.h" | 9 #include "vm/growable_array.h" |
10 #include "vm/hash_map.h" | 10 #include "vm/hash_map.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
104 intptr_t num_stack_locals() const { | 104 intptr_t num_stack_locals() const { |
105 return num_stack_locals_; | 105 return num_stack_locals_; |
106 } | 106 } |
107 intptr_t num_copied_params() const { | 107 intptr_t num_copied_params() const { |
108 return num_copied_params_; | 108 return num_copied_params_; |
109 } | 109 } |
110 intptr_t num_non_copied_params() const { | 110 intptr_t num_non_copied_params() const { |
111 return num_non_copied_params_; | 111 return num_non_copied_params_; |
112 } | 112 } |
113 | 113 |
114 LocalVariable* CurrentContextVar() const { | |
115 return parsed_function().saved_current_context_var(); | |
116 } | |
117 | |
118 intptr_t CurrentContextEnvIndex() const { | |
119 return parsed_function().saved_current_context_var()->BitIndexIn( | |
120 num_non_copied_params_); | |
121 } | |
122 | |
114 // Flow graph orders. | 123 // Flow graph orders. |
115 const GrowableArray<BlockEntryInstr*>& preorder() const { | 124 const GrowableArray<BlockEntryInstr*>& preorder() const { |
116 return preorder_; | 125 return preorder_; |
117 } | 126 } |
118 const GrowableArray<BlockEntryInstr*>& postorder() const { | 127 const GrowableArray<BlockEntryInstr*>& postorder() const { |
119 return postorder_; | 128 return postorder_; |
120 } | 129 } |
121 const GrowableArray<BlockEntryInstr*>& reverse_postorder() const { | 130 const GrowableArray<BlockEntryInstr*>& reverse_postorder() const { |
122 return reverse_postorder_; | 131 return reverse_postorder_; |
123 } | 132 } |
(...skipping 28 matching lines...) Expand all Loading... | |
152 } | 161 } |
153 | 162 |
154 ConstantInstr* constant_null() const { | 163 ConstantInstr* constant_null() const { |
155 return constant_null_; | 164 return constant_null_; |
156 } | 165 } |
157 | 166 |
158 ConstantInstr* constant_dead() const { | 167 ConstantInstr* constant_dead() const { |
159 return constant_dead_; | 168 return constant_dead_; |
160 } | 169 } |
161 | 170 |
171 ConstantInstr* constant_empty_context() const { | |
172 return constant_empty_context_; | |
173 } | |
174 | |
175 Definition* CurrentContext(Environment* env) const { | |
176 while (env->outer() != NULL) env = env->outer(); | |
Vyacheslav Egorov (Google)
2014/10/28 13:44:58
Kill this function. It's also a bit suspicious.
Florian Schneider
2014/10/28 19:04:31
Done.
| |
177 return env->ValueAt(CurrentContextEnvIndex())->definition(); | |
178 } | |
179 | |
162 intptr_t alloc_ssa_temp_index() { return current_ssa_temp_index_++; } | 180 intptr_t alloc_ssa_temp_index() { return current_ssa_temp_index_++; } |
163 | 181 |
164 void AllocateSSAIndexes(Definition* def) { | 182 void AllocateSSAIndexes(Definition* def) { |
165 ASSERT(def); | 183 ASSERT(def); |
166 def->set_ssa_temp_index(alloc_ssa_temp_index()); | 184 def->set_ssa_temp_index(alloc_ssa_temp_index()); |
167 // Always allocate a second index. This index is unused except | 185 // Always allocate a second index. This index is unused except |
168 // for Definitions with register pair outputs. | 186 // for Definitions with register pair outputs. |
169 alloc_ssa_temp_index(); | 187 alloc_ssa_temp_index(); |
170 } | 188 } |
171 | 189 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
326 const intptr_t num_copied_params_; | 344 const intptr_t num_copied_params_; |
327 const intptr_t num_non_copied_params_; | 345 const intptr_t num_non_copied_params_; |
328 const intptr_t num_stack_locals_; | 346 const intptr_t num_stack_locals_; |
329 GraphEntryInstr* graph_entry_; | 347 GraphEntryInstr* graph_entry_; |
330 GrowableArray<BlockEntryInstr*> preorder_; | 348 GrowableArray<BlockEntryInstr*> preorder_; |
331 GrowableArray<BlockEntryInstr*> postorder_; | 349 GrowableArray<BlockEntryInstr*> postorder_; |
332 GrowableArray<BlockEntryInstr*> reverse_postorder_; | 350 GrowableArray<BlockEntryInstr*> reverse_postorder_; |
333 GrowableArray<BlockEntryInstr*> optimized_block_order_; | 351 GrowableArray<BlockEntryInstr*> optimized_block_order_; |
334 ConstantInstr* constant_null_; | 352 ConstantInstr* constant_null_; |
335 ConstantInstr* constant_dead_; | 353 ConstantInstr* constant_dead_; |
354 ConstantInstr* constant_empty_context_; | |
355 Definition* current_context_; | |
Vyacheslav Egorov (Google)
2014/10/28 13:44:58
Kill this with fire.
Florian Schneider
2014/10/28 19:04:31
Done.
| |
336 | 356 |
337 BlockEffects* block_effects_; | 357 BlockEffects* block_effects_; |
338 bool licm_allowed_; | 358 bool licm_allowed_; |
339 | 359 |
340 ZoneGrowableArray<BlockEntryInstr*>* loop_headers_; | 360 ZoneGrowableArray<BlockEntryInstr*>* loop_headers_; |
341 ZoneGrowableArray<BitVector*>* loop_invariant_loads_; | 361 ZoneGrowableArray<BitVector*>* loop_invariant_loads_; |
342 ZoneGrowableArray<const Field*>* guarded_fields_; | 362 ZoneGrowableArray<const Field*>* guarded_fields_; |
343 ZoneGrowableArray<const LibraryPrefix*>* deferred_prefixes_; | 363 ZoneGrowableArray<const LibraryPrefix*>* deferred_prefixes_; |
344 DirectChainedHashMap<ConstantPoolTrait> constant_instr_pool_; | 364 DirectChainedHashMap<ConstantPoolTrait> constant_instr_pool_; |
345 BitVector* captured_parameters_; | 365 BitVector* captured_parameters_; |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
491 | 511 |
492 private: | 512 private: |
493 GrowableArray<Definition*> defs_; | 513 GrowableArray<Definition*> defs_; |
494 BitVector* contains_vector_; | 514 BitVector* contains_vector_; |
495 }; | 515 }; |
496 | 516 |
497 | 517 |
498 } // namespace dart | 518 } // namespace dart |
499 | 519 |
500 #endif // VM_FLOW_GRAPH_H_ | 520 #endif // VM_FLOW_GRAPH_H_ |
OLD | NEW |