Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/ssa/optimize.dart |
| diff --git a/sdk/lib/_internal/compiler/implementation/ssa/optimize.dart b/sdk/lib/_internal/compiler/implementation/ssa/optimize.dart |
| index 7a41583029fa382f8aed202446162e1da390dbf4..df026d44805e13c757061e3c921835b55ae19a51 100644 |
| --- a/sdk/lib/_internal/compiler/implementation/ssa/optimize.dart |
| +++ b/sdk/lib/_internal/compiler/implementation/ssa/optimize.dart |
| @@ -183,8 +183,12 @@ class SsaConstantFolder extends HBaseVisitor implements OptimizationPhase { |
| HInstruction input = inputs[0]; |
| HType type = input.instructionType; |
| if (type.isBoolean()) return input; |
| - // All values !== true are boolified to false. |
| - if (!type.isBooleanOrNull() && !type.isUnknown()) { |
| + // All values that cannot be 'true' are boolified to false. |
| + DartType booleanType = backend.jsBoolClass.computeType(compiler); |
|
karlklose
2013/03/05 09:29:21
You could use '.rawType' here.
Long term I think
|
| + TypeMask mask = type.computeMask(compiler); |
| + // TODO(kasperl): Get rid of the null check here once all HTypes |
| + // have a proper mask. |
| + if (mask != null && !mask.contains(booleanType, compiler)) { |
| return graph.addConstantBool(false, constantSystem); |
| } |
| return node; |