Chromium Code Reviews| Index: lib/compiler/implementation/ssa/types_propagation.dart |
| diff --git a/lib/compiler/implementation/ssa/types.dart b/lib/compiler/implementation/ssa/types_propagation.dart |
| similarity index 93% |
| copy from lib/compiler/implementation/ssa/types.dart |
| copy to lib/compiler/implementation/ssa/types_propagation.dart |
| index 0f12bb9e8e1b3d6998147afeddea202411b5822c..5783756dee792936bd639e5149d79331eeac21d2 100644 |
| --- a/lib/compiler/implementation/ssa/types.dart |
| +++ b/lib/compiler/implementation/ssa/types_propagation.dart |
| @@ -1,4 +1,4 @@ |
| -// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| // for details. All rights reserved. Use of this source code is governed by a |
| // BSD-style license that can be found in the LICENSE file. |
| @@ -43,7 +43,9 @@ class SsaTypePropagator extends HGraphVisitor implements OptimizationPhase { |
| // type of all other incoming edges as "unitialized" and take this into |
| // account when doing the propagation inside the phis. Just setting |
| // the [propagatedType] is however easier. |
| - phi.propagatedType = phi.inputs[0].propagatedType; |
| + if (phi.propagatedType.isUnknown()) { |
|
ngeoffray
2012/04/25 11:41:13
Please add a comment on why the phi may already ha
floitsch
2012/04/25 19:52:15
Done.
|
| + phi.propagatedType = phi.inputs[0].propagatedType; |
| + } |
| addToWorkList(phi); |
| }); |
| } else { |
| @@ -110,8 +112,8 @@ class SsaSpeculativeTypePropagator extends SsaTypePropagator { |
| HType computeDesiredType(HInstruction instruction) { |
| HType desiredType = HType.UNKNOWN; |
| for (final user in instruction.usedBy) { |
| - desiredType = |
| - desiredType.combine(user.computeDesiredTypeForInput(instruction)); |
| + HType userType = user.computeDesiredTypeForInput(instruction); |
| + desiredType = desiredType.intersection(userType); |
| // No need to continue if two users disagree on the type. |
| if (desiredType.isConflicting()) break; |
| } |
| @@ -134,6 +136,6 @@ class SsaSpeculativeTypePropagator extends SsaTypePropagator { |
| // TODO(ngeoffray): Allow speculative optimizations on |
| // non-primitive types? |
| if (desiredType.isNonPrimitive()) return newType; |
| - return newType.combine(desiredType); |
| + return newType.intersection(desiredType); |
| } |
| } |