| 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 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; | 5 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; |
| 6 import '../common/names.dart' show Selectors; | 6 import '../common/names.dart' show Selectors; |
| 7 import '../common/tasks.dart' show CompilerTask; | 7 import '../common/tasks.dart' show CompilerTask; |
| 8 import '../compiler.dart' show Compiler; | 8 import '../compiler.dart' show Compiler; |
| 9 import '../constants/constant_system.dart'; | 9 import '../constants/constant_system.dart'; |
| 10 import '../constants/values.dart'; | 10 import '../constants/values.dart'; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 // opportunities for instruction simplification. | 94 // opportunities for instruction simplification. |
| 95 new SsaInstructionSimplifier(backend, closedWorld, this, registry), | 95 new SsaInstructionSimplifier(backend, closedWorld, this, registry), |
| 96 new SsaCheckInserter( | 96 new SsaCheckInserter( |
| 97 trustPrimitives, backend, closedWorld, boundsChecked), | 97 trustPrimitives, backend, closedWorld, boundsChecked), |
| 98 ]; | 98 ]; |
| 99 phases.forEach(runPhase); | 99 phases.forEach(runPhase); |
| 100 | 100 |
| 101 // Simplifying interceptors is not strictly just an optimization, it is | 101 // Simplifying interceptors is not strictly just an optimization, it is |
| 102 // required for implementation correctness because the code generator | 102 // required for implementation correctness because the code generator |
| 103 // assumes it is always performed. | 103 // assumes it is always performed. |
| 104 runPhase( | 104 runPhase(new SsaSimplifyInterceptors( |
| 105 new SsaSimplifyInterceptors(compiler, closedWorld, work.element)); | 105 compiler, closedWorld, work.element.enclosingClass)); |
| 106 | 106 |
| 107 SsaDeadCodeEliminator dce = new SsaDeadCodeEliminator(closedWorld, this); | 107 SsaDeadCodeEliminator dce = new SsaDeadCodeEliminator(closedWorld, this); |
| 108 runPhase(dce); | 108 runPhase(dce); |
| 109 if (codeMotion.movedCode || dce.eliminatedSideEffects) { | 109 if (codeMotion.movedCode || dce.eliminatedSideEffects) { |
| 110 phases = <OptimizationPhase>[ | 110 phases = <OptimizationPhase>[ |
| 111 new SsaTypePropagator(compiler, closedWorld), | 111 new SsaTypePropagator(compiler, closedWorld), |
| 112 new SsaGlobalValueNumberer(), | 112 new SsaGlobalValueNumberer(), |
| 113 new SsaCodeMotion(), | 113 new SsaCodeMotion(), |
| 114 new SsaValueRangeAnalyzer(backend.helpers, closedWorld, this), | 114 new SsaValueRangeAnalyzer(backend.helpers, closedWorld, this), |
| 115 new SsaInstructionSimplifier(backend, closedWorld, this, registry), | 115 new SsaInstructionSimplifier(backend, closedWorld, this, registry), |
| 116 new SsaCheckInserter( | 116 new SsaCheckInserter( |
| 117 trustPrimitives, backend, closedWorld, boundsChecked), | 117 trustPrimitives, backend, closedWorld, boundsChecked), |
| 118 new SsaSimplifyInterceptors(compiler, closedWorld, work.element), | 118 new SsaSimplifyInterceptors( |
| 119 compiler, closedWorld, work.element.enclosingClass), |
| 119 new SsaDeadCodeEliminator(closedWorld, this), | 120 new SsaDeadCodeEliminator(closedWorld, this), |
| 120 ]; | 121 ]; |
| 121 } else { | 122 } else { |
| 122 phases = <OptimizationPhase>[ | 123 phases = <OptimizationPhase>[ |
| 123 new SsaTypePropagator(compiler, closedWorld), | 124 new SsaTypePropagator(compiler, closedWorld), |
| 124 // Run the simplifier to remove unneeded type checks inserted by | 125 // Run the simplifier to remove unneeded type checks inserted by |
| 125 // type propagation. | 126 // type propagation. |
| 126 new SsaInstructionSimplifier(backend, closedWorld, this, registry), | 127 new SsaInstructionSimplifier(backend, closedWorld, this, registry), |
| 127 ]; | 128 ]; |
| 128 } | 129 } |
| (...skipping 2624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2753 | 2754 |
| 2754 keyedValues.forEach((receiver, values) { | 2755 keyedValues.forEach((receiver, values) { |
| 2755 result.keyedValues[receiver] = | 2756 result.keyedValues[receiver] = |
| 2756 new Map<HInstruction, HInstruction>.from(values); | 2757 new Map<HInstruction, HInstruction>.from(values); |
| 2757 }); | 2758 }); |
| 2758 | 2759 |
| 2759 result.nonEscapingReceivers.addAll(nonEscapingReceivers); | 2760 result.nonEscapingReceivers.addAll(nonEscapingReceivers); |
| 2760 return result; | 2761 return result; |
| 2761 } | 2762 } |
| 2762 } | 2763 } |
| OLD | NEW |