Chromium Code Reviews| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 FlowGraph* flow_graph_; | 155 FlowGraph* flow_graph_; |
| 156 | 156 |
| 157 DISALLOW_COPY_AND_ASSIGN(FlowGraphOptimizer); | 157 DISALLOW_COPY_AND_ASSIGN(FlowGraphOptimizer); |
| 158 }; | 158 }; |
| 159 | 159 |
| 160 | 160 |
| 161 class ParsedFunction; | 161 class ParsedFunction; |
| 162 | 162 |
| 163 | 163 |
| 164 // Loop invariant code motion. | 164 // Loop invariant code motion. |
| 165 class LICM : public AllStatic { | 165 class LICM { |
|
srdjan
2013/02/25 18:48:50
public ValueObject
Kevin Millikin (Google)
2013/02/26 08:22:23
Done.
| |
| 166 public: | 166 public: |
| 167 static void Optimize(FlowGraph* flow_graph); | 167 explicit LICM(FlowGraph* flow_graph); |
| 168 | |
| 169 void Optimize(); | |
| 168 | 170 |
| 169 private: | 171 private: |
| 170 static void Hoist(ForwardInstructionIterator* it, | 172 FlowGraph* flow_graph() const { return flow_graph_; } |
| 171 BlockEntryInstr* pre_header, | |
| 172 Instruction* current); | |
| 173 | 173 |
| 174 static void TryHoistCheckSmiThroughPhi(ForwardInstructionIterator* it, | 174 void Hoist(ForwardInstructionIterator* it, |
| 175 BlockEntryInstr* header, | 175 BlockEntryInstr* pre_header, |
| 176 BlockEntryInstr* pre_header, | 176 Instruction* current); |
| 177 CheckSmiInstr* current); | 177 |
| 178 void TryHoistCheckSmiThroughPhi(ForwardInstructionIterator* it, | |
| 179 BlockEntryInstr* header, | |
| 180 BlockEntryInstr* pre_header, | |
| 181 CheckSmiInstr* current); | |
| 182 | |
| 183 FlowGraph* const flow_graph_; | |
| 178 }; | 184 }; |
| 179 | 185 |
| 180 | 186 |
| 181 // A simple common subexpression elimination based | 187 // A simple common subexpression elimination based |
| 182 // on the dominator tree. | 188 // on the dominator tree. |
| 183 class DominatorBasedCSE : public AllStatic { | 189 class DominatorBasedCSE : public AllStatic { |
| 184 public: | 190 public: |
| 185 // Return true, if the optimization changed the flow graph. | 191 // Return true, if the optimization changed the flow graph. |
| 186 // False, if nothing changed. | 192 // False, if nothing changed. |
| 187 static bool Optimize(FlowGraph* graph); | 193 static bool Optimize(FlowGraph* graph); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 250 | 256 |
| 251 // Worklists of blocks and definitions. | 257 // Worklists of blocks and definitions. |
| 252 GrowableArray<BlockEntryInstr*> block_worklist_; | 258 GrowableArray<BlockEntryInstr*> block_worklist_; |
| 253 GrowableArray<Definition*> definition_worklist_; | 259 GrowableArray<Definition*> definition_worklist_; |
| 254 }; | 260 }; |
| 255 | 261 |
| 256 | 262 |
| 257 } // namespace dart | 263 } // namespace dart |
| 258 | 264 |
| 259 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ | 265 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ |
| OLD | NEW |