| 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/intermediate_language.h" |
| 10 #include "vm/parser.h" | 10 #include "vm/parser.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 void DiscoverBlocks(); | 143 void DiscoverBlocks(); |
| 144 | 144 |
| 145 // Compute information about effects occuring in different blocks and | 145 // Compute information about effects occuring in different blocks and |
| 146 // discover side-effect free paths. | 146 // discover side-effect free paths. |
| 147 void ComputeBlockEffects(); | 147 void ComputeBlockEffects(); |
| 148 BlockEffects* block_effects() const { return block_effects_; } | 148 BlockEffects* block_effects() const { return block_effects_; } |
| 149 | 149 |
| 150 // Remove the redefinition instructions inserted to inhibit code motion. | 150 // Remove the redefinition instructions inserted to inhibit code motion. |
| 151 void RemoveRedefinitions(); | 151 void RemoveRedefinitions(); |
| 152 | 152 |
| 153 // Copy deoptimization target from one instruction to another if we still |
| 154 // have to keep deoptimization environment at gotos for LICM purposes. |
| 155 void CopyDeoptTarget(Instruction* to, Instruction* from) { |
| 156 if (is_licm_allowed()) { |
| 157 to->InheritDeoptTarget(from); |
| 158 } |
| 159 } |
| 160 |
| 161 // Returns true if every Goto in the graph is expected to have a |
| 162 // deoptimization environment and can be used as deoptimization target |
| 163 // for hoisted instructions. |
| 164 bool is_licm_allowed() const { return licm_allowed_; } |
| 165 |
| 166 // Stop preserving environments on Goto instructions. LICM is not allowed |
| 167 // after this point. |
| 168 void disallow_licm() { licm_allowed_ = false; } |
| 169 |
| 153 private: | 170 private: |
| 154 friend class IfConverter; | 171 friend class IfConverter; |
| 155 friend class BranchSimplifier; | 172 friend class BranchSimplifier; |
| 156 friend class ConstantPropagator; | 173 friend class ConstantPropagator; |
| 157 | 174 |
| 158 // SSA transformation methods and fields. | 175 // SSA transformation methods and fields. |
| 159 void ComputeDominators(GrowableArray<BitVector*>* dominance_frontier); | 176 void ComputeDominators(GrowableArray<BitVector*>* dominance_frontier); |
| 160 | 177 |
| 161 void CompressPath( | 178 void CompressPath( |
| 162 intptr_t start_index, | 179 intptr_t start_index, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 const intptr_t num_copied_params_; | 215 const intptr_t num_copied_params_; |
| 199 const intptr_t num_non_copied_params_; | 216 const intptr_t num_non_copied_params_; |
| 200 const intptr_t num_stack_locals_; | 217 const intptr_t num_stack_locals_; |
| 201 GraphEntryInstr* graph_entry_; | 218 GraphEntryInstr* graph_entry_; |
| 202 GrowableArray<BlockEntryInstr*> preorder_; | 219 GrowableArray<BlockEntryInstr*> preorder_; |
| 203 GrowableArray<BlockEntryInstr*> postorder_; | 220 GrowableArray<BlockEntryInstr*> postorder_; |
| 204 GrowableArray<BlockEntryInstr*> reverse_postorder_; | 221 GrowableArray<BlockEntryInstr*> reverse_postorder_; |
| 205 ConstantInstr* constant_null_; | 222 ConstantInstr* constant_null_; |
| 206 | 223 |
| 207 BlockEffects* block_effects_; | 224 BlockEffects* block_effects_; |
| 225 bool licm_allowed_; |
| 208 }; | 226 }; |
| 209 | 227 |
| 210 | 228 |
| 211 class LivenessAnalysis : public ValueObject { | 229 class LivenessAnalysis : public ValueObject { |
| 212 public: | 230 public: |
| 213 LivenessAnalysis(intptr_t variable_count, | 231 LivenessAnalysis(intptr_t variable_count, |
| 214 const GrowableArray<BlockEntryInstr*>& postorder); | 232 const GrowableArray<BlockEntryInstr*>& postorder); |
| 215 | 233 |
| 216 void Analyze(); | 234 void Analyze(); |
| 217 | 235 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 // Per block sets of available blocks. Block A is available at the block B if | 321 // Per block sets of available blocks. Block A is available at the block B if |
| 304 // and only if A dominates B and all paths from A to B are free of side | 322 // and only if A dominates B and all paths from A to B are free of side |
| 305 // effects. | 323 // effects. |
| 306 GrowableArray<BitVector*> available_at_; | 324 GrowableArray<BitVector*> available_at_; |
| 307 }; | 325 }; |
| 308 | 326 |
| 309 | 327 |
| 310 } // namespace dart | 328 } // namespace dart |
| 311 | 329 |
| 312 #endif // VM_FLOW_GRAPH_H_ | 330 #endif // VM_FLOW_GRAPH_H_ |
| OLD | NEW |