| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 runPhases(graph, phases); | 63 runPhases(graph, phases); |
| 64 return !work.guards.isEmpty(); | 64 return !work.guards.isEmpty(); |
| 65 }); | 65 }); |
| 66 } | 66 } |
| 67 | 67 |
| 68 void prepareForSpeculativeOptimizations(WorkItem work, HGraph graph) { | 68 void prepareForSpeculativeOptimizations(WorkItem work, HGraph graph) { |
| 69 measure(() { | 69 measure(() { |
| 70 // In order to generate correct code for the bailout version, we did not | 70 // In order to generate correct code for the bailout version, we did not |
| 71 // propagate types from the instruction to the type guard. We do it | 71 // propagate types from the instruction to the type guard. We do it |
| 72 // now to be able to optimize further. | 72 // now to be able to optimize further. |
| 73 work.guards.forEach((HTypeGuard guard) { guard.isOn = true; }); | 73 work.guards.forEach((HTypeGuard guard) { guard.isEnabled = true; }); |
| 74 // We also need to insert range and integer checks for the type | 74 // We also need to insert range and integer checks for the type |
| 75 // guards. Now that they claim to have a certain type, some | 75 // guards. Now that they claim to have a certain type, some |
| 76 // depending instructions might become builtin (like native array | 76 // depending instructions might become builtin (like native array |
| 77 // accesses) and need to be checked. | 77 // accesses) and need to be checked. |
| 78 // Also run the type propagator, to please the codegen in case | 78 // Also run the type propagator, to please the codegen in case |
| 79 // no other optimization is run. | 79 // no other optimization is run. |
| 80 runPhases(graph, | 80 runPhases(graph, |
| 81 <OptimizationPhase>[new SsaCheckInserter(backend), | 81 <OptimizationPhase>[new SsaCheckInserter(backend), |
| 82 new SsaTypePropagator(compiler)]); | 82 new SsaTypePropagator(compiler)]); |
| 83 }); | 83 }); |
| (...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1272 break; | 1272 break; |
| 1273 default: | 1273 default: |
| 1274 assert(false); | 1274 assert(false); |
| 1275 break; | 1275 break; |
| 1276 } | 1276 } |
| 1277 } | 1277 } |
| 1278 } | 1278 } |
| 1279 } | 1279 } |
| 1280 | 1280 |
| 1281 } | 1281 } |
| OLD | NEW |