| 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 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 } | 856 } |
| 857 return result; | 857 return result; |
| 858 }); | 858 }); |
| 859 } | 859 } |
| 860 | 860 |
| 861 Set<ClassElement> nativeSubclassesOfMixin(ClassElement mixin) { | 861 Set<ClassElement> nativeSubclassesOfMixin(ClassElement mixin) { |
| 862 Set<MixinApplicationElement> uses = compiler.world.mixinUses[mixin]; | 862 Set<MixinApplicationElement> uses = compiler.world.mixinUses[mixin]; |
| 863 if (uses == null) return null; | 863 if (uses == null) return null; |
| 864 Set<ClassElement> result = null; | 864 Set<ClassElement> result = null; |
| 865 for (MixinApplicationElement use in uses) { | 865 for (MixinApplicationElement use in uses) { |
| 866 Iterable<ClassElement> subclasses = compiler.world.subclasses[use]; | 866 Iterable<ClassElement> subclasses = compiler.world.subclassesOf(use); |
| 867 if (subclasses != null) { | 867 if (subclasses != null) { |
| 868 for (ClassElement subclass in subclasses) { | 868 for (ClassElement subclass in subclasses) { |
| 869 if (subclass.isNative()) { | 869 if (subclass.isNative()) { |
| 870 if (result == null) result = new Set<ClassElement>(); | 870 if (result == null) result = new Set<ClassElement>(); |
| 871 result.add(subclass); | 871 result.add(subclass); |
| 872 } | 872 } |
| 873 } | 873 } |
| 874 } | 874 } |
| 875 } | 875 } |
| 876 return result; | 876 return result; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 Set<Element> set = interceptedElements.putIfAbsent( | 1009 Set<Element> set = interceptedElements.putIfAbsent( |
| 1010 member.name, () => new Set<Element>()); | 1010 member.name, () => new Set<Element>()); |
| 1011 set.add(member); | 1011 set.add(member); |
| 1012 if (classElement == jsInterceptorClass) return; | 1012 if (classElement == jsInterceptorClass) return; |
| 1013 if (!classElement.isNative()) { | 1013 if (!classElement.isNative()) { |
| 1014 MixinApplicationElement mixinApplication = classElement; | 1014 MixinApplicationElement mixinApplication = classElement; |
| 1015 assert(member.getEnclosingClass() == mixinApplication.mixin); | 1015 assert(member.getEnclosingClass() == mixinApplication.mixin); |
| 1016 classesMixedIntoNativeClasses.add(mixinApplication.mixin); | 1016 classesMixedIntoNativeClasses.add(mixinApplication.mixin); |
| 1017 } | 1017 } |
| 1018 }, | 1018 }, |
| 1019 includeSuperMembers: true); | 1019 includeSuperAndInjectedMembers: true); |
| 1020 } | 1020 } |
| 1021 } | 1021 } |
| 1022 | 1022 |
| 1023 void addInterceptors(ClassElement cls, | 1023 void addInterceptors(ClassElement cls, |
| 1024 Enqueuer enqueuer, | 1024 Enqueuer enqueuer, |
| 1025 TreeElements elements) { | 1025 TreeElements elements) { |
| 1026 if (enqueuer.isResolutionQueue) { | 1026 if (enqueuer.isResolutionQueue) { |
| 1027 cls.ensureResolved(compiler); | 1027 cls.ensureResolved(compiler); |
| 1028 cls.forEachMember((ClassElement classElement, Element member) { | 1028 cls.forEachMember((ClassElement classElement, Element member) { |
| 1029 // All methods on [Object] are shadowed by [Interceptor]. | 1029 // All methods on [Object] are shadowed by [Interceptor]. |
| 1030 if (classElement == compiler.objectClass) return; | 1030 if (classElement == compiler.objectClass) return; |
| 1031 Set<Element> set = interceptedElements.putIfAbsent( | 1031 Set<Element> set = interceptedElements.putIfAbsent( |
| 1032 member.name, () => new Set<Element>()); | 1032 member.name, () => new Set<Element>()); |
| 1033 set.add(member); | 1033 set.add(member); |
| 1034 }, | 1034 }, |
| 1035 includeSuperMembers: true); | 1035 includeSuperAndInjectedMembers: true); |
| 1036 } | 1036 } |
| 1037 enqueuer.registerInstantiatedClass(cls, elements); | 1037 enqueuer.registerInstantiatedClass(cls, elements); |
| 1038 } | 1038 } |
| 1039 | 1039 |
| 1040 void registerSpecializedGetInterceptor(Set<ClassElement> classes) { | 1040 void registerSpecializedGetInterceptor(Set<ClassElement> classes) { |
| 1041 String name = namer.getInterceptorName(getInterceptorMethod, classes); | 1041 String name = namer.getInterceptorName(getInterceptorMethod, classes); |
| 1042 if (classes.contains(jsInterceptorClass)) { | 1042 if (classes.contains(jsInterceptorClass)) { |
| 1043 // We can't use a specialized [getInterceptorMethod], so we make | 1043 // We can't use a specialized [getInterceptorMethod], so we make |
| 1044 // sure we emit the one with all checks. | 1044 // sure we emit the one with all checks. |
| 1045 specializedGetInterceptors[name] = interceptedClasses; | 1045 specializedGetInterceptors[name] = interceptedClasses; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1133 } else if (cls.isNative()) { | 1133 } else if (cls.isNative()) { |
| 1134 addInterceptorsForNativeClassMembers(cls, enqueuer); | 1134 addInterceptorsForNativeClassMembers(cls, enqueuer); |
| 1135 } | 1135 } |
| 1136 | 1136 |
| 1137 if (compiler.enableTypeAssertions) { | 1137 if (compiler.enableTypeAssertions) { |
| 1138 // We need to register is checks for assignments to fields. | 1138 // We need to register is checks for assignments to fields. |
| 1139 cls.forEachMember((Element enclosing, Element member) { | 1139 cls.forEachMember((Element enclosing, Element member) { |
| 1140 if (!member.isInstanceMember() || !member.isField()) return; | 1140 if (!member.isInstanceMember() || !member.isField()) return; |
| 1141 DartType type = member.computeType(compiler); | 1141 DartType type = member.computeType(compiler); |
| 1142 enqueuer.registerIsCheck(type, elements); | 1142 enqueuer.registerIsCheck(type, elements); |
| 1143 }, includeSuperMembers: true); | 1143 }, includeSuperAndInjectedMembers: true); |
| 1144 } | 1144 } |
| 1145 } | 1145 } |
| 1146 | 1146 |
| 1147 void registerUseInterceptor(Enqueuer enqueuer) { | 1147 void registerUseInterceptor(Enqueuer enqueuer) { |
| 1148 assert(!enqueuer.isResolutionQueue); | 1148 assert(!enqueuer.isResolutionQueue); |
| 1149 if (!enqueuer.nativeEnqueuer.hasNativeClasses()) return; | 1149 if (!enqueuer.nativeEnqueuer.hasNativeClasses()) return; |
| 1150 enqueuer.registerStaticUse(getNativeInterceptorMethod); | 1150 enqueuer.registerStaticUse(getNativeInterceptorMethod); |
| 1151 enqueuer.registerStaticUse(defineNativeMethodsFinishMethod); | 1151 enqueuer.registerStaticUse(defineNativeMethodsFinishMethod); |
| 1152 enqueuer.registerStaticUse(initializeDispatchPropertyMethod); | 1152 enqueuer.registerStaticUse(initializeDispatchPropertyMethod); |
| 1153 TreeElements elements = compiler.globalDependencies; | 1153 TreeElements elements = compiler.globalDependencies; |
| (...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1862 ClassElement get listImplementation => jsArrayClass; | 1862 ClassElement get listImplementation => jsArrayClass; |
| 1863 ClassElement get constListImplementation => jsArrayClass; | 1863 ClassElement get constListImplementation => jsArrayClass; |
| 1864 ClassElement get fixedListImplementation => jsFixedArrayClass; | 1864 ClassElement get fixedListImplementation => jsFixedArrayClass; |
| 1865 ClassElement get growableListImplementation => jsExtendableArrayClass; | 1865 ClassElement get growableListImplementation => jsExtendableArrayClass; |
| 1866 ClassElement get mapImplementation => mapLiteralClass; | 1866 ClassElement get mapImplementation => mapLiteralClass; |
| 1867 ClassElement get constMapImplementation => constMapLiteralClass; | 1867 ClassElement get constMapImplementation => constMapLiteralClass; |
| 1868 ClassElement get typeImplementation => typeLiteralClass; | 1868 ClassElement get typeImplementation => typeLiteralClass; |
| 1869 ClassElement get boolImplementation => jsBoolClass; | 1869 ClassElement get boolImplementation => jsBoolClass; |
| 1870 ClassElement get nullImplementation => jsNullClass; | 1870 ClassElement get nullImplementation => jsNullClass; |
| 1871 } | 1871 } |
| OLD | NEW |