| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 class SsaOptimizerTask extends CompilerTask { | 5 class SsaOptimizerTask extends CompilerTask { |
| 6 SsaOptimizerTask(Compiler compiler) : super(compiler); | 6 SsaOptimizerTask(Compiler compiler) : super(compiler); |
| 7 String get name() => 'SSA optimizer'; | 7 String get name() => 'SSA optimizer'; |
| 8 | 8 |
| 9 void optimize(WorkItem work, HGraph graph) { | 9 void optimize(WorkItem work, HGraph graph) { |
| 10 measure(() { | 10 measure(() { |
| 11 if (!work.isBailoutVersion()) { | 11 if (!work.isBailoutVersion()) { |
| 12 // TODO(ngeoffray): We should be more fine-grained and still | 12 // TODO(ngeoffray): We should be more fine-grained and still |
| 13 // allow type propagation of instructions we know the type. | 13 // allow type propagation of instructions we know the type. |
| 14 new SsaTypePropagator(compiler).visitGraph(graph); | 14 if (work.allowSpeculativeOptimization) { |
| 15 new SsaTypeGuardBuilder(compiler).visitGraph(graph); | 15 new SsaTypePropagator(compiler).visitGraph(graph); |
| 16 new SsaCheckInserter(compiler).visitGraph(graph); | 16 new SsaTypeGuardBuilder(compiler).visitGraph(graph); |
| 17 new SsaCheckInserter(compiler).visitGraph(graph); |
| 18 } |
| 17 new SsaConstantFolder(compiler).visitGraph(graph); | 19 new SsaConstantFolder(compiler).visitGraph(graph); |
| 18 new SsaRedundantPhiEliminator().visitGraph(graph); | 20 new SsaRedundantPhiEliminator().visitGraph(graph); |
| 19 new SsaDeadPhiEliminator().visitGraph(graph); | 21 new SsaDeadPhiEliminator().visitGraph(graph); |
| 20 new SsaGlobalValueNumberer(compiler).visitGraph(graph); | 22 new SsaGlobalValueNumberer(compiler).visitGraph(graph); |
| 21 new SsaCodeMotion().visitGraph(graph); | 23 new SsaCodeMotion().visitGraph(graph); |
| 22 new SsaDeadCodeEliminator().visitGraph(graph); | 24 new SsaDeadCodeEliminator().visitGraph(graph); |
| 23 } else { | 25 } else { |
| 24 new SsaBailoutBuilder(compiler, work.bailouts).visitGraph(graph); | 26 new SsaBailoutBuilder(compiler, work.bailouts).visitGraph(graph); |
| 25 } | 27 } |
| 26 }); | 28 }); |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 } | 604 } |
| 603 } | 605 } |
| 604 if (!canBeMoved) continue; | 606 if (!canBeMoved) continue; |
| 605 | 607 |
| 606 // This is safe because we are running after GVN. | 608 // This is safe because we are running after GVN. |
| 607 // TODO(ngeoffray): ensure GVN has been run. | 609 // TODO(ngeoffray): ensure GVN has been run. |
| 608 set_.add(current); | 610 set_.add(current); |
| 609 } | 611 } |
| 610 } | 612 } |
| 611 } | 613 } |
| OLD | NEW |