| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 interface OptimizationPhase { | 5 interface OptimizationPhase { |
| 6 String get name(); | 6 String get name(); |
| 7 void visitGraph(HGraph graph); | 7 void visitGraph(HGraph graph); |
| 8 } | 8 } |
| 9 | 9 |
| 10 class SsaOptimizerTask extends CompilerTask { | 10 class SsaOptimizerTask extends CompilerTask { |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 if (node.builtin) { | 425 if (node.builtin) { |
| 426 return foldBuiltinEqualsCheck(node); | 426 return foldBuiltinEqualsCheck(node); |
| 427 } | 427 } |
| 428 | 428 |
| 429 if (left.isConstant() && right.isConstant()) { | 429 if (left.isConstant() && right.isConstant()) { |
| 430 return super.visitEquals(node); | 430 return super.visitEquals(node); |
| 431 } | 431 } |
| 432 | 432 |
| 433 if (left.propagatedType.isExact()) { | 433 if (left.propagatedType.isExact()) { |
| 434 HBoundedType type = left.propagatedType; | 434 HBoundedType type = left.propagatedType; |
| 435 Element element = type.lookupMember(Namer.OPERATOR_EQUALS); | 435 Element element = type.lookupMember(Elements.OPERATOR_EQUALS); |
| 436 if (element !== null) { | 436 if (element !== null) { |
| 437 // If the left-hand side is guaranteed to be a non-primitive | 437 // If the left-hand side is guaranteed to be a non-primitive |
| 438 // type and and it defines operator==, we emit a call to that | 438 // type and and it defines operator==, we emit a call to that |
| 439 // operator. | 439 // operator. |
| 440 return super.visitEquals(node); | 440 return super.visitEquals(node); |
| 441 } else if (right.isConstantNull()) { | 441 } else if (right.isConstantNull()) { |
| 442 return graph.addConstantBool(false); | 442 return graph.addConstantBool(false); |
| 443 } else { | 443 } else { |
| 444 // We can just emit an identity check because the type does | 444 // We can just emit an identity check because the type does |
| 445 // not implement operator=. | 445 // not implement operator=. |
| (...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1229 } | 1229 } |
| 1230 break; | 1230 break; |
| 1231 default: | 1231 default: |
| 1232 assert(false); | 1232 assert(false); |
| 1233 break; | 1233 break; |
| 1234 } | 1234 } |
| 1235 } | 1235 } |
| 1236 } | 1236 } |
| 1237 } | 1237 } |
| 1238 } | 1238 } |
| OLD | NEW |