| Index: lib/compiler/implementation/ssa/optimize.dart
|
| ===================================================================
|
| --- lib/compiler/implementation/ssa/optimize.dart (revision 7371)
|
| +++ 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.isPrimitive()) {
|
| return graph.addConstantBool(false);
|
| } else {
|
| // TODO(floitsch): cache interceptors.
|
| @@ -1054,6 +1055,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 +1074,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
|
|
|