| 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 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 if (type === null) return null; | 572 if (type === null) return null; |
| 573 return compiler.world.locateSingleField(type, selector); | 573 return compiler.world.locateSingleField(type, selector); |
| 574 } | 574 } |
| 575 | 575 |
| 576 HInstruction visitInvokeDynamicGetter(HInvokeDynamicGetter node) { | 576 HInstruction visitInvokeDynamicGetter(HInvokeDynamicGetter node) { |
| 577 Element field = | 577 Element field = |
| 578 findConcreteFieldForDynamicAccess(node.receiver, node.selector); | 578 findConcreteFieldForDynamicAccess(node.receiver, node.selector); |
| 579 if (field == null) return node; | 579 if (field == null) return node; |
| 580 | 580 |
| 581 Modifiers modifiers = field.modifiers; | 581 Modifiers modifiers = field.modifiers; |
| 582 bool isFinalOrConst = false; | 582 bool isFinalOrConst = modifiers.isFinal() || modifiers.isConst(); |
| 583 if (modifiers != null) { | |
| 584 isFinalOrConst = modifiers.isFinal() || modifiers.isConst(); | |
| 585 } | |
| 586 if (!compiler.resolverWorld.hasInvokedSetter(field, compiler)) { | 583 if (!compiler.resolverWorld.hasInvokedSetter(field, compiler)) { |
| 587 // If no setter is ever used for this field it is only initialized in the | 584 // If no setter is ever used for this field it is only initialized in the |
| 588 // initializer list. | 585 // initializer list. |
| 589 isFinalOrConst = true; | 586 isFinalOrConst = true; |
| 590 } | 587 } |
| 591 HFieldGet result = new HFieldGet( | 588 HFieldGet result = new HFieldGet( |
| 592 field, node.inputs[0], isAssignable: !isFinalOrConst); | 589 field, node.inputs[0], isAssignable: !isFinalOrConst); |
| 593 HType type = backend.optimisticFieldType(field); | 590 HType type = backend.optimisticFieldType(field); |
| 594 if (type != null) { | 591 if (type != null) { |
| 595 result.guaranteedType = type; | 592 result.guaranteedType = type; |
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1325 } | 1322 } |
| 1326 | 1323 |
| 1327 // For other fields having setters in the generative constructor body, set | 1324 // For other fields having setters in the generative constructor body, set |
| 1328 // the type to UNKNOWN to avoid relying on the type set in the initializer | 1325 // the type to UNKNOWN to avoid relying on the type set in the initializer |
| 1329 // list. | 1326 // list. |
| 1330 allSetters.forEach((Element element) { | 1327 allSetters.forEach((Element element) { |
| 1331 backend.registerFieldConstructor(element, HType.UNKNOWN); | 1328 backend.registerFieldConstructor(element, HType.UNKNOWN); |
| 1332 }); | 1329 }); |
| 1333 } | 1330 } |
| 1334 } | 1331 } |
| OLD | NEW |