| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 const ParsedFunction& parsed_function_; | 117 const ParsedFunction& parsed_function_; |
| 118 bool still_changing_; | 118 bool still_changing_; |
| 119 DISALLOW_COPY_AND_ASSIGN(FlowGraphTypePropagator); | 119 DISALLOW_COPY_AND_ASSIGN(FlowGraphTypePropagator); |
| 120 }; | 120 }; |
| 121 | 121 |
| 122 | 122 |
| 123 // Loop invariant code motion. | 123 // Loop invariant code motion. |
| 124 class LICM : public AllStatic { | 124 class LICM : public AllStatic { |
| 125 public: | 125 public: |
| 126 static void Optimize(FlowGraph* flow_graph); | 126 static void Optimize(FlowGraph* flow_graph); |
| 127 |
| 128 private: |
| 129 static void Hoist(ForwardInstructionIterator* it, |
| 130 BlockEntryInstr* pre_header, |
| 131 Definition* current); |
| 132 |
| 133 static void TryHoistCheckSmiThroughPhi(ForwardInstructionIterator* it, |
| 134 BlockEntryInstr* header, |
| 135 BlockEntryInstr* pre_header, |
| 136 Definition* current); |
| 127 }; | 137 }; |
| 128 | 138 |
| 129 | 139 |
| 130 // A simple common subexpression elimination based | 140 // A simple common subexpression elimination based |
| 131 // on the dominator tree. | 141 // on the dominator tree. |
| 132 class DominatorBasedCSE : public AllStatic { | 142 class DominatorBasedCSE : public AllStatic { |
| 133 public: | 143 public: |
| 134 static void Optimize(BlockEntryInstr* graph_entry); | 144 static void Optimize(BlockEntryInstr* graph_entry); |
| 135 | 145 |
| 136 private: | 146 private: |
| 137 static void OptimizeRecursive( | 147 static void OptimizeRecursive( |
| 138 BlockEntryInstr* entry, | 148 BlockEntryInstr* entry, |
| 139 DirectChainedHashMap<Definition*>* map); | 149 DirectChainedHashMap<Definition*>* map); |
| 140 }; | 150 }; |
| 141 | 151 |
| 142 | 152 |
| 143 } // namespace dart | 153 } // namespace dart |
| 144 | 154 |
| 145 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ | 155 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ |
| OLD | NEW |