| 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 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 885 mapLiteralClass = | 885 mapLiteralClass = |
| 886 compiler.coreLibrary.find(const SourceString('LinkedHashMap')); | 886 compiler.coreLibrary.find(const SourceString('LinkedHashMap')); |
| 887 constMapLiteralClass = | 887 constMapLiteralClass = |
| 888 compiler.findHelper(const SourceString('ConstantMap')); | 888 compiler.findHelper(const SourceString('ConstantMap')); |
| 889 | 889 |
| 890 specialOperatorEqClasses | 890 specialOperatorEqClasses |
| 891 ..add(jsNullClass) | 891 ..add(jsNullClass) |
| 892 ..add(jsNumberClass); | 892 ..add(jsNumberClass); |
| 893 } | 893 } |
| 894 | 894 |
| 895 void addInterceptors(ClassElement cls, Enqueuer enqueuer) { | 895 void addInterceptors(ClassElement cls, |
| 896 Enqueuer enqueuer, |
| 897 TreeElements elements) { |
| 896 if (enqueuer.isResolutionQueue) { | 898 if (enqueuer.isResolutionQueue) { |
| 897 cls.ensureResolved(compiler); | 899 cls.ensureResolved(compiler); |
| 898 cls.forEachMember((ClassElement classElement, Element member) { | 900 cls.forEachMember((ClassElement classElement, Element member) { |
| 899 Set<Element> set = interceptedElements.putIfAbsent( | 901 Set<Element> set = interceptedElements.putIfAbsent( |
| 900 member.name, () => new Set<Element>()); | 902 member.name, () => new Set<Element>()); |
| 901 set.add(member); | 903 set.add(member); |
| 902 }, | 904 }, |
| 903 includeSuperMembers: true); | 905 includeSuperMembers: true); |
| 904 } | 906 } |
| 905 enqueuer.registerInstantiatedClass(cls); | 907 enqueuer.registerInstantiatedClass(cls, elements); |
| 906 } | 908 } |
| 907 | 909 |
| 908 void registerSpecializedGetInterceptor(Set<ClassElement> classes) { | 910 void registerSpecializedGetInterceptor(Set<ClassElement> classes) { |
| 909 String name = namer.getInterceptorName(getInterceptorMethod, classes); | 911 String name = namer.getInterceptorName(getInterceptorMethod, classes); |
| 910 if (classes.contains(compiler.objectClass)) { | 912 if (classes.contains(compiler.objectClass)) { |
| 911 // We can't use a specialized [getInterceptorMethod], so we make | 913 // We can't use a specialized [getInterceptorMethod], so we make |
| 912 // sure we emit the one with all checks. | 914 // sure we emit the one with all checks. |
| 913 specializedGetInterceptors[name] = interceptedClasses; | 915 specializedGetInterceptors[name] = interceptedClasses; |
| 914 } else { | 916 } else { |
| 915 specializedGetInterceptors[name] = classes; | 917 specializedGetInterceptors[name] = classes; |
| 916 } | 918 } |
| 917 } | 919 } |
| 918 | 920 |
| 919 void initializeNoSuchMethod() { | 921 void initializeNoSuchMethod() { |
| 920 // In case the emitter generates noSuchMethod calls, we need to | 922 // In case the emitter generates noSuchMethod calls, we need to |
| 921 // make sure all [noSuchMethod] methods know they might take a | 923 // make sure all [noSuchMethod] methods know they might take a |
| 922 // [JsInvocationMirror] as parameter. | 924 // [JsInvocationMirror] as parameter. |
| 923 HTypeList types = new HTypeList(1); | 925 HTypeList types = new HTypeList(1); |
| 924 types[0] = new HType.nonNullExact( | 926 types[0] = new HType.nonNullExact( |
| 925 compiler.jsInvocationMirrorClass.computeType(compiler), | 927 compiler.jsInvocationMirrorClass.computeType(compiler), |
| 926 compiler); | 928 compiler); |
| 927 argumentTypes.registerDynamicInvocation(types, new Selector.noSuchMethod()); | 929 argumentTypes.registerDynamicInvocation(types, new Selector.noSuchMethod()); |
| 928 } | 930 } |
| 929 | 931 |
| 930 void registerInstantiatedClass(ClassElement cls, Enqueuer enqueuer) { | 932 void registerInstantiatedClass(ClassElement cls, |
| 933 Enqueuer enqueuer, |
| 934 TreeElements elements) { |
| 931 if (!seenAnyClass) { | 935 if (!seenAnyClass) { |
| 932 initializeNoSuchMethod(); | 936 initializeNoSuchMethod(); |
| 933 seenAnyClass = true; | 937 seenAnyClass = true; |
| 934 } | 938 } |
| 935 | 939 |
| 936 // Register any helper that will be needed by the backend. | 940 // Register any helper that will be needed by the backend. |
| 937 if (enqueuer.isResolutionQueue) { | 941 if (enqueuer.isResolutionQueue) { |
| 938 if (cls == compiler.intClass | 942 if (cls == compiler.intClass |
| 939 || cls == compiler.doubleClass | 943 || cls == compiler.doubleClass |
| 940 || cls == compiler.numClass) { | 944 || cls == compiler.numClass) { |
| 941 // The backend will try to optimize number operations and use the | 945 // The backend will try to optimize number operations and use the |
| 942 // `iae` helper directly. | 946 // `iae` helper directly. |
| 943 enqueuer.registerStaticUse( | 947 enqueuer.registerStaticUse( |
| 944 compiler.findHelper(const SourceString('iae'))); | 948 compiler.findHelper(const SourceString('iae'))); |
| 945 } else if (cls == compiler.listClass | 949 } else if (cls == compiler.listClass |
| 946 || cls == compiler.stringClass) { | 950 || cls == compiler.stringClass) { |
| 947 // The backend will try to optimize array and string access and use the | 951 // The backend will try to optimize array and string access and use the |
| 948 // `ioore` and `iae` helpers directly. | 952 // `ioore` and `iae` helpers directly. |
| 949 enqueuer.registerStaticUse( | 953 enqueuer.registerStaticUse( |
| 950 compiler.findHelper(const SourceString('ioore'))); | 954 compiler.findHelper(const SourceString('ioore'))); |
| 951 enqueuer.registerStaticUse( | 955 enqueuer.registerStaticUse( |
| 952 compiler.findHelper(const SourceString('iae'))); | 956 compiler.findHelper(const SourceString('iae'))); |
| 953 } else if (cls == compiler.functionClass) { | 957 } else if (cls == compiler.functionClass) { |
| 954 enqueuer.registerInstantiatedClass(compiler.closureClass); | 958 enqueuer.registerInstantiatedClass(compiler.closureClass, elements); |
| 955 } else if (cls == compiler.mapClass) { | 959 } else if (cls == compiler.mapClass) { |
| 956 // The backend will use a literal list to initialize the entries | 960 // The backend will use a literal list to initialize the entries |
| 957 // of the map. | 961 // of the map. |
| 958 enqueuer.registerInstantiatedClass(compiler.listClass); | 962 enqueuer.registerInstantiatedClass(compiler.listClass, elements); |
| 959 enqueuer.registerInstantiatedClass(mapLiteralClass); | 963 enqueuer.registerInstantiatedClass(mapLiteralClass, elements); |
| 960 enqueueInResolution(getMapMaker()); | 964 enqueueInResolution(getMapMaker(), elements); |
| 961 } | 965 } |
| 962 } | 966 } |
| 963 ClassElement result = null; | 967 ClassElement result = null; |
| 964 if (cls == compiler.stringClass) { | 968 if (cls == compiler.stringClass) { |
| 965 addInterceptors(jsStringClass, enqueuer); | 969 addInterceptors(jsStringClass, enqueuer, elements); |
| 966 } else if (cls == compiler.listClass) { | 970 } else if (cls == compiler.listClass) { |
| 967 addInterceptors(jsArrayClass, enqueuer); | 971 addInterceptors(jsArrayClass, enqueuer, elements); |
| 968 enqueuer.registerInstantiatedClass(jsFixedArrayClass); | 972 enqueuer.registerInstantiatedClass(jsFixedArrayClass, elements); |
| 969 enqueuer.registerInstantiatedClass(jsExtendableArrayClass); | 973 enqueuer.registerInstantiatedClass(jsExtendableArrayClass, elements); |
| 970 } else if (cls == compiler.intClass) { | 974 } else if (cls == compiler.intClass) { |
| 971 addInterceptors(jsIntClass, enqueuer); | 975 addInterceptors(jsIntClass, enqueuer, elements); |
| 972 addInterceptors(jsNumberClass, enqueuer); | 976 addInterceptors(jsNumberClass, enqueuer, elements); |
| 973 } else if (cls == compiler.doubleClass) { | 977 } else if (cls == compiler.doubleClass) { |
| 974 addInterceptors(jsDoubleClass, enqueuer); | 978 addInterceptors(jsDoubleClass, enqueuer, elements); |
| 975 addInterceptors(jsNumberClass, enqueuer); | 979 addInterceptors(jsNumberClass, enqueuer, elements); |
| 976 } else if (cls == compiler.functionClass) { | 980 } else if (cls == compiler.functionClass) { |
| 977 addInterceptors(jsFunctionClass, enqueuer); | 981 addInterceptors(jsFunctionClass, enqueuer, elements); |
| 978 } else if (cls == compiler.boolClass) { | 982 } else if (cls == compiler.boolClass) { |
| 979 addInterceptors(jsBoolClass, enqueuer); | 983 addInterceptors(jsBoolClass, enqueuer, elements); |
| 980 } else if (cls == compiler.nullClass) { | 984 } else if (cls == compiler.nullClass) { |
| 981 addInterceptors(jsNullClass, enqueuer); | 985 addInterceptors(jsNullClass, enqueuer, elements); |
| 982 } else if (cls == compiler.numClass) { | 986 } else if (cls == compiler.numClass) { |
| 983 addInterceptors(jsIntClass, enqueuer); | 987 addInterceptors(jsIntClass, enqueuer, elements); |
| 984 addInterceptors(jsDoubleClass, enqueuer); | 988 addInterceptors(jsDoubleClass, enqueuer, elements); |
| 985 addInterceptors(jsNumberClass, enqueuer); | 989 addInterceptors(jsNumberClass, enqueuer, elements); |
| 986 } else if (cls == compiler.mapClass) { | 990 } else if (cls == compiler.mapClass) { |
| 987 } | 991 } |
| 988 | 992 |
| 989 if (compiler.enableTypeAssertions) { | 993 if (compiler.enableTypeAssertions) { |
| 990 // We need to register is checks for assignments to fields. | 994 // We need to register is checks for assignments to fields. |
| 991 cls.forEachLocalMember((Element member) { | 995 cls.forEachLocalMember((Element member) { |
| 992 if (!member.isInstanceMember() || !member.isField()) return; | 996 if (!member.isInstanceMember() || !member.isField()) return; |
| 993 DartType type = member.computeType(compiler); | 997 DartType type = member.computeType(compiler); |
| 994 enqueuer.registerIsCheck(type); | 998 enqueuer.registerIsCheck(type, elements); |
| 995 }); | 999 }); |
| 996 } | 1000 } |
| 997 } | 1001 } |
| 998 | 1002 |
| 999 JavaScriptItemCompilationContext createItemCompilationContext() { | 1003 JavaScriptItemCompilationContext createItemCompilationContext() { |
| 1000 return new JavaScriptItemCompilationContext(); | 1004 return new JavaScriptItemCompilationContext(); |
| 1001 } | 1005 } |
| 1002 | 1006 |
| 1003 void addBackendRtiDependencies(World world) { | 1007 void addBackendRtiDependencies(World world) { |
| 1004 if (jsArrayClass != null) { | 1008 if (jsArrayClass != null) { |
| 1005 world.registerRtiDependency(jsArrayClass, compiler.listClass); | 1009 world.registerRtiDependency(jsArrayClass, compiler.listClass); |
| 1006 } | 1010 } |
| 1007 } | 1011 } |
| 1008 | 1012 |
| 1009 void enqueueHelpers(ResolutionEnqueuer world) { | 1013 void enqueueHelpers(ResolutionEnqueuer world, TreeElements elements) { |
| 1010 jsIndexingBehaviorInterface = | 1014 jsIndexingBehaviorInterface = |
| 1011 compiler.findHelper(const SourceString('JavaScriptIndexingBehavior')); | 1015 compiler.findHelper(const SourceString('JavaScriptIndexingBehavior')); |
| 1012 if (jsIndexingBehaviorInterface != null) { | 1016 if (jsIndexingBehaviorInterface != null) { |
| 1013 world.registerIsCheck(jsIndexingBehaviorInterface.computeType(compiler)); | 1017 world.registerIsCheck(jsIndexingBehaviorInterface.computeType(compiler), |
| 1018 elements); |
| 1014 } | 1019 } |
| 1015 | 1020 |
| 1016 if (compiler.enableTypeAssertions) { | 1021 if (compiler.enableTypeAssertions) { |
| 1017 // Unconditionally register the helper that checks if the | 1022 // Unconditionally register the helper that checks if the |
| 1018 // expression in an if/while/for is a boolean. | 1023 // expression in an if/while/for is a boolean. |
| 1019 // TODO(ngeoffray): Should we have the resolver register those instead? | 1024 // TODO(ngeoffray): Should we have the resolver register those instead? |
| 1020 Element e = | 1025 Element e = |
| 1021 compiler.findHelper(const SourceString('boolConversionCheck')); | 1026 compiler.findHelper(const SourceString('boolConversionCheck')); |
| 1022 if (e != null) world.addToWorkList(e); | 1027 if (e != null) world.addToWorkList(e); |
| 1023 } | 1028 } |
| 1024 } | 1029 } |
| 1025 | 1030 |
| 1026 void registerStringInterpolation() { | 1031 void registerStringInterpolation(TreeElements elements) { |
| 1027 enqueueInResolution(getStringInterpolationHelper()); | 1032 enqueueInResolution(getStringInterpolationHelper(), elements); |
| 1028 } | 1033 } |
| 1029 | 1034 |
| 1030 void registerCatchStatement() { | 1035 void registerCatchStatement(TreeElements elements) { |
| 1031 enqueueInResolution(getExceptionUnwrapper()); | 1036 enqueueInResolution(getExceptionUnwrapper(), elements); |
| 1032 } | 1037 } |
| 1033 | 1038 |
| 1034 void registerThrow() { | 1039 void registerThrow(TreeElements elements) { |
| 1035 enqueueInResolution(getThrowHelper()); | 1040 enqueueInResolution(getThrowHelper(), elements); |
| 1036 } | 1041 } |
| 1037 | 1042 |
| 1038 void registerLazyField() { | 1043 void registerLazyField(TreeElements elements) { |
| 1039 enqueueInResolution(getCyclicThrowHelper()); | 1044 enqueueInResolution(getCyclicThrowHelper(), elements); |
| 1040 } | 1045 } |
| 1041 | 1046 |
| 1042 void registerTypeLiteral() { | 1047 void registerTypeLiteral(TreeElements elements) { |
| 1043 enqueueInResolution(getCreateRuntimeType()); | 1048 enqueueInResolution(getCreateRuntimeType(), elements); |
| 1044 } | 1049 } |
| 1045 | 1050 |
| 1046 void registerStackTraceInCatch() { | 1051 void registerStackTraceInCatch(TreeElements elements) { |
| 1047 enqueueInResolution(getTraceFromException()); | 1052 enqueueInResolution(getTraceFromException(), elements); |
| 1048 } | 1053 } |
| 1049 | 1054 |
| 1050 void registerSetRuntimeType() { | 1055 void registerSetRuntimeType(TreeElements elements) { |
| 1051 enqueueInResolution(getSetRuntimeTypeInfo()); | 1056 enqueueInResolution(getSetRuntimeTypeInfo(), elements); |
| 1052 } | 1057 } |
| 1053 | 1058 |
| 1054 void registerGetRuntimeTypeArgument() { | 1059 void registerGetRuntimeTypeArgument(TreeElements elements) { |
| 1055 enqueueInResolution(getGetRuntimeTypeArgument()); | 1060 enqueueInResolution(getGetRuntimeTypeArgument(), elements); |
| 1056 } | 1061 } |
| 1057 | 1062 |
| 1058 void registerRuntimeType() { | 1063 void registerRuntimeType(TreeElements elements) { |
| 1059 enqueueInResolution(getSetRuntimeTypeInfo()); | 1064 enqueueInResolution(getSetRuntimeTypeInfo(), elements); |
| 1060 enqueueInResolution(getGetRuntimeTypeInfo()); | 1065 enqueueInResolution(getGetRuntimeTypeInfo(), elements); |
| 1061 enqueueInResolution(getGetRuntimeTypeArgument()); | 1066 enqueueInResolution(getGetRuntimeTypeArgument(), elements); |
| 1062 compiler.enqueuer.resolution.registerInstantiatedClass(compiler.listClass); | 1067 compiler.enqueuer.resolution.registerInstantiatedClass( |
| 1068 compiler.listClass, elements); |
| 1063 } | 1069 } |
| 1064 | 1070 |
| 1065 void registerIsCheck(DartType type, Enqueuer world) { | 1071 void registerIsCheck(DartType type, Enqueuer world, TreeElements elements) { |
| 1066 world.registerInstantiatedClass(compiler.boolClass); | 1072 world.registerInstantiatedClass(compiler.boolClass, elements); |
| 1067 bool isTypeVariable = type.kind == TypeKind.TYPE_VARIABLE; | 1073 bool isTypeVariable = type.kind == TypeKind.TYPE_VARIABLE; |
| 1068 if (!type.isRaw || isTypeVariable) { | 1074 if (!type.isRaw || isTypeVariable) { |
| 1069 enqueueInResolution(getSetRuntimeTypeInfo()); | 1075 enqueueInResolution(getSetRuntimeTypeInfo(), elements); |
| 1070 enqueueInResolution(getGetRuntimeTypeInfo()); | 1076 enqueueInResolution(getGetRuntimeTypeInfo(), elements); |
| 1071 enqueueInResolution(getGetRuntimeTypeArgument()); | 1077 enqueueInResolution(getGetRuntimeTypeArgument(), elements); |
| 1072 enqueueInResolution(getCheckArguments()); | 1078 enqueueInResolution(getCheckArguments(), elements); |
| 1073 if (isTypeVariable) enqueueInResolution(getGetObjectIsSubtype()); | 1079 if (isTypeVariable) { |
| 1074 world.registerInstantiatedClass(compiler.listClass); | 1080 enqueueInResolution(getGetObjectIsSubtype(), elements); |
| 1081 } |
| 1082 world.registerInstantiatedClass(compiler.listClass, elements); |
| 1075 } | 1083 } |
| 1076 // [registerIsCheck] is also called for checked mode checks, so we | 1084 // [registerIsCheck] is also called for checked mode checks, so we |
| 1077 // need to register checked mode helpers. | 1085 // need to register checked mode helpers. |
| 1078 if (compiler.enableTypeAssertions) { | 1086 if (compiler.enableTypeAssertions) { |
| 1079 Element e = getCheckedModeHelper(type, typeCast: false); | 1087 Element e = getCheckedModeHelper(type, typeCast: false); |
| 1080 if (e != null) world.addToWorkList(e); | 1088 if (e != null) world.addToWorkList(e); |
| 1081 // We also need the native variant of the check (for DOM types). | 1089 // We also need the native variant of the check (for DOM types). |
| 1082 e = getNativeCheckedModeHelper(type, typeCast: false); | 1090 e = getNativeCheckedModeHelper(type, typeCast: false); |
| 1083 if (e != null) world.addToWorkList(e); | 1091 if (e != null) world.addToWorkList(e); |
| 1084 } | 1092 } |
| 1085 if (type.element.isNative()) { | 1093 if (type.element.isNative()) { |
| 1086 // We will neeed to add the "$is" and "$as" properties on the | 1094 // We will neeed to add the "$is" and "$as" properties on the |
| 1087 // JavaScript object prototype, so we make sure | 1095 // JavaScript object prototype, so we make sure |
| 1088 // [:defineProperty:] is compiled. | 1096 // [:defineProperty:] is compiled. |
| 1089 world.addToWorkList( | 1097 world.addToWorkList( |
| 1090 compiler.findHelper(const SourceString('defineProperty'))); | 1098 compiler.findHelper(const SourceString('defineProperty'))); |
| 1091 } | 1099 } |
| 1092 } | 1100 } |
| 1093 | 1101 |
| 1094 void registerAsCheck(DartType type) { | 1102 void registerAsCheck(DartType type, TreeElements elements) { |
| 1095 Element e = getCheckedModeHelper(type, typeCast: true); | 1103 Element e = getCheckedModeHelper(type, typeCast: true); |
| 1096 enqueueInResolution(e); | 1104 enqueueInResolution(e, elements); |
| 1097 // We also need the native variant of the check (for DOM types). | 1105 // We also need the native variant of the check (for DOM types). |
| 1098 e = getNativeCheckedModeHelper(type, typeCast: true); | 1106 e = getNativeCheckedModeHelper(type, typeCast: true); |
| 1099 enqueueInResolution(e); | 1107 enqueueInResolution(e, elements); |
| 1100 } | 1108 } |
| 1101 | 1109 |
| 1102 void registerThrowNoSuchMethod() { | 1110 void registerThrowNoSuchMethod(TreeElements elements) { |
| 1103 enqueueInResolution(getThrowNoSuchMethod()); | 1111 enqueueInResolution(getThrowNoSuchMethod(), elements); |
| 1104 } | 1112 } |
| 1105 | 1113 |
| 1106 void registerThrowRuntimeError() { | 1114 void registerThrowRuntimeError(TreeElements elements) { |
| 1107 enqueueInResolution(getThrowRuntimeError()); | 1115 enqueueInResolution(getThrowRuntimeError(), elements); |
| 1108 } | 1116 } |
| 1109 | 1117 |
| 1110 void registerAbstractClassInstantiation() { | 1118 void registerAbstractClassInstantiation(TreeElements elements) { |
| 1111 enqueueInResolution(getThrowAbstractClassInstantiationError()); | 1119 enqueueInResolution(getThrowAbstractClassInstantiationError(), elements); |
| 1112 } | 1120 } |
| 1113 | 1121 |
| 1114 void registerFallThroughError() { | 1122 void registerFallThroughError(TreeElements elements) { |
| 1115 enqueueInResolution(getFallThroughError()); | 1123 enqueueInResolution(getFallThroughError(), elements); |
| 1116 } | 1124 } |
| 1117 | 1125 |
| 1118 void registerSuperNoSuchMethod() { | 1126 void registerSuperNoSuchMethod(TreeElements elements) { |
| 1119 enqueueInResolution(getCreateInvocationMirror()); | 1127 enqueueInResolution(getCreateInvocationMirror(), elements); |
| 1120 enqueueInResolution( | 1128 enqueueInResolution( |
| 1121 compiler.objectClass.lookupLocalMember(Compiler.NO_SUCH_METHOD)); | 1129 compiler.objectClass.lookupLocalMember(Compiler.NO_SUCH_METHOD), |
| 1122 compiler.enqueuer.resolution.registerInstantiatedClass(compiler.listClass); | 1130 elements); |
| 1131 compiler.enqueuer.resolution.registerInstantiatedClass( |
| 1132 compiler.listClass, elements); |
| 1123 } | 1133 } |
| 1124 | 1134 |
| 1125 void enqueueInResolution(Element e) { | 1135 void enqueueInResolution(Element e, TreeElements elements) { |
| 1126 if (e != null) compiler.enqueuer.resolution.addToWorkList(e); | 1136 if (e == null) return; |
| 1137 ResolutionEnqueuer enqueuer = compiler.enqueuer.resolution; |
| 1138 enqueuer.addToWorkList(e); |
| 1139 elements.registerDependency(e); |
| 1127 } | 1140 } |
| 1128 | 1141 |
| 1129 void registerConstantMap() { | 1142 void registerConstantMap(TreeElements elements) { |
| 1130 Element e = compiler.findHelper(const SourceString('ConstantMap')); | 1143 Element e = compiler.findHelper(const SourceString('ConstantMap')); |
| 1131 if (e != null) compiler.enqueuer.resolution.registerInstantiatedClass(e); | 1144 if (e != null) { |
| 1145 compiler.enqueuer.resolution.registerInstantiatedClass(e, elements); |
| 1146 } |
| 1132 e = compiler.findHelper(const SourceString('ConstantProtoMap')); | 1147 e = compiler.findHelper(const SourceString('ConstantProtoMap')); |
| 1133 if (e != null) compiler.enqueuer.resolution.registerInstantiatedClass(e); | 1148 if (e != null) { |
| 1149 compiler.enqueuer.resolution.registerInstantiatedClass(e, elements); |
| 1150 } |
| 1134 } | 1151 } |
| 1135 | 1152 |
| 1136 void codegen(CodegenWorkItem work) { | 1153 void codegen(CodegenWorkItem work) { |
| 1137 Element element = work.element; | 1154 Element element = work.element; |
| 1138 if (element.kind.category == ElementCategory.VARIABLE) { | 1155 if (element.kind.category == ElementCategory.VARIABLE) { |
| 1139 Constant initialValue = compiler.constantHandler.compileWorkItem(work); | 1156 Constant initialValue = compiler.constantHandler.compileWorkItem(work); |
| 1140 if (initialValue != null) { | 1157 if (initialValue != null) { |
| 1141 return; | 1158 return; |
| 1142 } else { | 1159 } else { |
| 1143 // If the constant-handler was not able to produce a result we have to | 1160 // If the constant-handler was not able to produce a result we have to |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1575 ClassElement get constListImplementation => jsArrayClass; | 1592 ClassElement get constListImplementation => jsArrayClass; |
| 1576 ClassElement get fixedListImplementation => jsFixedArrayClass; | 1593 ClassElement get fixedListImplementation => jsFixedArrayClass; |
| 1577 ClassElement get growableListImplementation => jsExtendableArrayClass; | 1594 ClassElement get growableListImplementation => jsExtendableArrayClass; |
| 1578 ClassElement get mapImplementation => mapLiteralClass; | 1595 ClassElement get mapImplementation => mapLiteralClass; |
| 1579 ClassElement get constMapImplementation => constMapLiteralClass; | 1596 ClassElement get constMapImplementation => constMapLiteralClass; |
| 1580 ClassElement get functionImplementation => jsFunctionClass; | 1597 ClassElement get functionImplementation => jsFunctionClass; |
| 1581 ClassElement get typeImplementation => typeLiteralClass; | 1598 ClassElement get typeImplementation => typeLiteralClass; |
| 1582 ClassElement get boolImplementation => jsBoolClass; | 1599 ClassElement get boolImplementation => jsBoolClass; |
| 1583 ClassElement get nullImplementation => jsNullClass; | 1600 ClassElement get nullImplementation => jsNullClass; |
| 1584 } | 1601 } |
| OLD | NEW |