| 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_OPTIMIZER_H_ | 5 #ifndef VM_FLOW_GRAPH_OPTIMIZER_H_ |
| 6 #define VM_FLOW_GRAPH_OPTIMIZER_H_ | 6 #define VM_FLOW_GRAPH_OPTIMIZER_H_ |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 #include "vm/flow_graph.h" | 9 #include "vm/flow_graph.h" |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 FlowGraph* flow_graph() const { return flow_graph_; } | 24 FlowGraph* flow_graph() const { return flow_graph_; } |
| 25 | 25 |
| 26 // Use ICData to optimize, replace or eliminate instructions. | 26 // Use ICData to optimize, replace or eliminate instructions. |
| 27 void ApplyICData(); | 27 void ApplyICData(); |
| 28 | 28 |
| 29 // Use propagated class ids to optimize, replace or eliminate instructions. | 29 // Use propagated class ids to optimize, replace or eliminate instructions. |
| 30 void ApplyClassIds(); | 30 void ApplyClassIds(); |
| 31 | 31 |
| 32 // Optimize (a << b) & c pattern: if c is a positive Smi or zero, then the | 32 // Optimize (a << b) & c pattern: if c is a positive Smi or zero, then the |
| 33 // shift can be a truncating Smi shift-left and result is always Smi. | 33 // shift can be a truncating Smi shift-left and result is always Smi. |
| 34 void TryOptimizeLeftShiftWithBitAndPattern(); | 34 // Merge instructions. |
| 35 void TryOptimizePatterns(); |
| 35 | 36 |
| 36 // Returns true if any instructions were canonicalized away. | 37 // Returns true if any instructions were canonicalized away. |
| 37 bool Canonicalize(); | 38 bool Canonicalize(); |
| 38 | 39 |
| 39 void EliminateDeadPhis(); | 40 void EliminateDeadPhis(); |
| 40 | 41 |
| 41 void SelectRepresentations(); | 42 void SelectRepresentations(); |
| 42 | 43 |
| 43 void InferSmiRanges(); | 44 void InferSmiRanges(); |
| 44 | 45 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 | 197 |
| 197 RawBool* InstanceOfAsBool(const ICData& ic_data, | 198 RawBool* InstanceOfAsBool(const ICData& ic_data, |
| 198 const AbstractType& type) const; | 199 const AbstractType& type) const; |
| 199 | 200 |
| 200 void ReplaceWithMathCFunction(InstanceCallInstr* call, | 201 void ReplaceWithMathCFunction(InstanceCallInstr* call, |
| 201 MethodRecognizer::Kind recognized_kind); | 202 MethodRecognizer::Kind recognized_kind); |
| 202 | 203 |
| 203 void OptimizeLeftShiftBitAndSmiOp(Definition* bit_and_instr, | 204 void OptimizeLeftShiftBitAndSmiOp(Definition* bit_and_instr, |
| 204 Definition* left_instr, | 205 Definition* left_instr, |
| 205 Definition* right_instr); | 206 Definition* right_instr); |
| 207 void TryMergeTruncDivMod(GrowableArray<BinarySmiOpInstr*>* merge_candidates); |
| 206 | 208 |
| 207 FlowGraph* flow_graph_; | 209 FlowGraph* flow_graph_; |
| 208 | 210 |
| 209 DISALLOW_COPY_AND_ASSIGN(FlowGraphOptimizer); | 211 DISALLOW_COPY_AND_ASSIGN(FlowGraphOptimizer); |
| 210 }; | 212 }; |
| 211 | 213 |
| 212 | 214 |
| 213 // Loop invariant code motion. | 215 // Loop invariant code motion. |
| 214 class LICM : public ValueObject { | 216 class LICM : public ValueObject { |
| 215 public: | 217 public: |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 // Optimize spill stores inside try-blocks by identifying values that always | 383 // Optimize spill stores inside try-blocks by identifying values that always |
| 382 // contain a single known constant at catch block entry. | 384 // contain a single known constant at catch block entry. |
| 383 class TryCatchAnalyzer : public AllStatic { | 385 class TryCatchAnalyzer : public AllStatic { |
| 384 public: | 386 public: |
| 385 static void Optimize(FlowGraph* flow_graph); | 387 static void Optimize(FlowGraph* flow_graph); |
| 386 }; | 388 }; |
| 387 | 389 |
| 388 } // namespace dart | 390 } // namespace dart |
| 389 | 391 |
| 390 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ | 392 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ |
| OLD | NEW |