| 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 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 getDispatchPropertyMethod = | 865 getDispatchPropertyMethod = |
| 866 compiler.findInterceptor(const SourceString('getDispatchProperty')); | 866 compiler.findInterceptor(const SourceString('getDispatchProperty')); |
| 867 setDispatchPropertyMethod = | 867 setDispatchPropertyMethod = |
| 868 compiler.findInterceptor(const SourceString('setDispatchProperty')); | 868 compiler.findInterceptor(const SourceString('setDispatchProperty')); |
| 869 getNativeInterceptorMethod = | 869 getNativeInterceptorMethod = |
| 870 compiler.findInterceptor(const SourceString('getNativeInterceptor')); | 870 compiler.findInterceptor(const SourceString('getNativeInterceptor')); |
| 871 defineNativeMethodsFinishMethod = | 871 defineNativeMethodsFinishMethod = |
| 872 compiler.findHelper(const SourceString('defineNativeMethodsFinish')); | 872 compiler.findHelper(const SourceString('defineNativeMethodsFinish')); |
| 873 | 873 |
| 874 // These methods are overwritten with generated versions. | 874 // These methods are overwritten with generated versions. |
| 875 forbidInlining(getInterceptorMethod); | 875 canBeInlined[getInterceptorMethod] = false; |
| 876 forbidInlining(getDispatchPropertyMethod); | 876 canBeInlined[getDispatchPropertyMethod] = false; |
| 877 forbidInlining(setDispatchPropertyMethod); | 877 canBeInlined[setDispatchPropertyMethod] = false; |
| 878 | 878 |
| 879 List<ClassElement> classes = [ | 879 List<ClassElement> classes = [ |
| 880 jsInterceptorClass = | 880 jsInterceptorClass = |
| 881 compiler.findInterceptor(const SourceString('Interceptor')), | 881 compiler.findInterceptor(const SourceString('Interceptor')), |
| 882 jsStringClass = compiler.findInterceptor(const SourceString('JSString')), | 882 jsStringClass = compiler.findInterceptor(const SourceString('JSString')), |
| 883 jsArrayClass = compiler.findInterceptor(const SourceString('JSArray')), | 883 jsArrayClass = compiler.findInterceptor(const SourceString('JSArray')), |
| 884 // The int class must be before the double class, because the | 884 // The int class must be before the double class, because the |
| 885 // emitter relies on this list for the order of type checks. | 885 // emitter relies on this list for the order of type checks. |
| 886 jsIntClass = compiler.findInterceptor(const SourceString('JSInt')), | 886 jsIntClass = compiler.findInterceptor(const SourceString('JSInt')), |
| 887 jsDoubleClass = compiler.findInterceptor(const SourceString('JSDouble')), | 887 jsDoubleClass = compiler.findInterceptor(const SourceString('JSDouble')), |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 compiler.objectClass, const SourceString('==')); | 942 compiler.objectClass, const SourceString('==')); |
| 943 | 943 |
| 944 specialOperatorEqClasses | 944 specialOperatorEqClasses |
| 945 ..add(compiler.objectClass) | 945 ..add(compiler.objectClass) |
| 946 ..add(jsInterceptorClass) | 946 ..add(jsInterceptorClass) |
| 947 ..add(jsNullClass); | 947 ..add(jsNullClass); |
| 948 | 948 |
| 949 validateInterceptorImplementsAllObjectMethods(jsInterceptorClass); | 949 validateInterceptorImplementsAllObjectMethods(jsInterceptorClass); |
| 950 } | 950 } |
| 951 | 951 |
| 952 void forbidInlining(Element element) { | |
| 953 // This guard is needed because the backend is initialized even for | |
| 954 // --analyze-only compiles which skip some helper libraries. | |
| 955 if (element is FunctionElement) { | |
| 956 canBeInlined[element] = false; | |
| 957 } | |
| 958 } | |
| 959 | |
| 960 void validateInterceptorImplementsAllObjectMethods( | 952 void validateInterceptorImplementsAllObjectMethods( |
| 961 ClassElement interceptorClass) { | 953 ClassElement interceptorClass) { |
| 962 if (interceptorClass == null) return; | 954 if (interceptorClass == null) return; |
| 963 compiler.objectClass.forEachMember((_, Element member) { | 955 compiler.objectClass.forEachMember((_, Element member) { |
| 964 if (member.isGenerativeConstructor()) return; | 956 if (member.isGenerativeConstructor()) return; |
| 965 Element interceptorMember = interceptorClass.lookupMember(member.name); | 957 Element interceptorMember = interceptorClass.lookupMember(member.name); |
| 966 // Interceptors must override all Object methods due to calling convention | 958 // Interceptors must override all Object methods due to calling convention |
| 967 // differences. | 959 // differences. |
| 968 assert(interceptorMember.getEnclosingClass() != compiler.objectClass); | 960 assert(interceptorMember.getEnclosingClass() != compiler.objectClass); |
| 969 }); | 961 }); |
| (...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1779 ClassElement get constListImplementation => jsArrayClass; | 1771 ClassElement get constListImplementation => jsArrayClass; |
| 1780 ClassElement get fixedListImplementation => jsFixedArrayClass; | 1772 ClassElement get fixedListImplementation => jsFixedArrayClass; |
| 1781 ClassElement get growableListImplementation => jsExtendableArrayClass; | 1773 ClassElement get growableListImplementation => jsExtendableArrayClass; |
| 1782 ClassElement get mapImplementation => mapLiteralClass; | 1774 ClassElement get mapImplementation => mapLiteralClass; |
| 1783 ClassElement get constMapImplementation => constMapLiteralClass; | 1775 ClassElement get constMapImplementation => constMapLiteralClass; |
| 1784 ClassElement get functionImplementation => jsFunctionClass; | 1776 ClassElement get functionImplementation => jsFunctionClass; |
| 1785 ClassElement get typeImplementation => typeLiteralClass; | 1777 ClassElement get typeImplementation => typeLiteralClass; |
| 1786 ClassElement get boolImplementation => jsBoolClass; | 1778 ClassElement get boolImplementation => jsBoolClass; |
| 1787 ClassElement get nullImplementation => jsNullClass; | 1779 ClassElement get nullImplementation => jsNullClass; |
| 1788 } | 1780 } |
| OLD | NEW |