Chromium Code Reviews| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 | 120 |
| 121 HType computeType(HInstruction instruction) { | 121 HType computeType(HInstruction instruction) { |
| 122 HType newType = super.computeType(instruction); | 122 HType newType = super.computeType(instruction); |
| 123 // [computeDesiredType] goes to all usedBys and lets them compute their | 123 // [computeDesiredType] goes to all usedBys and lets them compute their |
| 124 // desired type. By setting the [newType] here we give them more context to | 124 // desired type. By setting the [newType] here we give them more context to |
| 125 // work with. | 125 // work with. |
| 126 instruction.propagatedType = newType; | 126 instruction.propagatedType = newType; |
| 127 HType desiredType = computeDesiredType(instruction); | 127 HType desiredType = computeDesiredType(instruction); |
| 128 // If the desired type is conflicting just return the computed type. | 128 // If the desired type is conflicting just return the computed type. |
| 129 if (desiredType.isConflicting()) return newType; | 129 if (desiredType.isConflicting()) return newType; |
| 130 // TODO(ngeoffray): Allow speculative optimizations on | |
| 131 // non-primitive types? | |
|
floitsch
2012/04/18 19:18:48
Why not. But that would require adding a isNonPrim
| |
| 132 if (desiredType.isNonPrimitive()) return newType; | |
| 130 return newType.combine(desiredType); | 133 return newType.combine(desiredType); |
| 131 } | 134 } |
| 132 } | 135 } |
| OLD | NEW |