| 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 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 result.guaranteedType = type; | 609 result.guaranteedType = type; |
| 610 backend.registerFieldTypesOptimization( | 610 backend.registerFieldTypesOptimization( |
| 611 work.element, field, result.guaranteedType); | 611 work.element, field, result.guaranteedType); |
| 612 } | 612 } |
| 613 return result; | 613 return result; |
| 614 } | 614 } |
| 615 | 615 |
| 616 HInstruction visitInvokeDynamicSetter(HInvokeDynamicSetter node) { | 616 HInstruction visitInvokeDynamicSetter(HInvokeDynamicSetter node) { |
| 617 Element field = | 617 Element field = |
| 618 findConcreteFieldForDynamicAccess(node.receiver, node.selector); | 618 findConcreteFieldForDynamicAccess(node.receiver, node.selector); |
| 619 if (field == null) return node; | 619 if (field == null || !field.isAssignable()) return node; |
| 620 HInstruction value = node.inputs[1]; | 620 HInstruction value = node.inputs[1]; |
| 621 if (compiler.enableTypeAssertions) { | 621 if (compiler.enableTypeAssertions) { |
| 622 HInstruction other = value.convertType( | 622 HInstruction other = value.convertType( |
| 623 compiler, field, HTypeConversion.CHECKED_MODE_CHECK); | 623 compiler, field, HTypeConversion.CHECKED_MODE_CHECK); |
| 624 if (other != value) { | 624 if (other != value) { |
| 625 node.block.addBefore(node, other); | 625 node.block.addBefore(node, other); |
| 626 value = other; | 626 value = other; |
| 627 } | 627 } |
| 628 } | 628 } |
| 629 return new HFieldSet(field, node.inputs[0], value); | 629 return new HFieldSet(field, node.inputs[0], value); |
| (...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1340 } | 1340 } |
| 1341 | 1341 |
| 1342 // For other fields having setters in the generative constructor body, set | 1342 // For other fields having setters in the generative constructor body, set |
| 1343 // the type to UNKNOWN to avoid relying on the type set in the initializer | 1343 // the type to UNKNOWN to avoid relying on the type set in the initializer |
| 1344 // list. | 1344 // list. |
| 1345 allSetters.forEach((Element element) { | 1345 allSetters.forEach((Element element) { |
| 1346 backend.registerFieldConstructor(element, HType.UNKNOWN); | 1346 backend.registerFieldConstructor(element, HType.UNKNOWN); |
| 1347 }); | 1347 }); |
| 1348 } | 1348 } |
| 1349 } | 1349 } |
| OLD | NEW |