Chromium Code Reviews| Index: lib/compiler/implementation/ssa/optimize.dart |
| =================================================================== |
| --- lib/compiler/implementation/ssa/optimize.dart (revision 7269) |
| +++ lib/compiler/implementation/ssa/optimize.dart (working copy) |
| @@ -130,7 +130,8 @@ |
| HInstruction input = inputs[0]; |
| if (input.isBoolean()) return input; |
| // All values !== true are boolified to false. |
| - if (input.propagatedType.isUseful()) { |
| + Type type = input.propagatedType.computeType(compiler); |
| + if (type !== null && type.element !== compiler.boolClass) { |
| return graph.addConstantBool(false); |
| } |
| return node; |
| @@ -437,7 +438,7 @@ |
| } |
| if (right.isConstantNull()) { |
| - if (left.propagatedType.isUseful()) { |
| + if (!left.propagatedType.canBeNull()) { |
|
floitsch
2012/05/07 09:50:07
I would prefer switching to the new semantics in a
ngeoffray
2012/05/07 13:15:42
This should have been if (leg.propagatedType.isPri
|
| return graph.addConstantBool(false); |
| } else { |
| // TODO(floitsch): cache interceptors. |
| @@ -532,6 +533,7 @@ |
| } |
| // TODO(karlklose): remove the hasTypeArguments check. |
| } else if (expressionType.isUseful() |
| + && !expressionType.canBeNull() |
|
floitsch
2012/05/07 09:50:07
you could move that check into the 'true' section.
ngeoffray
2012/05/07 13:15:42
Done.
|
| && !compiler.universe.rti.hasTypeArguments(type)) { |
| Type receiverType = expressionType.computeType(compiler); |
| if (receiverType !== null) { |
| @@ -1054,6 +1056,10 @@ |
| void visitIs(HIs instruction) { |
| HInstruction input = instruction.expression; |
| + HType convertedType = |
| + new HType.fromBoundedType(instruction.typeExpression, compiler); |
| + if (convertedType === null) return; |
| + |
| List<HInstruction> ifUsers = <HInstruction>[]; |
| List<HInstruction> notIfUsers = <HInstruction>[]; |
| @@ -1069,9 +1075,6 @@ |
| if (ifUsers.isEmpty() && notIfUsers.isEmpty()) return; |
| - HType convertedType = |
| - new HType.fromBoundedType(instruction.typeExpression, compiler); |
| - |
| for (HIf ifUser in ifUsers) { |
| changeUsesDominatedBy(ifUser.thenBlock, input, convertedType); |
| // TODO(ngeoffray): Also change uses for the else block on a HType |