| 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 SsaTypePropagator extends HGraphVisitor implements OptimizationPhase { | 5 class SsaTypePropagator extends HGraphVisitor implements OptimizationPhase { |
| 6 | 6 |
| 7 final Map<int, HInstruction> workmap; | 7 final Map<int, HInstruction> workmap; |
| 8 final List<int> worklist; | 8 final List<int> worklist; |
| 9 final Compiler compiler; | 9 final Compiler compiler; |
| 10 String get name() => 'type propagator'; | 10 String get name() => 'type propagator'; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 if (oldType.isConflicting()) return oldType; | 124 if (oldType.isConflicting()) return oldType; |
| 125 | 125 |
| 126 HType newType = super.computeType(instruction); | 126 HType newType = super.computeType(instruction); |
| 127 // [computeDesiredType] goes to all usedBys and lets them compute their | 127 // [computeDesiredType] goes to all usedBys and lets them compute their |
| 128 // desired type. By setting the [newType] here we give them more context to | 128 // desired type. By setting the [newType] here we give them more context to |
| 129 // work with. | 129 // work with. |
| 130 instruction.propagatedType = newType; | 130 instruction.propagatedType = newType; |
| 131 HType desiredType = computeDesiredType(instruction); | 131 HType desiredType = computeDesiredType(instruction); |
| 132 // If the desired type is conflicting just return the computed type. | 132 // If the desired type is conflicting just return the computed type. |
| 133 if (desiredType.isConflicting()) return newType; | 133 if (desiredType.isConflicting()) return newType; |
| 134 // TODO(ngeoffray): Allow speculative optimizations on |
| 135 // non-primitive types? |
| 136 if (desiredType.isNonPrimitive()) return newType; |
| 134 return newType.combine(desiredType); | 137 return newType.combine(desiredType); |
| 135 } | 138 } |
| 136 } | 139 } |
| OLD | NEW |