| 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 abstract class OptimizationPhase { | 5 abstract class OptimizationPhase { |
| 6 String get name; | 6 String get name; |
| 7 void visitGraph(HGraph graph); | 7 void visitGraph(HGraph graph); |
| 8 } | 8 } |
| 9 | 9 |
| 10 class SsaOptimizerTask extends CompilerTask { | 10 class SsaOptimizerTask extends CompilerTask { |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 return node; | 573 return node; |
| 574 } | 574 } |
| 575 | 575 |
| 576 HInstruction visitTypeConversion(HTypeConversion node) { | 576 HInstruction visitTypeConversion(HTypeConversion node) { |
| 577 HInstruction value = node.inputs[0]; | 577 HInstruction value = node.inputs[0]; |
| 578 DartType type = types[node].computeType(compiler); | 578 DartType type = types[node].computeType(compiler); |
| 579 if (type.element === compiler.dynamicClass | 579 if (type.element === compiler.dynamicClass |
| 580 || type.element === compiler.objectClass) { | 580 || type.element === compiler.objectClass) { |
| 581 return value; | 581 return value; |
| 582 } | 582 } |
| 583 if (types[value].canBeNull() && node.isBooleanConversionCheck) { |
| 584 return node; |
| 585 } |
| 583 HType combinedType = types[value].intersection(types[node]); | 586 HType combinedType = types[value].intersection(types[node]); |
| 584 return (combinedType == types[value]) ? value : node; | 587 return (combinedType == types[value]) ? value : node; |
| 585 } | 588 } |
| 586 | 589 |
| 587 Element findConcreteFieldForDynamicAccess(HInstruction receiver, | 590 Element findConcreteFieldForDynamicAccess(HInstruction receiver, |
| 588 Selector selector) { | 591 Selector selector) { |
| 589 HType receiverType = types[receiver]; | 592 HType receiverType = types[receiver]; |
| 590 if (!receiverType.isUseful()) return null; | 593 if (!receiverType.isUseful()) return null; |
| 591 if (receiverType.canBeNull()) return null; | 594 if (receiverType.canBeNull()) return null; |
| 592 DartType type = receiverType.computeType(compiler); | 595 DartType type = receiverType.computeType(compiler); |
| (...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1366 // this type for the field is still a strong signal | 1369 // this type for the field is still a strong signal |
| 1367 // indicating the expected type of the field. | 1370 // indicating the expected type of the field. |
| 1368 types[field] = type; | 1371 types[field] = type; |
| 1369 } else { | 1372 } else { |
| 1370 // If there are no invoked setters we know the type of | 1373 // If there are no invoked setters we know the type of |
| 1371 // this field for sure. | 1374 // this field for sure. |
| 1372 field.guaranteedType = type; | 1375 field.guaranteedType = type; |
| 1373 } | 1376 } |
| 1374 } | 1377 } |
| 1375 } | 1378 } |
| OLD | NEW |