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 class SsaFunctionCompiler implements FunctionCompiler { | 7 class SsaFunctionCompiler implements FunctionCompiler { |
8 final SsaCodeGeneratorTask generator; | 8 final SsaCodeGeneratorTask generator; |
9 final SsaBuilderTask builder; | 9 final SsaBuilderTask builder; |
10 final SsaOptimizerTask optimizer; | 10 final SsaOptimizerTask optimizer; |
(...skipping 3610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3621 // An erroneous element indicates an unresolved static setter. | 3621 // An erroneous element indicates an unresolved static setter. |
3622 generateThrowNoSuchMethod( | 3622 generateThrowNoSuchMethod( |
3623 location, noSuchMethodTargetSymbolString(element, 'set'), | 3623 location, noSuchMethodTargetSymbolString(element, 'set'), |
3624 argumentValues: arguments); | 3624 argumentValues: arguments); |
3625 } | 3625 } |
3626 | 3626 |
3627 void generateNonInstanceSetter(ast.SendSet send, | 3627 void generateNonInstanceSetter(ast.SendSet send, |
3628 Element element, | 3628 Element element, |
3629 HInstruction value, | 3629 HInstruction value, |
3630 {ast.Node location}) { | 3630 {ast.Node location}) { |
3631 assert(send == null || !Elements.isInstanceSend(send, elements)); | |
3632 if (location == null) { | 3631 if (location == null) { |
3633 assert(send != null); | 3632 assert(send != null); |
3634 location = send; | 3633 location = send; |
3635 } | 3634 } |
| 3635 assert(invariant(location, |
| 3636 send == null || !Elements.isInstanceSend(send, elements), |
| 3637 message: "Unexpected non instance setter: $element.")); |
3636 if (Elements.isStaticOrTopLevelField(element)) { | 3638 if (Elements.isStaticOrTopLevelField(element)) { |
3637 if (element.isSetter) { | 3639 if (element.isSetter) { |
3638 pushInvokeStatic(location, element, <HInstruction>[value]); | 3640 pushInvokeStatic(location, element, <HInstruction>[value]); |
3639 pop(); | 3641 pop(); |
3640 } else { | 3642 } else { |
3641 VariableElement field = element; | 3643 VariableElement field = element; |
3642 value = potentiallyCheckOrTrustType(value, field.type); | 3644 value = potentiallyCheckOrTrustType(value, field.type); |
3643 addWithPosition(new HStaticStore(element, value), location); | 3645 addWithPosition(new HStaticStore(element, value), location); |
3644 } | 3646 } |
3645 stack.add(value); | 3647 stack.add(value); |
(...skipping 5215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8861 if (unaliased is TypedefType) throw 'unable to unalias $type'; | 8863 if (unaliased is TypedefType) throw 'unable to unalias $type'; |
8862 unaliased.accept(this, builder); | 8864 unaliased.accept(this, builder); |
8863 } | 8865 } |
8864 | 8866 |
8865 void visitDynamicType(DynamicType type, SsaBuilder builder) { | 8867 void visitDynamicType(DynamicType type, SsaBuilder builder) { |
8866 JavaScriptBackend backend = builder.compiler.backend; | 8868 JavaScriptBackend backend = builder.compiler.backend; |
8867 ClassElement cls = backend.findHelper('DynamicRuntimeType'); | 8869 ClassElement cls = backend.findHelper('DynamicRuntimeType'); |
8868 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); | 8870 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); |
8869 } | 8871 } |
8870 } | 8872 } |
OLD | NEW |