| 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 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 push(new HNot(bl)); | 781 push(new HNot(bl)); |
| 782 break; | 782 break; |
| 783 default: compiler.unimplemented("SsaBuilder.visitBinary"); | 783 default: compiler.unimplemented("SsaBuilder.visitBinary"); |
| 784 } | 784 } |
| 785 } | 785 } |
| 786 | 786 |
| 787 void generateGetter(Send send, Element element) { | 787 void generateGetter(Send send, Element element) { |
| 788 Selector selector = elements.getSelector(send); | 788 Selector selector = elements.getSelector(send); |
| 789 if (Elements.isStaticOrTopLevelField(element)) { | 789 if (Elements.isStaticOrTopLevelField(element)) { |
| 790 push(new HStatic(element)); | 790 push(new HStatic(element)); |
| 791 } else if (element === null || Elements.isInstanceField(element)) { | 791 if (element.kind == ElementKind.GETTER) { |
| 792 push(new HInvokeStatic(selector, <HInstruction>[pop()])); |
| 793 } |
| 794 } else if (element === null |
| 795 || Elements.isInstanceField(element)) { |
| 792 HInstruction receiver; | 796 HInstruction receiver; |
| 793 if (send.receiver == null) { | 797 if (send.receiver == null) { |
| 794 receiver = thisDefinition; | 798 receiver = thisDefinition; |
| 795 if (receiver === null) { | 799 if (receiver === null) { |
| 796 compiler.unimplemented("SsaBuilder.generateGetter.", node: send); | 800 compiler.unimplemented("SsaBuilder.generateGetter.", node: send); |
| 797 } | 801 } |
| 798 } else { | 802 } else { |
| 799 visit(send.receiver); | 803 visit(send.receiver); |
| 800 receiver = pop(); | 804 receiver = pop(); |
| 801 } | 805 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 818 compiler.unimplemented("SsaBuilder.visitSend with static", node: send); | 822 compiler.unimplemented("SsaBuilder.visitSend with static", node: send); |
| 819 } | 823 } |
| 820 assert(instruction !== null); | 824 assert(instruction !== null); |
| 821 stack.add(instruction); | 825 stack.add(instruction); |
| 822 } | 826 } |
| 823 } | 827 } |
| 824 | 828 |
| 825 void generateSetter(SendSet send, Element element, HInstruction value) { | 829 void generateSetter(SendSet send, Element element, HInstruction value) { |
| 826 Selector selector = elements.getSelector(send); | 830 Selector selector = elements.getSelector(send); |
| 827 if (Elements.isStaticOrTopLevelField(element)) { | 831 if (Elements.isStaticOrTopLevelField(element)) { |
| 828 add(new HStaticStore(element, value)); | 832 if (element.kind == ElementKind.SETTER) { |
| 833 HStatic target = new HStatic(element); |
| 834 add(target); |
| 835 add(new HInvokeStatic(selector, <HInstruction>[target, value])); |
| 836 } else { |
| 837 add(new HStaticStore(element, value)); |
| 838 } |
| 829 stack.add(value); | 839 stack.add(value); |
| 830 } else if (Elements.isInstanceField(element)) { | 840 } else if (element === null |
| 831 SourceString methodName = element.name; | 841 || Elements.isInstanceField(element)) { |
| 832 HInstruction receiver = thisDefinition; | |
| 833 if (receiver === null) { | |
| 834 compiler.unimplemented("Ssa.generateSetter.", node: send); | |
| 835 } | |
| 836 add(new HInvokeDynamicSetter( | |
| 837 selector, element, methodName, receiver, value)); | |
| 838 stack.add(value); | |
| 839 } else if (element === null) { | |
| 840 SourceString dartSetterName = send.selector.asIdentifier().source; | 842 SourceString dartSetterName = send.selector.asIdentifier().source; |
| 841 HInstruction receiver; | 843 HInstruction receiver; |
| 842 if (send.receiver == null) { | 844 if (send.receiver == null) { |
| 843 receiver = thisDefinition; | 845 receiver = thisDefinition; |
| 844 if (receiver === null) { | 846 if (receiver === null) { |
| 845 compiler.unimplemented("Ssa.generateSetter.", node: send); | 847 compiler.unimplemented("Ssa.generateSetter.", node: send); |
| 846 } | 848 } |
| 847 } else { | 849 } else { |
| 848 visit(send.receiver); | 850 visit(send.receiver); |
| 849 receiver = pop(); | 851 receiver = pop(); |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1428 } | 1430 } |
| 1429 | 1431 |
| 1430 visitCatchBlock(CatchBlock node) { | 1432 visitCatchBlock(CatchBlock node) { |
| 1431 compiler.unimplemented('SsaBuilder.visitCatchBlock', node: node); | 1433 compiler.unimplemented('SsaBuilder.visitCatchBlock', node: node); |
| 1432 } | 1434 } |
| 1433 | 1435 |
| 1434 visitTypedef(Typedef node) { | 1436 visitTypedef(Typedef node) { |
| 1435 compiler.unimplemented('SsaBuilder.visitTypedef', node: node); | 1437 compiler.unimplemented('SsaBuilder.visitTypedef', node: node); |
| 1436 } | 1438 } |
| 1437 } | 1439 } |
| OLD | NEW |