| 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 part of ssa; | 5 part of ssa; |
| 6 | 6 |
| 7 abstract class OptimizationPhase { | 7 abstract class OptimizationPhase { |
| 8 String get name; | 8 String get name; |
| 9 void visitGraph(HGraph graph); | 9 void visitGraph(HGraph graph); |
| 10 } | 10 } |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 return foldBuiltinEqualsCheck(node); | 452 return foldBuiltinEqualsCheck(node); |
| 453 } | 453 } |
| 454 | 454 |
| 455 if (left.isConstant() && right.isConstant()) { | 455 if (left.isConstant() && right.isConstant()) { |
| 456 return super.visitEquals(node); | 456 return super.visitEquals(node); |
| 457 } | 457 } |
| 458 | 458 |
| 459 HType leftType = types[left]; | 459 HType leftType = types[left]; |
| 460 if (leftType.isExact()) { | 460 if (leftType.isExact()) { |
| 461 HBoundedType type = leftType; | 461 HBoundedType type = leftType; |
| 462 Element element = type.lookupMember(Elements.OPERATOR_EQUALS); | 462 Element element = type.lookupMember(const SourceString('==')); |
| 463 if (element != null) { | 463 if (element != null) { |
| 464 // If the left-hand side is guaranteed to be a non-primitive | 464 // If the left-hand side is guaranteed to be a non-primitive |
| 465 // type and and it defines operator==, we emit a call to that | 465 // type and and it defines operator==, we emit a call to that |
| 466 // operator. | 466 // operator. |
| 467 return super.visitEquals(node); | 467 return super.visitEquals(node); |
| 468 } else if (right.isConstantNull()) { | 468 } else if (right.isConstantNull()) { |
| 469 return graph.addConstantBool(false, constantSystem); | 469 return graph.addConstantBool(false, constantSystem); |
| 470 } else { | 470 } else { |
| 471 // We can just emit an identity check because the type does | 471 // We can just emit an identity check because the type does |
| 472 // not implement operator=. | 472 // not implement operator=. |
| (...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1354 } | 1354 } |
| 1355 | 1355 |
| 1356 // For other fields having setters in the generative constructor body, set | 1356 // For other fields having setters in the generative constructor body, set |
| 1357 // the type to UNKNOWN to avoid relying on the type set in the initializer | 1357 // the type to UNKNOWN to avoid relying on the type set in the initializer |
| 1358 // list. | 1358 // list. |
| 1359 allSetters.forEach((Element element) { | 1359 allSetters.forEach((Element element) { |
| 1360 backend.registerFieldConstructor(element, HType.UNKNOWN); | 1360 backend.registerFieldConstructor(element, HType.UNKNOWN); |
| 1361 }); | 1361 }); |
| 1362 } | 1362 } |
| 1363 } | 1363 } |
| OLD | NEW |