Chromium Code Reviews| 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 } | 589 } |
| 590 return node; | 590 return node; |
| 591 } | 591 } |
| 592 | 592 |
| 593 HInstruction visitTypeConversion(HTypeConversion node) { | 593 HInstruction visitTypeConversion(HTypeConversion node) { |
| 594 HInstruction value = node.inputs[0]; | 594 HInstruction value = node.inputs[0]; |
| 595 DartType type = node.typeExpression; | 595 DartType type = node.typeExpression; |
| 596 if (type != null && (!type.isRaw || type.kind == TypeKind.TYPE_VARIABLE)) { | 596 if (type != null && (!type.isRaw || type.kind == TypeKind.TYPE_VARIABLE)) { |
| 597 return node; | 597 return node; |
| 598 } | 598 } |
| 599 if (type != null && type.kind == TypeKind.FUNCTION) { | |
|
karlklose
2013/06/20 07:32:55
Merge the conditions? Or have one if (type != null
Johnni Winther
2013/06/21 12:19:15
Done.
| |
| 600 // TODO(johnniwinther): Optimize function type conversions. | |
| 601 return node; | |
| 602 } | |
| 599 HType convertedType = node.instructionType; | 603 HType convertedType = node.instructionType; |
| 600 if (convertedType.isUnknown()) return node; | 604 if (convertedType.isUnknown()) return node; |
| 601 HType combinedType = value.instructionType.intersection( | 605 HType combinedType = value.instructionType.intersection( |
| 602 convertedType, compiler); | 606 convertedType, compiler); |
| 603 return (combinedType == value.instructionType) ? value : node; | 607 return (combinedType == value.instructionType) ? value : node; |
| 604 } | 608 } |
| 605 | 609 |
| 606 Element findConcreteFieldForDynamicAccess(HInstruction receiver, | 610 Element findConcreteFieldForDynamicAccess(HInstruction receiver, |
| 607 Selector selector) { | 611 Selector selector) { |
| 608 HType receiverType = receiver.instructionType; | 612 HType receiverType = receiver.instructionType; |
| (...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1323 // that knows it is not of a specific Type. | 1327 // that knows it is not of a specific Type. |
| 1324 } | 1328 } |
| 1325 | 1329 |
| 1326 for (HIf ifUser in notIfUsers) { | 1330 for (HIf ifUser in notIfUsers) { |
| 1327 changeUsesDominatedBy(ifUser.elseBlock, input, convertedType); | 1331 changeUsesDominatedBy(ifUser.elseBlock, input, convertedType); |
| 1328 // TODO(ngeoffray): Also change uses for the then block on a HType | 1332 // TODO(ngeoffray): Also change uses for the then block on a HType |
| 1329 // that knows it is not of a specific Type. | 1333 // that knows it is not of a specific Type. |
| 1330 } | 1334 } |
| 1331 } | 1335 } |
| 1332 } | 1336 } |
| OLD | NEW |