| 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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 DartType type = node.typeExpression; | 593 DartType type = node.typeExpression; |
| 594 if (type != null) { | 594 if (type != null) { |
| 595 if (!type.treatAsRaw || type.kind == TypeKind.TYPE_VARIABLE) { | 595 if (!type.treatAsRaw || type.kind == TypeKind.TYPE_VARIABLE) { |
| 596 return node; | 596 return node; |
| 597 } | 597 } |
| 598 if (type.kind == TypeKind.FUNCTION) { | 598 if (type.kind == TypeKind.FUNCTION) { |
| 599 // TODO(johnniwinther): Optimize function type conversions. | 599 // TODO(johnniwinther): Optimize function type conversions. |
| 600 return node; | 600 return node; |
| 601 } | 601 } |
| 602 } | 602 } |
| 603 return removeIfCheckAlwaysSucceeds(node, node.instructionType); | 603 return removeIfCheckAlwaysSucceeds(node, node.checkedType); |
| 604 } | 604 } |
| 605 | 605 |
| 606 HInstruction visitTypeKnown(HTypeKnown node) { | 606 HInstruction visitTypeKnown(HTypeKnown node) { |
| 607 return removeIfCheckAlwaysSucceeds(node, node.knownType); | 607 return removeIfCheckAlwaysSucceeds(node, node.knownType); |
| 608 } | 608 } |
| 609 | 609 |
| 610 HInstruction removeIfCheckAlwaysSucceeds(HCheck node, HType checkedType) { | 610 HInstruction removeIfCheckAlwaysSucceeds(HCheck node, HType checkedType) { |
| 611 if (checkedType.isUnknown()) return node; | 611 if (checkedType.isUnknown()) return node; |
| 612 HInstruction input = node.checkedInput; | 612 HInstruction input = node.checkedInput; |
| 613 HType inputType = input.instructionType; | 613 HType inputType = input.instructionType; |
| (...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1514 // that knows it is not of a specific Type. | 1514 // that knows it is not of a specific Type. |
| 1515 } | 1515 } |
| 1516 | 1516 |
| 1517 for (HIf ifUser in notIfUsers) { | 1517 for (HIf ifUser in notIfUsers) { |
| 1518 changeUsesDominatedBy(ifUser.elseBlock, input, convertedType); | 1518 changeUsesDominatedBy(ifUser.elseBlock, input, convertedType); |
| 1519 // TODO(ngeoffray): Also change uses for the then block on a HType | 1519 // TODO(ngeoffray): Also change uses for the then block on a HType |
| 1520 // that knows it is not of a specific Type. | 1520 // that knows it is not of a specific Type. |
| 1521 } | 1521 } |
| 1522 } | 1522 } |
| 1523 } | 1523 } |
| OLD | NEW |