| Index: lib/compiler/implementation/ssa/optimize.dart
|
| diff --git a/lib/compiler/implementation/ssa/optimize.dart b/lib/compiler/implementation/ssa/optimize.dart
|
| index 664b62bd63cdcce93493fbe7bad40f8518d6e4bf..3d67053bbedc0dd1db47536eff3eb6c13ad5f2c9 100644
|
| --- a/lib/compiler/implementation/ssa/optimize.dart
|
| +++ b/lib/compiler/implementation/ssa/optimize.dart
|
| @@ -460,6 +460,28 @@ class SsaConstantFolder extends HBaseVisitor implements OptimizationPhase {
|
| if (right.isConstantNull()) {
|
| if (left.propagatedType.isPrimitive()) {
|
| return graph.addConstantBool(false);
|
| + } else {
|
| + // TODO(floitsch): cache interceptors.
|
| + Interceptors interceptors = backend.builder.interceptors;
|
| + Element equalsElement = interceptors.getEqualsInterceptor();
|
| + // If we have a different element than [equalsElement], we
|
| + // don't need to optimize this instruction to use another
|
| + // element: we know the element is either eqNull or eqNullB.
|
| + if (node.element === equalsElement) {
|
| + Element targetElement = interceptors.getEqualsNullInterceptor();
|
| + bool onlyUsedInBoolify = allUsersAreBoolifies(node);
|
| + if (onlyUsedInBoolify) {
|
| + targetElement = interceptors.getBoolifiedVersionOf(targetElement);
|
| + }
|
| + HStatic target = new HStatic(targetElement);
|
| + node.block.addBefore(node, target);
|
| + HEquals result = new HEquals(target, node.left, node.right);
|
| + if (onlyUsedInBoolify) {
|
| + result.usesBoolifiedInterceptor = true;
|
| + result.propagatedType = HType.BOOLEAN;
|
| + }
|
| + return result;
|
| + }
|
| }
|
| }
|
|
|
|
|