| 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 RUNTIME_VM_FLOW_GRAPH_H_ | 5 #ifndef RUNTIME_VM_FLOW_GRAPH_H_ |
| 6 #define RUNTIME_VM_FLOW_GRAPH_H_ | 6 #define RUNTIME_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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 return parsed_function_.num_stack_locals(); | 96 return parsed_function_.num_stack_locals(); |
| 97 } | 97 } |
| 98 intptr_t num_copied_params() const { return num_copied_params_; } | 98 intptr_t num_copied_params() const { return num_copied_params_; } |
| 99 intptr_t num_non_copied_params() const { return num_non_copied_params_; } | 99 intptr_t num_non_copied_params() const { return num_non_copied_params_; } |
| 100 bool IsIrregexpFunction() const { return function().IsIrregexpFunction(); } | 100 bool IsIrregexpFunction() const { return function().IsIrregexpFunction(); } |
| 101 | 101 |
| 102 LocalVariable* CurrentContextVar() const { | 102 LocalVariable* CurrentContextVar() const { |
| 103 return parsed_function().current_context_var(); | 103 return parsed_function().current_context_var(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 LocalVariable* FunctionTypeArgsVar() const { |
| 107 return parsed_function().function_type_arguments(); |
| 108 } |
| 109 |
| 106 intptr_t CurrentContextEnvIndex() const { | 110 intptr_t CurrentContextEnvIndex() const { |
| 107 return parsed_function().current_context_var()->BitIndexIn( | 111 return parsed_function().current_context_var()->BitIndexIn( |
| 108 num_non_copied_params_); | 112 num_non_copied_params_); |
| 109 } | 113 } |
| 110 | 114 |
| 115 intptr_t FunctionTypeArgsEnvIndex() const { |
| 116 return parsed_function().function_type_arguments()->BitIndexIn( |
| 117 num_non_copied_params_); |
| 118 } |
| 119 |
| 111 // Flow graph orders. | 120 // Flow graph orders. |
| 112 const GrowableArray<BlockEntryInstr*>& preorder() const { return preorder_; } | 121 const GrowableArray<BlockEntryInstr*>& preorder() const { return preorder_; } |
| 113 const GrowableArray<BlockEntryInstr*>& postorder() const { | 122 const GrowableArray<BlockEntryInstr*>& postorder() const { |
| 114 return postorder_; | 123 return postorder_; |
| 115 } | 124 } |
| 116 const GrowableArray<BlockEntryInstr*>& reverse_postorder() const { | 125 const GrowableArray<BlockEntryInstr*>& reverse_postorder() const { |
| 117 return reverse_postorder_; | 126 return reverse_postorder_; |
| 118 } | 127 } |
| 119 static bool ShouldReorderBlocks(const Function& function, bool is_optimized); | 128 static bool ShouldReorderBlocks(const Function& function, bool is_optimized); |
| 120 GrowableArray<BlockEntryInstr*>* CodegenBlockOrder(bool is_optimized); | 129 GrowableArray<BlockEntryInstr*>* CodegenBlockOrder(bool is_optimized); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 Instruction* instr, | 202 Instruction* instr, |
| 194 Environment* env, | 203 Environment* env, |
| 195 UseKind use_kind); | 204 UseKind use_kind); |
| 196 Instruction* AppendTo(Instruction* prev, | 205 Instruction* AppendTo(Instruction* prev, |
| 197 Instruction* instr, | 206 Instruction* instr, |
| 198 Environment* env, | 207 Environment* env, |
| 199 UseKind use_kind); | 208 UseKind use_kind); |
| 200 | 209 |
| 201 // Operations on the flow graph. | 210 // Operations on the flow graph. |
| 202 void ComputeSSA(intptr_t next_virtual_register_number, | 211 void ComputeSSA(intptr_t next_virtual_register_number, |
| 203 ZoneGrowableArray<Definition*>* inlining_parameters); | 212 ZoneGrowableArray<Definition*>* inlining_parameters, |
| 213 Definition* inlining_type_args); |
| 204 | 214 |
| 205 // Verification methods for debugging. | 215 // Verification methods for debugging. |
| 206 bool VerifyUseLists(); | 216 bool VerifyUseLists(); |
| 207 bool VerifyRedefinitions(); | 217 bool VerifyRedefinitions(); |
| 208 | 218 |
| 209 void DiscoverBlocks(); | 219 void DiscoverBlocks(); |
| 210 | 220 |
| 211 void MergeBlocks(); | 221 void MergeBlocks(); |
| 212 | 222 |
| 213 // Compute information about effects occurring in different blocks and | 223 // Compute information about effects occurring in different blocks and |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 // SSA transformation methods and fields. | 337 // SSA transformation methods and fields. |
| 328 void ComputeDominators(GrowableArray<BitVector*>* dominance_frontier); | 338 void ComputeDominators(GrowableArray<BitVector*>* dominance_frontier); |
| 329 | 339 |
| 330 void CompressPath(intptr_t start_index, | 340 void CompressPath(intptr_t start_index, |
| 331 intptr_t current_index, | 341 intptr_t current_index, |
| 332 GrowableArray<intptr_t>* parent, | 342 GrowableArray<intptr_t>* parent, |
| 333 GrowableArray<intptr_t>* label); | 343 GrowableArray<intptr_t>* label); |
| 334 | 344 |
| 335 void Rename(GrowableArray<PhiInstr*>* live_phis, | 345 void Rename(GrowableArray<PhiInstr*>* live_phis, |
| 336 VariableLivenessAnalysis* variable_liveness, | 346 VariableLivenessAnalysis* variable_liveness, |
| 337 ZoneGrowableArray<Definition*>* inlining_parameters); | 347 ZoneGrowableArray<Definition*>* inlining_parameters, |
| 348 Definition* inlining_type_args); |
| 338 void RenameRecursive(BlockEntryInstr* block_entry, | 349 void RenameRecursive(BlockEntryInstr* block_entry, |
| 339 GrowableArray<Definition*>* env, | 350 GrowableArray<Definition*>* env, |
| 340 GrowableArray<PhiInstr*>* live_phis, | 351 GrowableArray<PhiInstr*>* live_phis, |
| 341 VariableLivenessAnalysis* variable_liveness); | 352 VariableLivenessAnalysis* variable_liveness); |
| 342 | 353 |
| 343 void AttachEnvironment(Instruction* instr, GrowableArray<Definition*>* env); | 354 void AttachEnvironment(Instruction* instr, GrowableArray<Definition*>* env); |
| 344 | 355 |
| 345 void InsertPhis(const GrowableArray<BlockEntryInstr*>& preorder, | 356 void InsertPhis(const GrowableArray<BlockEntryInstr*>& preorder, |
| 346 const GrowableArray<BitVector*>& assigned_vars, | 357 const GrowableArray<BitVector*>& assigned_vars, |
| 347 const GrowableArray<BitVector*>& dom_frontier, | 358 const GrowableArray<BitVector*>& dom_frontier, |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 | 572 |
| 562 private: | 573 private: |
| 563 GrowableArray<Definition*> defs_; | 574 GrowableArray<Definition*> defs_; |
| 564 BitVector* contains_vector_; | 575 BitVector* contains_vector_; |
| 565 }; | 576 }; |
| 566 | 577 |
| 567 | 578 |
| 568 } // namespace dart | 579 } // namespace dart |
| 569 | 580 |
| 570 #endif // RUNTIME_VM_FLOW_GRAPH_H_ | 581 #endif // RUNTIME_VM_FLOW_GRAPH_H_ |
| OLD | NEW |