| 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 class Interceptors { | 5 class Interceptors { |
| 6 Compiler compiler; | 6 Compiler compiler; |
| 7 Interceptors(Compiler this.compiler); | 7 Interceptors(Compiler this.compiler); |
| 8 | 8 |
| 9 SourceString mapOperatorToMethodName(Operator op) { | 9 SourceString mapOperatorToMethodName(Operator op) { |
| 10 String name = op.source.stringValue; | 10 String name = op.source.stringValue; |
| (...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 push(new HNot(bl)); | 776 push(new HNot(bl)); |
| 777 break; | 777 break; |
| 778 default: compiler.unimplemented("SsaBuilder.visitBinary"); | 778 default: compiler.unimplemented("SsaBuilder.visitBinary"); |
| 779 } | 779 } |
| 780 } | 780 } |
| 781 | 781 |
| 782 void generateGetter(Send send, Element element) { | 782 void generateGetter(Send send, Element element) { |
| 783 Selector selector = elements.getSelector(send); | 783 Selector selector = elements.getSelector(send); |
| 784 if (Elements.isStaticOrTopLevelField(element)) { | 784 if (Elements.isStaticOrTopLevelField(element)) { |
| 785 push(new HStatic(element)); | 785 push(new HStatic(element)); |
| 786 if (element.kind == ElementKind.GETTER) { |
| 787 push(new HInvokeStatic(selector, <HInstruction>[pop()])); |
| 788 } |
| 786 } else if (element === null || Elements.isInstanceField(element)) { | 789 } else if (element === null || Elements.isInstanceField(element)) { |
| 787 HInstruction receiver; | 790 HInstruction receiver; |
| 788 if (send.receiver == null) { | 791 if (send.receiver == null) { |
| 789 receiver = thisDefinition; | 792 receiver = thisDefinition; |
| 790 if (receiver === null) { | 793 if (receiver === null) { |
| 791 compiler.unimplemented("SsaBuilder.generateGetter.", node: send); | 794 compiler.unimplemented("SsaBuilder.generateGetter.", node: send); |
| 792 } | 795 } |
| 793 } else { | 796 } else { |
| 794 visit(send.receiver); | 797 visit(send.receiver); |
| 795 receiver = pop(); | 798 receiver = pop(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 813 compiler.unimplemented("SsaBuilder.visitSend with static", node: send); | 816 compiler.unimplemented("SsaBuilder.visitSend with static", node: send); |
| 814 } | 817 } |
| 815 assert(instruction !== null); | 818 assert(instruction !== null); |
| 816 stack.add(instruction); | 819 stack.add(instruction); |
| 817 } | 820 } |
| 818 } | 821 } |
| 819 | 822 |
| 820 void generateSetter(SendSet send, Element element, HInstruction value) { | 823 void generateSetter(SendSet send, Element element, HInstruction value) { |
| 821 Selector selector = elements.getSelector(send); | 824 Selector selector = elements.getSelector(send); |
| 822 if (Elements.isStaticOrTopLevelField(element)) { | 825 if (Elements.isStaticOrTopLevelField(element)) { |
| 823 add(new HStaticStore(element, value)); | 826 if (element.kind == ElementKind.SETTER) { |
| 827 HStatic target = new HStatic(element); |
| 828 add(target); |
| 829 add(new HInvokeStatic(selector, <HInstruction>[target, value])); |
| 830 } else { |
| 831 add(new HStaticStore(element, value)); |
| 832 } |
| 824 stack.add(value); | 833 stack.add(value); |
| 825 } else if (Elements.isInstanceField(element)) { | 834 } else if (element === null || Elements.isInstanceField(element)) { |
| 826 SourceString methodName = element.name; | |
| 827 HInstruction receiver = thisDefinition; | |
| 828 if (receiver === null) { | |
| 829 compiler.unimplemented("Ssa.generateSetter.", node: send); | |
| 830 } | |
| 831 add(new HInvokeDynamicSetter( | |
| 832 selector, element, methodName, receiver, value)); | |
| 833 stack.add(value); | |
| 834 } else if (element === null) { | |
| 835 SourceString dartSetterName = send.selector.asIdentifier().source; | 835 SourceString dartSetterName = send.selector.asIdentifier().source; |
| 836 HInstruction receiver; | 836 HInstruction receiver; |
| 837 if (send.receiver == null) { | 837 if (send.receiver == null) { |
| 838 receiver = thisDefinition; | 838 receiver = thisDefinition; |
| 839 if (receiver === null) { | 839 if (receiver === null) { |
| 840 compiler.unimplemented("Ssa.generateSetter.", node: send); | 840 compiler.unimplemented("Ssa.generateSetter.", node: send); |
| 841 } | 841 } |
| 842 } else { | 842 } else { |
| 843 visit(send.receiver); | 843 visit(send.receiver); |
| 844 receiver = pop(); | 844 receiver = pop(); |
| (...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1527 } | 1527 } |
| 1528 | 1528 |
| 1529 visitCatchBlock(CatchBlock node) { | 1529 visitCatchBlock(CatchBlock node) { |
| 1530 compiler.unimplemented('SsaBuilder.visitCatchBlock', node: node); | 1530 compiler.unimplemented('SsaBuilder.visitCatchBlock', node: node); |
| 1531 } | 1531 } |
| 1532 | 1532 |
| 1533 visitTypedef(Typedef node) { | 1533 visitTypedef(Typedef node) { |
| 1534 compiler.unimplemented('SsaBuilder.visitTypedef', node: node); | 1534 compiler.unimplemented('SsaBuilder.visitTypedef', node: node); |
| 1535 } | 1535 } |
| 1536 } | 1536 } |
| OLD | NEW |