| 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 interface OptimizationPhase { | 5 interface OptimizationPhase { |
| 6 String get name(); | 6 String get name(); |
| 7 void visitGraph(HGraph graph); | 7 void visitGraph(HGraph graph); |
| 8 } | 8 } |
| 9 | 9 |
| 10 class SsaOptimizerTask extends CompilerTask { | 10 class SsaOptimizerTask extends CompilerTask { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 // Previous optimizations may have generated new | 45 // Previous optimizations may have generated new |
| 46 // opportunities for constant folding. | 46 // opportunities for constant folding. |
| 47 new SsaConstantFolder(backend, work, types), | 47 new SsaConstantFolder(backend, work, types), |
| 48 new SsaDeadCodeEliminator(types), | 48 new SsaDeadCodeEliminator(types), |
| 49 new SsaRegisterRecompilationCandidates(backend, work, types)]; | 49 new SsaRegisterRecompilationCandidates(backend, work, types)]; |
| 50 runPhases(graph, phases); | 50 runPhases(graph, phases); |
| 51 }); | 51 }); |
| 52 } | 52 } |
| 53 | 53 |
| 54 bool trySpeculativeOptimizations(WorkItem work, HGraph graph) { | 54 bool trySpeculativeOptimizations(WorkItem work, HGraph graph) { |
| 55 if (work.element.isField()) { |
| 56 // Lazy initializers may not have bailout methods. |
| 57 return false; |
| 58 } |
| 55 JavaScriptItemCompilationContext context = work.compilationContext; | 59 JavaScriptItemCompilationContext context = work.compilationContext; |
| 56 HTypeMap types = context.types; | 60 HTypeMap types = context.types; |
| 57 return measure(() { | 61 return measure(() { |
| 58 // Run the phases that will generate type guards. | 62 // Run the phases that will generate type guards. |
| 59 List<OptimizationPhase> phases = <OptimizationPhase>[ | 63 List<OptimizationPhase> phases = <OptimizationPhase>[ |
| 60 new SsaRecompilationFieldTypePropagator(backend, work, types), | 64 new SsaRecompilationFieldTypePropagator(backend, work, types), |
| 61 new SsaSpeculativeTypePropagator(compiler, types), | 65 new SsaSpeculativeTypePropagator(compiler, types), |
| 62 new SsaTypeGuardInserter(compiler, work, types), | 66 new SsaTypeGuardInserter(compiler, work, types), |
| 63 new SsaEnvironmentBuilder(compiler), | 67 new SsaEnvironmentBuilder(compiler), |
| 64 // Change the propagated types back to what they were before we | 68 // Change the propagated types back to what they were before we |
| (...skipping 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1326 // this type for the field is still a strong signal | 1330 // this type for the field is still a strong signal |
| 1327 // indicating the expected type of the field. | 1331 // indicating the expected type of the field. |
| 1328 types[field] = type; | 1332 types[field] = type; |
| 1329 } else { | 1333 } else { |
| 1330 // If there are no invoked setters we know the type of | 1334 // If there are no invoked setters we know the type of |
| 1331 // this field for sure. | 1335 // this field for sure. |
| 1332 field.guaranteedType = type; | 1336 field.guaranteedType = type; |
| 1333 } | 1337 } |
| 1334 } | 1338 } |
| 1335 } | 1339 } |
| OLD | NEW |