| Index: lib/compiler/implementation/ssa/optimize.dart
|
| ===================================================================
|
| --- lib/compiler/implementation/ssa/optimize.dart (revision 6728)
|
| +++ lib/compiler/implementation/ssa/optimize.dart (working copy)
|
| @@ -245,6 +245,27 @@
|
| return visitInvokeBinary(node);
|
| }
|
|
|
| + if (left.isNonPrimitive()) {
|
| + HNonPrimitiveType type = left.propagatedType;
|
| + Element element = type.lookupMember(Namer.OPERATOR_EQUALS);
|
| + if (element !== null) {
|
| + // If the left-hand side is guaranteed to be a non-primitive
|
| + // type and and it defines operator==, we emit a call to that
|
| + // operator.
|
| + return visitInvokeBinary(node);
|
| + } else if (right.isConstantNull()) {
|
| + return graph.addConstantBool(false);
|
| + } else {
|
| + // We can just emit an identity check because the type does
|
| + // not implement operator=.
|
| + // TODO(floitsch): cache interceptors.
|
| + HStatic target = new HStatic(
|
| + compiler.builder.interceptors.getTripleEqualsInterceptor());
|
| + return new HIdentity(target, left, right);
|
| + }
|
| + }
|
| +
|
| +
|
| if (right.isConstantNull()) {
|
| if (left.propagatedType.isUseful()) {
|
| return graph.addConstantBool(false);
|
| @@ -257,20 +278,6 @@
|
| }
|
| }
|
|
|
| - if (left.isNonPrimitive()) {
|
| - // If the left-hand side is guaranteed to be a non-primitive
|
| - // type and and it does not define operator==, we can just emit
|
| - // an identity check.
|
| - HNonPrimitiveType type = left.propagatedType;
|
| - Element element = type.lookupMember(Namer.OPERATOR_EQUALS);
|
| - if (element === null) {
|
| - // TODO(floitsch): cache interceptors.
|
| - HStatic target = new HStatic(
|
| - compiler.builder.interceptors.getTripleEqualsInterceptor());
|
| - return new HIdentity(target, left, right);
|
| - }
|
| - }
|
| -
|
| // All other cases are dealt with by the [visitInvokeBinary].
|
| return visitInvokeBinary(node);
|
| }
|
|
|