| 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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 } else if (expressionMask.intersection(typeMask, compiler).isEmpty) { | 589 } else if (expressionMask.intersection(typeMask, compiler).isEmpty) { |
| 590 return graph.addConstantBool(false, compiler); | 590 return graph.addConstantBool(false, compiler); |
| 591 } | 591 } |
| 592 } | 592 } |
| 593 return node; | 593 return node; |
| 594 } | 594 } |
| 595 | 595 |
| 596 HInstruction visitTypeConversion(HTypeConversion node) { | 596 HInstruction visitTypeConversion(HTypeConversion node) { |
| 597 HInstruction value = node.inputs[0]; | 597 HInstruction value = node.inputs[0]; |
| 598 DartType type = node.typeExpression; | 598 DartType type = node.typeExpression; |
| 599 if (type != null && (!type.isRaw || type.kind == TypeKind.TYPE_VARIABLE)) { | 599 if (type != null) { |
| 600 return node; | 600 if (!type.isRaw || type.kind == TypeKind.TYPE_VARIABLE) { |
| 601 return node; |
| 602 } |
| 603 if (type.kind == TypeKind.FUNCTION) { |
| 604 // TODO(johnniwinther): Optimize function type conversions. |
| 605 return node; |
| 606 } |
| 601 } | 607 } |
| 602 HType convertedType = node.instructionType; | 608 HType convertedType = node.instructionType; |
| 603 if (convertedType.isUnknown()) return node; | 609 if (convertedType.isUnknown()) return node; |
| 604 HType combinedType = value.instructionType.intersection( | 610 HType combinedType = value.instructionType.intersection( |
| 605 convertedType, compiler); | 611 convertedType, compiler); |
| 606 return (combinedType == value.instructionType) ? value : node; | 612 return (combinedType == value.instructionType) ? value : node; |
| 607 } | 613 } |
| 608 | 614 |
| 609 Element findConcreteFieldForDynamicAccess(HInstruction receiver, | 615 Element findConcreteFieldForDynamicAccess(HInstruction receiver, |
| 610 Selector selector) { | 616 Selector selector) { |
| (...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1330 // that knows it is not of a specific Type. | 1336 // that knows it is not of a specific Type. |
| 1331 } | 1337 } |
| 1332 | 1338 |
| 1333 for (HIf ifUser in notIfUsers) { | 1339 for (HIf ifUser in notIfUsers) { |
| 1334 changeUsesDominatedBy(ifUser.elseBlock, input, convertedType); | 1340 changeUsesDominatedBy(ifUser.elseBlock, input, convertedType); |
| 1335 // TODO(ngeoffray): Also change uses for the then block on a HType | 1341 // TODO(ngeoffray): Also change uses for the then block on a HType |
| 1336 // that knows it is not of a specific Type. | 1342 // that knows it is not of a specific Type. |
| 1337 } | 1343 } |
| 1338 } | 1344 } |
| 1339 } | 1345 } |
| OLD | NEW |