| 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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 } | 599 } |
| 600 return node; | 600 return node; |
| 601 } | 601 } |
| 602 | 602 |
| 603 HInstruction visitTypeConversion(HTypeConversion node) { | 603 HInstruction visitTypeConversion(HTypeConversion node) { |
| 604 HInstruction value = node.inputs[0]; | 604 HInstruction value = node.inputs[0]; |
| 605 DartType type = node.typeExpression; | 605 DartType type = node.typeExpression; |
| 606 if (type != null && (!type.isRaw || type.kind == TypeKind.TYPE_VARIABLE)) { | 606 if (type != null && (!type.isRaw || type.kind == TypeKind.TYPE_VARIABLE)) { |
| 607 return node; | 607 return node; |
| 608 } | 608 } |
| 609 if (type != null && type.kind == TypeKind.FUNCTION) { |
| 610 // TODO(johnniwinther): Optimize function type conversions. |
| 611 return node; |
| 612 } |
| 609 HType convertedType = node.instructionType; | 613 HType convertedType = node.instructionType; |
| 610 if (convertedType.isUnknown()) return node; | 614 if (convertedType.isUnknown()) return node; |
| 611 HType combinedType = value.instructionType.intersection( | 615 HType combinedType = value.instructionType.intersection( |
| 612 convertedType, compiler); | 616 convertedType, compiler); |
| 613 return (combinedType == value.instructionType) ? value : node; | 617 return (combinedType == value.instructionType) ? value : node; |
| 614 } | 618 } |
| 615 | 619 |
| 616 Element findConcreteFieldForDynamicAccess(HInstruction receiver, | 620 Element findConcreteFieldForDynamicAccess(HInstruction receiver, |
| 617 Selector selector) { | 621 Selector selector) { |
| 618 HType receiverType = receiver.instructionType; | 622 HType receiverType = receiver.instructionType; |
| (...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1487 } | 1491 } |
| 1488 | 1492 |
| 1489 // For other fields having setters in the generative constructor body, set | 1493 // For other fields having setters in the generative constructor body, set |
| 1490 // the type to UNKNOWN to avoid relying on the type set in the initializer | 1494 // the type to UNKNOWN to avoid relying on the type set in the initializer |
| 1491 // list. | 1495 // list. |
| 1492 allSetters.forEach((Element element) { | 1496 allSetters.forEach((Element element) { |
| 1493 backend.registerFieldConstructor(element, HType.UNKNOWN); | 1497 backend.registerFieldConstructor(element, HType.UNKNOWN); |
| 1494 }); | 1498 }); |
| 1495 } | 1499 } |
| 1496 } | 1500 } |
| OLD | NEW |