| 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 js_backend; | 5 part of js_backend; |
| 6 | 6 |
| 7 typedef void Recompile(Element element); | 7 typedef void Recompile(Element element); |
| 8 | 8 |
| 9 class ReturnInfo { | 9 class ReturnInfo { |
| 10 HType returnType; | 10 HType returnType; |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 ClassElement jsNumberClass; | 651 ClassElement jsNumberClass; |
| 652 ClassElement jsIntClass; | 652 ClassElement jsIntClass; |
| 653 ClassElement jsDoubleClass; | 653 ClassElement jsDoubleClass; |
| 654 ClassElement jsFunctionClass; | 654 ClassElement jsFunctionClass; |
| 655 ClassElement jsNullClass; | 655 ClassElement jsNullClass; |
| 656 ClassElement jsBoolClass; | 656 ClassElement jsBoolClass; |
| 657 ClassElement objectInterceptorClass; | 657 ClassElement objectInterceptorClass; |
| 658 Element jsArrayLength; | 658 Element jsArrayLength; |
| 659 Element jsStringLength; | 659 Element jsStringLength; |
| 660 Element getInterceptorMethod; | 660 Element getInterceptorMethod; |
| 661 Element arrayInterceptor; |
| 662 Element boolInterceptor; |
| 663 Element doubleInterceptor; |
| 664 Element functionInterceptor; |
| 665 Element intInterceptor; |
| 666 Element nullInterceptor; |
| 667 Element numberInterceptor; |
| 668 Element stringInterceptor; |
| 661 bool _interceptorsAreInitialized = false; | 669 bool _interceptorsAreInitialized = false; |
| 662 | 670 |
| 663 final Namer namer; | 671 final Namer namer; |
| 664 | 672 |
| 665 /** | 673 /** |
| 666 * Interface used to determine if an object has the JavaScript | 674 * Interface used to determine if an object has the JavaScript |
| 667 * indexing behavior. The interface is only visible to specific | 675 * indexing behavior. The interface is only visible to specific |
| 668 * libraries. | 676 * libraries. |
| 669 */ | 677 */ |
| 670 ClassElement jsIndexingBehaviorInterface; | 678 ClassElement jsIndexingBehaviorInterface; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 jsFunctionClass = | 789 jsFunctionClass = |
| 782 compiler.findInterceptor(const SourceString('JSFunction')); | 790 compiler.findInterceptor(const SourceString('JSFunction')); |
| 783 jsBoolClass = | 791 jsBoolClass = |
| 784 compiler.findInterceptor(const SourceString('JSBool')); | 792 compiler.findInterceptor(const SourceString('JSBool')); |
| 785 jsArrayClass.ensureResolved(compiler); | 793 jsArrayClass.ensureResolved(compiler); |
| 786 jsArrayLength = | 794 jsArrayLength = |
| 787 jsArrayClass.lookupLocalMember(const SourceString('length')); | 795 jsArrayClass.lookupLocalMember(const SourceString('length')); |
| 788 jsStringClass.ensureResolved(compiler); | 796 jsStringClass.ensureResolved(compiler); |
| 789 jsStringLength = | 797 jsStringLength = |
| 790 jsStringClass.lookupLocalMember(const SourceString('length')); | 798 jsStringClass.lookupLocalMember(const SourceString('length')); |
| 799 |
| 800 arrayInterceptor = |
| 801 compiler.findInterceptor(const SourceString('arrayInterceptor')); |
| 802 boolInterceptor = |
| 803 compiler.findInterceptor(const SourceString('boolInterceptor')); |
| 804 doubleInterceptor = |
| 805 compiler.findInterceptor(const SourceString('doubleInterceptor')); |
| 806 functionInterceptor = |
| 807 compiler.findInterceptor(const SourceString('functionInterceptor')); |
| 808 intInterceptor = |
| 809 compiler.findInterceptor(const SourceString('intInterceptor')); |
| 810 nullInterceptor = |
| 811 compiler.findInterceptor(const SourceString('nullInterceptor')); |
| 812 stringInterceptor = |
| 813 compiler.findInterceptor(const SourceString('stringInterceptor')); |
| 814 numberInterceptor = |
| 815 compiler.findInterceptor(const SourceString('numberInterceptor')); |
| 791 } | 816 } |
| 792 | 817 |
| 793 void addInterceptors(ClassElement cls) { | 818 void addInterceptors(ClassElement cls) { |
| 794 cls.ensureResolved(compiler); | 819 cls.ensureResolved(compiler); |
| 795 cls.forEachMember((ClassElement classElement, Element member) { | 820 cls.forEachMember((ClassElement classElement, Element member) { |
| 796 Set<Element> set = interceptedElements.putIfAbsent( | 821 Set<Element> set = interceptedElements.putIfAbsent( |
| 797 member.name, () => new Set<Element>()); | 822 member.name, () => new Set<Element>()); |
| 798 set.add(member); | 823 set.add(member); |
| 799 }, | 824 }, |
| 800 includeSuperMembers: true); | 825 includeSuperMembers: true); |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1100 print("Inferred return types:"); | 1125 print("Inferred return types:"); |
| 1101 print("----------------------"); | 1126 print("----------------------"); |
| 1102 dumpReturnTypes(); | 1127 dumpReturnTypes(); |
| 1103 print(""); | 1128 print(""); |
| 1104 print("Inferred field types:"); | 1129 print("Inferred field types:"); |
| 1105 print("------------------------"); | 1130 print("------------------------"); |
| 1106 fieldTypes.dump(); | 1131 fieldTypes.dump(); |
| 1107 print(""); | 1132 print(""); |
| 1108 } | 1133 } |
| 1109 } | 1134 } |
| OLD | NEW |