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 23 matching lines...) Expand all Loading... |
34 // Merge instructions (only per basic-block). | 34 // Merge instructions (only per basic-block). |
35 void TryOptimizePatterns(); | 35 void TryOptimizePatterns(); |
36 | 36 |
37 // Returns true if any instructions were canonicalized away. | 37 // Returns true if any instructions were canonicalized away. |
38 bool Canonicalize(); | 38 bool Canonicalize(); |
39 | 39 |
40 void EliminateDeadPhis(); | 40 void EliminateDeadPhis(); |
41 | 41 |
42 void SelectRepresentations(); | 42 void SelectRepresentations(); |
43 | 43 |
| 44 void WidenSmiToInt32(); |
| 45 |
44 void InferIntRanges(); | 46 void InferIntRanges(); |
45 | 47 |
46 void SelectIntegerInstructions(); | 48 void SelectIntegerInstructions(); |
47 | 49 |
48 void AnalyzeTryCatch(); | 50 void AnalyzeTryCatch(); |
49 | 51 |
50 bool TryInlineRecognizedMethod(intptr_t receiver_cid, | 52 bool TryInlineRecognizedMethod(intptr_t receiver_cid, |
51 const Function& target, | 53 const Function& target, |
52 Instruction* call, | 54 Instruction* call, |
53 Definition* receiver, | 55 Definition* receiver, |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 }; | 263 }; |
262 | 264 |
263 | 265 |
264 // Loop invariant code motion. | 266 // Loop invariant code motion. |
265 class LICM : public ValueObject { | 267 class LICM : public ValueObject { |
266 public: | 268 public: |
267 explicit LICM(FlowGraph* flow_graph); | 269 explicit LICM(FlowGraph* flow_graph); |
268 | 270 |
269 void Optimize(); | 271 void Optimize(); |
270 | 272 |
| 273 void OptimisticallySpecializeSmiPhis(); |
| 274 |
271 private: | 275 private: |
272 FlowGraph* flow_graph() const { return flow_graph_; } | 276 FlowGraph* flow_graph() const { return flow_graph_; } |
273 | 277 |
274 void Hoist(ForwardInstructionIterator* it, | 278 void Hoist(ForwardInstructionIterator* it, |
275 BlockEntryInstr* pre_header, | 279 BlockEntryInstr* pre_header, |
276 Instruction* current); | 280 Instruction* current); |
277 | 281 |
278 void TryHoistCheckSmiThroughPhi(ForwardInstructionIterator* it, | 282 void TrySpecializeSmiPhi(PhiInstr* phi, |
279 BlockEntryInstr* header, | 283 BlockEntryInstr* header, |
280 BlockEntryInstr* pre_header, | 284 BlockEntryInstr* pre_header); |
281 CheckSmiInstr* current); | |
282 | 285 |
283 FlowGraph* const flow_graph_; | 286 FlowGraph* const flow_graph_; |
284 }; | 287 }; |
285 | 288 |
286 | 289 |
287 // A simple common subexpression elimination based | 290 // A simple common subexpression elimination based |
288 // on the dominator tree. | 291 // on the dominator tree. |
289 class DominatorBasedCSE : public AllStatic { | 292 class DominatorBasedCSE : public AllStatic { |
290 public: | 293 public: |
291 // Return true, if the optimization changed the flow graph. | 294 // Return true, if the optimization changed the flow graph. |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 // Optimize spill stores inside try-blocks by identifying values that always | 509 // Optimize spill stores inside try-blocks by identifying values that always |
507 // contain a single known constant at catch block entry. | 510 // contain a single known constant at catch block entry. |
508 class TryCatchAnalyzer : public AllStatic { | 511 class TryCatchAnalyzer : public AllStatic { |
509 public: | 512 public: |
510 static void Optimize(FlowGraph* flow_graph); | 513 static void Optimize(FlowGraph* flow_graph); |
511 }; | 514 }; |
512 | 515 |
513 } // namespace dart | 516 } // namespace dart |
514 | 517 |
515 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ | 518 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ |
OLD | NEW |