| 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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 HType leftType = left.instructionType; | 481 HType leftType = left.instructionType; |
| 482 HType rightType = right.instructionType; | 482 HType rightType = right.instructionType; |
| 483 | 483 |
| 484 // Intersection of int and double return conflicting, so | 484 // Intersection of int and double return conflicting, so |
| 485 // we don't optimize on numbers to preserve the runtime semantics. | 485 // we don't optimize on numbers to preserve the runtime semantics. |
| 486 if (!(left.isNumberOrNull() && right.isNumberOrNull()) && | 486 if (!(left.isNumberOrNull() && right.isNumberOrNull()) && |
| 487 leftType.intersection(rightType, compiler).isConflicting()) { | 487 leftType.intersection(rightType, compiler).isConflicting()) { |
| 488 return graph.addConstantBool(false, constantSystem); | 488 return graph.addConstantBool(false, constantSystem); |
| 489 } | 489 } |
| 490 | 490 |
| 491 if (left.isNull() && right.isNull()) { |
| 492 return graph.addConstantBool(true, constantSystem); |
| 493 } |
| 494 |
| 491 if (left.isConstantBoolean() && right.isBoolean()) { | 495 if (left.isConstantBoolean() && right.isBoolean()) { |
| 492 HConstant constant = left; | 496 HConstant constant = left; |
| 493 if (constant.constant.isTrue()) { | 497 if (constant.constant.isTrue()) { |
| 494 return right; | 498 return right; |
| 495 } else { | 499 } else { |
| 496 return new HNot(right); | 500 return new HNot(right); |
| 497 } | 501 } |
| 498 } | 502 } |
| 499 | 503 |
| 500 if (right.isConstantBoolean() && left.isBoolean()) { | 504 if (right.isConstantBoolean() && left.isBoolean()) { |
| (...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1484 } | 1488 } |
| 1485 | 1489 |
| 1486 // For other fields having setters in the generative constructor body, set | 1490 // For other fields having setters in the generative constructor body, set |
| 1487 // the type to UNKNOWN to avoid relying on the type set in the initializer | 1491 // the type to UNKNOWN to avoid relying on the type set in the initializer |
| 1488 // list. | 1492 // list. |
| 1489 allSetters.forEach((Element element) { | 1493 allSetters.forEach((Element element) { |
| 1490 backend.registerFieldConstructor(element, HType.UNKNOWN); | 1494 backend.registerFieldConstructor(element, HType.UNKNOWN); |
| 1491 }); | 1495 }); |
| 1492 } | 1496 } |
| 1493 } | 1497 } |
| OLD | NEW |