| 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 library js_backend.backend; | 5 library js_backend.backend; |
| 6 | 6 |
| 7 import 'dart:async' show Future; | 7 import 'dart:async' show Future; |
| 8 | 8 |
| 9 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; | 9 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; |
| 10 | 10 |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 this.sourceInformationStrategy = generateSourceMap | 487 this.sourceInformationStrategy = generateSourceMap |
| 488 ? (useNewSourceInfo | 488 ? (useNewSourceInfo |
| 489 ? new PositionSourceInformationStrategy() | 489 ? new PositionSourceInformationStrategy() |
| 490 : const StartEndSourceInformationStrategy()) | 490 : const StartEndSourceInformationStrategy()) |
| 491 : const JavaScriptSourceInformationStrategy(), | 491 : const JavaScriptSourceInformationStrategy(), |
| 492 impacts = new BackendImpacts(compiler), | 492 impacts = new BackendImpacts(compiler), |
| 493 frontend = new JSFrontendAccess(compiler), | 493 frontend = new JSFrontendAccess(compiler), |
| 494 mirrorsData = new MirrorsData(compiler), | 494 mirrorsData = new MirrorsData(compiler), |
| 495 this.compiler = compiler { | 495 this.compiler = compiler { |
| 496 helpers = new BackendHelpers(compiler.elementEnvironment, commonElements); | 496 helpers = new BackendHelpers(compiler.elementEnvironment, commonElements); |
| 497 _backendUsage = new BackendUsage(commonElements, helpers); | 497 _backendUsage = new BackendUsage( |
| 498 commonElements, helpers, resolution, compiler.globalDependencies); |
| 498 _checkedModeHelpers = new CheckedModeHelpers(commonElements, helpers); | 499 _checkedModeHelpers = new CheckedModeHelpers(commonElements, helpers); |
| 499 emitter = | 500 emitter = |
| 500 new CodeEmitterTask(compiler, generateSourceMap, useStartupEmitter); | 501 new CodeEmitterTask(compiler, generateSourceMap, useStartupEmitter); |
| 501 typeVariableHandler = new TypeVariableHandler(compiler); | 502 typeVariableHandler = new TypeVariableHandler(compiler); |
| 502 customElementsAnalysis = new CustomElementsAnalysis(this); | 503 customElementsAnalysis = new CustomElementsAnalysis(this); |
| 503 lookupMapAnalysis = new LookupMapAnalysis(this, reporter); | 504 lookupMapAnalysis = new LookupMapAnalysis(this, reporter); |
| 504 jsInteropAnalysis = new JsInteropAnalysis(this); | 505 jsInteropAnalysis = new JsInteropAnalysis(this); |
| 505 mirrorsAnalysis = new MirrorsAnalysis(this, compiler.resolution); | 506 mirrorsAnalysis = new MirrorsAnalysis(this, compiler.resolution); |
| 506 | 507 |
| 507 noSuchMethodRegistry = new NoSuchMethodRegistry(this); | 508 noSuchMethodRegistry = new NoSuchMethodRegistry(this); |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 interceptorData.addInterceptorsForNativeClassMembers(cls); | 717 interceptorData.addInterceptorsForNativeClassMembers(cls); |
| 717 } | 718 } |
| 718 } | 719 } |
| 719 | 720 |
| 720 void addInterceptors(ClassElement cls, WorldImpactBuilder impactBuilder, | 721 void addInterceptors(ClassElement cls, WorldImpactBuilder impactBuilder, |
| 721 {bool forResolution}) { | 722 {bool forResolution}) { |
| 722 if (forResolution) { | 723 if (forResolution) { |
| 723 cls.ensureResolved(resolution); | 724 cls.ensureResolved(resolution); |
| 724 interceptorData.addInterceptors(cls); | 725 interceptorData.addInterceptors(cls); |
| 725 } | 726 } |
| 726 impactTransformer.registerBackendInstantiation(impactBuilder, cls); | 727 backendUsage.registerBackendInstantiation(impactBuilder, cls); |
| 727 } | 728 } |
| 728 | 729 |
| 729 /// Called during codegen when [constant] has been used. | 730 /// Called during codegen when [constant] has been used. |
| 730 void computeImpactForCompileTimeConstant(ConstantValue constant, | 731 void computeImpactForCompileTimeConstant(ConstantValue constant, |
| 731 WorldImpactBuilder impactBuilder, bool isForResolution) { | 732 WorldImpactBuilder impactBuilder, bool isForResolution) { |
| 732 computeImpactForCompileTimeConstantInternal( | 733 computeImpactForCompileTimeConstantInternal( |
| 733 constant, impactBuilder, isForResolution); | 734 constant, impactBuilder, isForResolution); |
| 734 | 735 |
| 735 if (!isForResolution && lookupMapAnalysis.isLookupMap(constant)) { | 736 if (!isForResolution && lookupMapAnalysis.isLookupMap(constant)) { |
| 736 // Note: internally, this registration will temporarily remove the | 737 // Note: internally, this registration will temporarily remove the |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 if (!cls.typeVariables.isEmpty) { | 814 if (!cls.typeVariables.isEmpty) { |
| 814 typeVariableHandler.registerClassWithTypeVariables(cls, | 815 typeVariableHandler.registerClassWithTypeVariables(cls, |
| 815 forResolution: forResolution); | 816 forResolution: forResolution); |
| 816 } | 817 } |
| 817 | 818 |
| 818 // Register any helper that will be needed by the backend. | 819 // Register any helper that will be needed by the backend. |
| 819 if (forResolution) { | 820 if (forResolution) { |
| 820 if (cls == commonElements.intClass || | 821 if (cls == commonElements.intClass || |
| 821 cls == commonElements.doubleClass || | 822 cls == commonElements.doubleClass || |
| 822 cls == commonElements.numClass) { | 823 cls == commonElements.numClass) { |
| 823 impactTransformer.registerBackendImpact( | 824 backendUsage.registerBackendImpact(impactBuilder, impacts.numClasses); |
| 824 impactBuilder, impacts.numClasses); | |
| 825 } else if (cls == commonElements.listClass || | 825 } else if (cls == commonElements.listClass || |
| 826 cls == commonElements.stringClass) { | 826 cls == commonElements.stringClass) { |
| 827 impactTransformer.registerBackendImpact( | 827 backendUsage.registerBackendImpact( |
| 828 impactBuilder, impacts.listOrStringClasses); | 828 impactBuilder, impacts.listOrStringClasses); |
| 829 } else if (cls == commonElements.functionClass) { | 829 } else if (cls == commonElements.functionClass) { |
| 830 impactTransformer.registerBackendImpact( | 830 backendUsage.registerBackendImpact( |
| 831 impactBuilder, impacts.functionClass); | 831 impactBuilder, impacts.functionClass); |
| 832 } else if (cls == commonElements.mapClass) { | 832 } else if (cls == commonElements.mapClass) { |
| 833 impactTransformer.registerBackendImpact( | 833 backendUsage.registerBackendImpact(impactBuilder, impacts.mapClass); |
| 834 impactBuilder, impacts.mapClass); | |
| 835 // For map literals, the dependency between the implementation class | 834 // For map literals, the dependency between the implementation class |
| 836 // and [Map] is not visible, so we have to add it manually. | 835 // and [Map] is not visible, so we have to add it manually. |
| 837 rti.registerRtiDependency(helpers.mapLiteralClass, cls); | 836 rti.registerRtiDependency(helpers.mapLiteralClass, cls); |
| 838 } else if (cls == helpers.boundClosureClass) { | 837 } else if (cls == helpers.boundClosureClass) { |
| 839 impactTransformer.registerBackendImpact( | 838 backendUsage.registerBackendImpact( |
| 840 impactBuilder, impacts.boundClosureClass); | 839 impactBuilder, impacts.boundClosureClass); |
| 841 } else if (nativeData.isNativeOrExtendsNative(cls)) { | 840 } else if (nativeData.isNativeOrExtendsNative(cls)) { |
| 842 impactTransformer.registerBackendImpact( | 841 backendUsage.registerBackendImpact( |
| 843 impactBuilder, impacts.nativeOrExtendsClass); | 842 impactBuilder, impacts.nativeOrExtendsClass); |
| 844 } else if (cls == helpers.mapLiteralClass) { | 843 } else if (cls == helpers.mapLiteralClass) { |
| 845 impactTransformer.registerBackendImpact( | 844 backendUsage.registerBackendImpact( |
| 846 impactBuilder, impacts.mapLiteralClass); | 845 impactBuilder, impacts.mapLiteralClass); |
| 847 } | 846 } |
| 848 } | 847 } |
| 849 if (cls == helpers.closureClass) { | 848 if (cls == helpers.closureClass) { |
| 850 impactTransformer.registerBackendImpact( | 849 backendUsage.registerBackendImpact(impactBuilder, impacts.closureClass); |
| 851 impactBuilder, impacts.closureClass); | |
| 852 } | 850 } |
| 853 if (cls == commonElements.stringClass || cls == helpers.jsStringClass) { | 851 if (cls == commonElements.stringClass || cls == helpers.jsStringClass) { |
| 854 addInterceptors(helpers.jsStringClass, impactBuilder, | 852 addInterceptors(helpers.jsStringClass, impactBuilder, |
| 855 forResolution: forResolution); | 853 forResolution: forResolution); |
| 856 } else if (cls == commonElements.listClass || | 854 } else if (cls == commonElements.listClass || |
| 857 cls == helpers.jsArrayClass || | 855 cls == helpers.jsArrayClass || |
| 858 cls == helpers.jsFixedArrayClass || | 856 cls == helpers.jsFixedArrayClass || |
| 859 cls == helpers.jsExtendableArrayClass || | 857 cls == helpers.jsExtendableArrayClass || |
| 860 cls == helpers.jsUnmodifiableArrayClass) { | 858 cls == helpers.jsUnmodifiableArrayClass) { |
| 861 addInterceptors(helpers.jsArrayClass, impactBuilder, | 859 addInterceptors(helpers.jsArrayClass, impactBuilder, |
| 862 forResolution: forResolution); | 860 forResolution: forResolution); |
| 863 addInterceptors(helpers.jsMutableArrayClass, impactBuilder, | 861 addInterceptors(helpers.jsMutableArrayClass, impactBuilder, |
| 864 forResolution: forResolution); | 862 forResolution: forResolution); |
| 865 addInterceptors(helpers.jsFixedArrayClass, impactBuilder, | 863 addInterceptors(helpers.jsFixedArrayClass, impactBuilder, |
| 866 forResolution: forResolution); | 864 forResolution: forResolution); |
| 867 addInterceptors(helpers.jsExtendableArrayClass, impactBuilder, | 865 addInterceptors(helpers.jsExtendableArrayClass, impactBuilder, |
| 868 forResolution: forResolution); | 866 forResolution: forResolution); |
| 869 addInterceptors(helpers.jsUnmodifiableArrayClass, impactBuilder, | 867 addInterceptors(helpers.jsUnmodifiableArrayClass, impactBuilder, |
| 870 forResolution: forResolution); | 868 forResolution: forResolution); |
| 871 if (forResolution) { | 869 if (forResolution) { |
| 872 impactTransformer.registerBackendImpact( | 870 backendUsage.registerBackendImpact(impactBuilder, impacts.listClasses); |
| 873 impactBuilder, impacts.listClasses); | |
| 874 } | 871 } |
| 875 } else if (cls == commonElements.intClass || cls == helpers.jsIntClass) { | 872 } else if (cls == commonElements.intClass || cls == helpers.jsIntClass) { |
| 876 addInterceptors(helpers.jsIntClass, impactBuilder, | 873 addInterceptors(helpers.jsIntClass, impactBuilder, |
| 877 forResolution: forResolution); | 874 forResolution: forResolution); |
| 878 addInterceptors(helpers.jsPositiveIntClass, impactBuilder, | 875 addInterceptors(helpers.jsPositiveIntClass, impactBuilder, |
| 879 forResolution: forResolution); | 876 forResolution: forResolution); |
| 880 addInterceptors(helpers.jsUInt32Class, impactBuilder, | 877 addInterceptors(helpers.jsUInt32Class, impactBuilder, |
| 881 forResolution: forResolution); | 878 forResolution: forResolution); |
| 882 addInterceptors(helpers.jsUInt31Class, impactBuilder, | 879 addInterceptors(helpers.jsUInt31Class, impactBuilder, |
| 883 forResolution: forResolution); | 880 forResolution: forResolution); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 forResolution: forResolution); | 913 forResolution: forResolution); |
| 917 } else if (cls == helpers.jsUnknownJavaScriptObjectClass) { | 914 } else if (cls == helpers.jsUnknownJavaScriptObjectClass) { |
| 918 addInterceptors(helpers.jsUnknownJavaScriptObjectClass, impactBuilder, | 915 addInterceptors(helpers.jsUnknownJavaScriptObjectClass, impactBuilder, |
| 919 forResolution: forResolution); | 916 forResolution: forResolution); |
| 920 } else if (cls == helpers.jsJavaScriptFunctionClass) { | 917 } else if (cls == helpers.jsJavaScriptFunctionClass) { |
| 921 addInterceptors(helpers.jsJavaScriptFunctionClass, impactBuilder, | 918 addInterceptors(helpers.jsJavaScriptFunctionClass, impactBuilder, |
| 922 forResolution: forResolution); | 919 forResolution: forResolution); |
| 923 } else if (nativeData.isNativeOrExtendsNative(cls)) { | 920 } else if (nativeData.isNativeOrExtendsNative(cls)) { |
| 924 addInterceptorsForNativeClassMembers(cls, forResolution: forResolution); | 921 addInterceptorsForNativeClassMembers(cls, forResolution: forResolution); |
| 925 } else if (cls == helpers.jsIndexingBehaviorInterface) { | 922 } else if (cls == helpers.jsIndexingBehaviorInterface) { |
| 926 impactTransformer.registerBackendImpact( | 923 backendUsage.registerBackendImpact( |
| 927 impactBuilder, impacts.jsIndexingBehavior); | 924 impactBuilder, impacts.jsIndexingBehavior); |
| 928 } | 925 } |
| 929 | 926 |
| 930 customElementsAnalysis.registerInstantiatedClass(cls, | 927 customElementsAnalysis.registerInstantiatedClass(cls, |
| 931 forResolution: forResolution); | 928 forResolution: forResolution); |
| 932 if (!forResolution) { | 929 if (!forResolution) { |
| 933 lookupMapAnalysis.registerInstantiatedClass(cls); | 930 lookupMapAnalysis.registerInstantiatedClass(cls); |
| 934 } | 931 } |
| 935 | 932 |
| 936 return impactBuilder; | 933 return impactBuilder; |
| 937 } | 934 } |
| 938 | 935 |
| 939 void registerInstantiatedType(ResolutionInterfaceType type) { | 936 void registerInstantiatedType(ResolutionInterfaceType type) { |
| 940 lookupMapAnalysis.registerInstantiatedType(type); | 937 lookupMapAnalysis.registerInstantiatedType(type); |
| 941 } | 938 } |
| 942 | 939 |
| 943 /// Compute the [WorldImpact] for backend helper methods. | 940 /// Compute the [WorldImpact] for backend helper methods. |
| 944 WorldImpact computeHelpersImpact() { | 941 WorldImpact computeHelpersImpact() { |
| 945 assert(helpers.interceptorsLibrary != null); | 942 assert(helpers.interceptorsLibrary != null); |
| 946 WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl(); | 943 WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl(); |
| 947 // TODO(ngeoffray): Not enqueuing those two classes currently make | 944 // TODO(ngeoffray): Not enqueuing those two classes currently make |
| 948 // the compiler potentially crash. However, any reasonable program | 945 // the compiler potentially crash. However, any reasonable program |
| 949 // will instantiate those two classes. | 946 // will instantiate those two classes. |
| 950 addInterceptors(helpers.jsBoolClass, impactBuilder, forResolution: true); | 947 addInterceptors(helpers.jsBoolClass, impactBuilder, forResolution: true); |
| 951 addInterceptors(helpers.jsNullClass, impactBuilder, forResolution: true); | 948 addInterceptors(helpers.jsNullClass, impactBuilder, forResolution: true); |
| 952 if (compiler.options.enableTypeAssertions) { | 949 if (compiler.options.enableTypeAssertions) { |
| 953 impactTransformer.registerBackendImpact( | 950 backendUsage.registerBackendImpact( |
| 954 impactBuilder, impacts.enableTypeAssertions); | 951 impactBuilder, impacts.enableTypeAssertions); |
| 955 } | 952 } |
| 956 | 953 |
| 957 if (TRACE_CALLS) { | 954 if (TRACE_CALLS) { |
| 958 impactTransformer.registerBackendImpact( | 955 backendUsage.registerBackendImpact(impactBuilder, impacts.traceHelper); |
| 959 impactBuilder, impacts.traceHelper); | |
| 960 } | 956 } |
| 961 impactTransformer.registerBackendImpact( | 957 backendUsage.registerBackendImpact( |
| 962 impactBuilder, impacts.assertUnreachable); | 958 impactBuilder, impacts.assertUnreachable); |
| 963 _registerCheckedModeHelpers(impactBuilder); | 959 _registerCheckedModeHelpers(impactBuilder); |
| 964 return impactBuilder; | 960 return impactBuilder; |
| 965 } | 961 } |
| 966 | 962 |
| 967 void onResolutionComplete( | 963 void onResolutionComplete( |
| 968 ClosedWorld closedWorld, ClosedWorldRefiner closedWorldRefiner) { | 964 ClosedWorld closedWorld, ClosedWorldRefiner closedWorldRefiner) { |
| 969 for (Entity entity in compiler.enqueuer.resolution.processedEntities) { | 965 for (Entity entity in compiler.enqueuer.resolution.processedEntities) { |
| 970 processAnnotations(entity, closedWorldRefiner); | 966 processAnnotations(entity, closedWorldRefiner); |
| 971 } | 967 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 995 | 991 |
| 996 WorldImpact registerClosureWithFreeTypeVariables(MethodElement closure, | 992 WorldImpact registerClosureWithFreeTypeVariables(MethodElement closure, |
| 997 {bool forResolution}) { | 993 {bool forResolution}) { |
| 998 if (forResolution || methodNeedsRti(closure)) { | 994 if (forResolution || methodNeedsRti(closure)) { |
| 999 return _registerComputeSignature(); | 995 return _registerComputeSignature(); |
| 1000 } | 996 } |
| 1001 return const WorldImpact(); | 997 return const WorldImpact(); |
| 1002 } | 998 } |
| 1003 | 999 |
| 1004 WorldImpact registerBoundClosure() { | 1000 WorldImpact registerBoundClosure() { |
| 1005 return impactTransformer.createImpactFor(impacts.memberClosure); | 1001 return backendUsage.createImpactFor(impacts.memberClosure); |
| 1006 } | 1002 } |
| 1007 | 1003 |
| 1008 WorldImpact registerGetOfStaticFunction() { | 1004 WorldImpact registerGetOfStaticFunction() { |
| 1009 return impactTransformer.createImpactFor(impacts.staticClosure); | 1005 return backendUsage.createImpactFor(impacts.staticClosure); |
| 1010 } | 1006 } |
| 1011 | 1007 |
| 1012 WorldImpact _registerComputeSignature() { | 1008 WorldImpact _registerComputeSignature() { |
| 1013 return impactTransformer.createImpactFor(impacts.computeSignature); | 1009 return backendUsage.createImpactFor(impacts.computeSignature); |
| 1014 } | 1010 } |
| 1015 | 1011 |
| 1016 /// Called to register that the `runtimeType` property has been accessed. Any | 1012 /// Called to register that the `runtimeType` property has been accessed. Any |
| 1017 /// backend specific [WorldImpact] of this is returned. | 1013 /// backend specific [WorldImpact] of this is returned. |
| 1018 WorldImpact registerRuntimeType() { | 1014 WorldImpact registerRuntimeType() { |
| 1019 return impactTransformer.createImpactFor(impacts.runtimeTypeSupport); | 1015 return backendUsage.createImpactFor(impacts.runtimeTypeSupport); |
| 1020 } | 1016 } |
| 1021 | 1017 |
| 1022 /// Register a runtime type variable bound tests between [typeArgument] and | 1018 /// Register a runtime type variable bound tests between [typeArgument] and |
| 1023 /// [bound]. | 1019 /// [bound]. |
| 1024 void registerTypeVariableBoundsSubtypeCheck( | 1020 void registerTypeVariableBoundsSubtypeCheck( |
| 1025 ResolutionDartType typeArgument, ResolutionDartType bound) { | 1021 ResolutionDartType typeArgument, ResolutionDartType bound) { |
| 1026 rti.registerTypeVariableBoundsSubtypeCheck(typeArgument, bound); | 1022 rti.registerTypeVariableBoundsSubtypeCheck(typeArgument, bound); |
| 1027 } | 1023 } |
| 1028 | 1024 |
| 1029 /// Returns the [WorldImpact] of enabling deferred loading. | 1025 /// Returns the [WorldImpact] of enabling deferred loading. |
| 1030 WorldImpact computeDeferredLoadingImpact() { | 1026 WorldImpact computeDeferredLoadingImpact() { |
| 1031 return impactTransformer.createImpactFor(impacts.deferredLoading); | 1027 return backendUsage.createImpactFor(impacts.deferredLoading); |
| 1032 } | 1028 } |
| 1033 | 1029 |
| 1034 /// Called to register a `noSuchMethod` implementation. | 1030 /// Called to register a `noSuchMethod` implementation. |
| 1035 void registerNoSuchMethod(MethodElement noSuchMethod) { | 1031 void registerNoSuchMethod(MethodElement noSuchMethod) { |
| 1036 noSuchMethodRegistry.registerNoSuchMethod(noSuchMethod); | 1032 noSuchMethodRegistry.registerNoSuchMethod(noSuchMethod); |
| 1037 } | 1033 } |
| 1038 | 1034 |
| 1039 /// Called when resolving a call to a foreign function. | 1035 /// Called when resolving a call to a foreign function. |
| 1040 native.NativeBehavior resolveForeignCall(Send node, Element element, | 1036 native.NativeBehavior resolveForeignCall(Send node, Element element, |
| 1041 CallStructure callStructure, ForeignResolver resolver) { | 1037 CallStructure callStructure, ForeignResolver resolver) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1064 } | 1060 } |
| 1065 } | 1061 } |
| 1066 reporter.reportErrorMessage( | 1062 reporter.reportErrorMessage( |
| 1067 node, MessageKind.WRONG_ARGUMENT_FOR_JS_INTERCEPTOR_CONSTANT); | 1063 node, MessageKind.WRONG_ARGUMENT_FOR_JS_INTERCEPTOR_CONSTANT); |
| 1068 } | 1064 } |
| 1069 // No native behavior for this call. | 1065 // No native behavior for this call. |
| 1070 return null; | 1066 return null; |
| 1071 } | 1067 } |
| 1072 | 1068 |
| 1073 WorldImpact computeNoSuchMethodImpact() { | 1069 WorldImpact computeNoSuchMethodImpact() { |
| 1074 return impactTransformer.createImpactFor(impacts.noSuchMethodSupport); | 1070 return backendUsage.createImpactFor(impacts.noSuchMethodSupport); |
| 1075 } | 1071 } |
| 1076 | 1072 |
| 1077 /// Called to enable support for isolates. Any backend specific [WorldImpact] | 1073 /// Called to enable support for isolates. Any backend specific [WorldImpact] |
| 1078 /// of this is returned. | 1074 /// of this is returned. |
| 1079 WorldImpact enableIsolateSupport({bool forResolution}) { | 1075 WorldImpact enableIsolateSupport({bool forResolution}) { |
| 1080 WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl(); | 1076 WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl(); |
| 1081 // TODO(floitsch): We should also ensure that the class IsolateMessage is | 1077 // TODO(floitsch): We should also ensure that the class IsolateMessage is |
| 1082 // instantiated. Currently, just enabling isolate support works. | 1078 // instantiated. Currently, just enabling isolate support works. |
| 1083 if (compiler.mainFunction != null) { | 1079 if (compiler.mainFunction != null) { |
| 1084 // The JavaScript backend implements [Isolate.spawn] by looking up | 1080 // The JavaScript backend implements [Isolate.spawn] by looking up |
| 1085 // top-level functions by name. So all top-level function tear-off | 1081 // top-level functions by name. So all top-level function tear-off |
| 1086 // closures have a private name field. | 1082 // closures have a private name field. |
| 1087 // | 1083 // |
| 1088 // The JavaScript backend of [Isolate.spawnUri] uses the same internal | 1084 // The JavaScript backend of [Isolate.spawnUri] uses the same internal |
| 1089 // implementation as [Isolate.spawn], and fails if it cannot look main up | 1085 // implementation as [Isolate.spawn], and fails if it cannot look main up |
| 1090 // by name. | 1086 // by name. |
| 1091 impactBuilder.registerStaticUse( | 1087 impactBuilder.registerStaticUse( |
| 1092 new StaticUse.staticTearOff(compiler.mainFunction)); | 1088 new StaticUse.staticTearOff(compiler.mainFunction)); |
| 1093 } | 1089 } |
| 1094 impactTransformer.registerBackendImpact( | 1090 backendUsage.registerBackendImpact(impactBuilder, impacts.isolateSupport); |
| 1095 impactBuilder, impacts.isolateSupport); | |
| 1096 if (forResolution) { | 1091 if (forResolution) { |
| 1097 impactTransformer.registerBackendImpact( | 1092 backendUsage.registerBackendImpact( |
| 1098 impactBuilder, impacts.isolateSupportForResolution); | 1093 impactBuilder, impacts.isolateSupportForResolution); |
| 1099 } | 1094 } |
| 1100 return impactBuilder; | 1095 return impactBuilder; |
| 1101 } | 1096 } |
| 1102 | 1097 |
| 1103 bool classNeedsRti(ClassElement cls) { | 1098 bool classNeedsRti(ClassElement cls) { |
| 1104 if (hasRuntimeTypeSupport) return true; | 1099 if (hasRuntimeTypeSupport) return true; |
| 1105 return rti.classesNeedingRti.contains(cls.declaration); | 1100 return rti.classesNeedingRti.contains(cls.declaration); |
| 1106 } | 1101 } |
| 1107 | 1102 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1270 return element; | 1265 return element; |
| 1271 } | 1266 } |
| 1272 | 1267 |
| 1273 void _registerCheckedModeHelpers(WorldImpactBuilder impactBuilder) { | 1268 void _registerCheckedModeHelpers(WorldImpactBuilder impactBuilder) { |
| 1274 // We register all the helpers in the resolution queue. | 1269 // We register all the helpers in the resolution queue. |
| 1275 // TODO(13155): Find a way to register fewer helpers. | 1270 // TODO(13155): Find a way to register fewer helpers. |
| 1276 List<Element> staticUses = <Element>[]; | 1271 List<Element> staticUses = <Element>[]; |
| 1277 for (CheckedModeHelper helper in CheckedModeHelpers.helpers) { | 1272 for (CheckedModeHelper helper in CheckedModeHelpers.helpers) { |
| 1278 staticUses.add(helper.getStaticUse(helpers).element); | 1273 staticUses.add(helper.getStaticUse(helpers).element); |
| 1279 } | 1274 } |
| 1280 impactTransformer.registerBackendImpact( | 1275 backendUsage.registerBackendImpact( |
| 1281 impactBuilder, new BackendImpact(globalUses: staticUses)); | 1276 impactBuilder, new BackendImpact(globalUses: staticUses)); |
| 1282 } | 1277 } |
| 1283 | 1278 |
| 1284 /** | 1279 /** |
| 1285 * Returns [:true:] if the checking of [type] is performed directly on the | 1280 * Returns [:true:] if the checking of [type] is performed directly on the |
| 1286 * object and not on an interceptor. | 1281 * object and not on an interceptor. |
| 1287 */ | 1282 */ |
| 1288 bool hasDirectCheckFor(ResolutionDartType type) { | 1283 bool hasDirectCheckFor(ResolutionDartType type) { |
| 1289 Element element = type.element; | 1284 Element element = type.element; |
| 1290 return element == commonElements.stringClass || | 1285 return element == commonElements.stringClass || |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1321 if (compiler.options.preserveUris) mustPreserveUris = true; | 1316 if (compiler.options.preserveUris) mustPreserveUris = true; |
| 1322 } else if (element == helpers.preserveLibraryNamesMarker) { | 1317 } else if (element == helpers.preserveLibraryNamesMarker) { |
| 1323 mirrorsData.mustRetainLibraryNames = true; | 1318 mirrorsData.mustRetainLibraryNames = true; |
| 1324 } else if (element == helpers.getIsolateAffinityTagMarker) { | 1319 } else if (element == helpers.getIsolateAffinityTagMarker) { |
| 1325 backendUsage.needToInitializeIsolateAffinityTag = true; | 1320 backendUsage.needToInitializeIsolateAffinityTag = true; |
| 1326 } else if (element.isDeferredLoaderGetter) { | 1321 } else if (element.isDeferredLoaderGetter) { |
| 1327 // TODO(sigurdm): Create a function registerLoadLibraryAccess. | 1322 // TODO(sigurdm): Create a function registerLoadLibraryAccess. |
| 1328 if (!isLoadLibraryFunctionResolved) { | 1323 if (!isLoadLibraryFunctionResolved) { |
| 1329 isLoadLibraryFunctionResolved = true; | 1324 isLoadLibraryFunctionResolved = true; |
| 1330 if (forResolution) { | 1325 if (forResolution) { |
| 1331 impactTransformer.registerBackendImpact( | 1326 backendUsage.registerBackendImpact(worldImpact, impacts.loadLibrary); |
| 1332 worldImpact, impacts.loadLibrary); | |
| 1333 } | 1327 } |
| 1334 } | 1328 } |
| 1335 } else if (element == helpers.requiresPreambleMarker) { | 1329 } else if (element == helpers.requiresPreambleMarker) { |
| 1336 requiresPreamble = true; | 1330 requiresPreamble = true; |
| 1337 } else if (element == helpers.invokeOnMethod && forResolution) { | 1331 } else if (element == helpers.invokeOnMethod && forResolution) { |
| 1338 hasInvokeOnSupport = true; | 1332 hasInvokeOnSupport = true; |
| 1339 } | 1333 } |
| 1340 customElementsAnalysis.registerStaticUse(element, | 1334 customElementsAnalysis.registerStaticUse(element, |
| 1341 forResolution: forResolution); | 1335 forResolution: forResolution); |
| 1342 | 1336 |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1797 | 1791 |
| 1798 MethodElement helperForMissingMain() => helpers.missingMain; | 1792 MethodElement helperForMissingMain() => helpers.missingMain; |
| 1799 | 1793 |
| 1800 MethodElement helperForMainArity() => helpers.mainHasTooManyParameters; | 1794 MethodElement helperForMainArity() => helpers.mainHasTooManyParameters; |
| 1801 | 1795 |
| 1802 /// Computes the [WorldImpact] of calling [mainMethod] as the entry point. | 1796 /// Computes the [WorldImpact] of calling [mainMethod] as the entry point. |
| 1803 WorldImpact computeMainImpact(MethodElement mainMethod, | 1797 WorldImpact computeMainImpact(MethodElement mainMethod, |
| 1804 {bool forResolution}) { | 1798 {bool forResolution}) { |
| 1805 WorldImpactBuilderImpl mainImpact = new WorldImpactBuilderImpl(); | 1799 WorldImpactBuilderImpl mainImpact = new WorldImpactBuilderImpl(); |
| 1806 if (mainMethod.parameters.isNotEmpty) { | 1800 if (mainMethod.parameters.isNotEmpty) { |
| 1807 impactTransformer.registerBackendImpact( | 1801 backendUsage.registerBackendImpact(mainImpact, impacts.mainWithArguments); |
| 1808 mainImpact, impacts.mainWithArguments); | |
| 1809 mainImpact.registerStaticUse( | 1802 mainImpact.registerStaticUse( |
| 1810 new StaticUse.staticInvoke(mainMethod, CallStructure.TWO_ARGS)); | 1803 new StaticUse.staticInvoke(mainMethod, CallStructure.TWO_ARGS)); |
| 1811 // If the main method takes arguments, this compilation could be the | 1804 // If the main method takes arguments, this compilation could be the |
| 1812 // target of Isolate.spawnUri. Strictly speaking, that can happen also if | 1805 // target of Isolate.spawnUri. Strictly speaking, that can happen also if |
| 1813 // main takes no arguments, but in this case the spawned isolate can't | 1806 // main takes no arguments, but in this case the spawned isolate can't |
| 1814 // communicate with the spawning isolate. | 1807 // communicate with the spawning isolate. |
| 1815 mainImpact.addImpact(enableIsolateSupport(forResolution: forResolution)); | 1808 mainImpact.addImpact(enableIsolateSupport(forResolution: forResolution)); |
| 1816 } | 1809 } |
| 1817 mainImpact.registerStaticUse( | 1810 mainImpact.registerStaticUse( |
| 1818 new StaticUse.staticInvoke(mainMethod, CallStructure.NO_ARGS)); | 1811 new StaticUse.staticInvoke(mainMethod, CallStructure.NO_ARGS)); |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2016 } | 2009 } |
| 2017 } | 2010 } |
| 2018 | 2011 |
| 2019 class JavaScriptImpactTransformer extends ImpactTransformer { | 2012 class JavaScriptImpactTransformer extends ImpactTransformer { |
| 2020 final JavaScriptBackend backend; | 2013 final JavaScriptBackend backend; |
| 2021 | 2014 |
| 2022 JavaScriptImpactTransformer(this.backend); | 2015 JavaScriptImpactTransformer(this.backend); |
| 2023 | 2016 |
| 2024 BackendImpacts get impacts => backend.impacts; | 2017 BackendImpacts get impacts => backend.impacts; |
| 2025 | 2018 |
| 2019 BackendUsage get backendUsage => backend.backendUsage; |
| 2020 |
| 2026 @override | 2021 @override |
| 2027 WorldImpact transformResolutionImpact( | 2022 WorldImpact transformResolutionImpact( |
| 2028 ResolutionEnqueuer enqueuer, ResolutionImpact worldImpact) { | 2023 ResolutionEnqueuer enqueuer, ResolutionImpact worldImpact) { |
| 2029 TransformedWorldImpact transformed = | 2024 TransformedWorldImpact transformed = |
| 2030 new TransformedWorldImpact(worldImpact); | 2025 new TransformedWorldImpact(worldImpact); |
| 2031 for (Feature feature in worldImpact.features) { | 2026 for (Feature feature in worldImpact.features) { |
| 2032 switch (feature) { | 2027 switch (feature) { |
| 2033 case Feature.ABSTRACT_CLASS_INSTANTIATION: | 2028 case Feature.ABSTRACT_CLASS_INSTANTIATION: |
| 2034 registerBackendImpact( | 2029 backendUsage.registerBackendImpact( |
| 2035 transformed, impacts.abstractClassInstantiation); | 2030 transformed, impacts.abstractClassInstantiation); |
| 2036 break; | 2031 break; |
| 2037 case Feature.ASSERT: | 2032 case Feature.ASSERT: |
| 2038 registerBackendImpact(transformed, impacts.assertWithoutMessage); | 2033 backendUsage.registerBackendImpact( |
| 2034 transformed, impacts.assertWithoutMessage); |
| 2039 break; | 2035 break; |
| 2040 case Feature.ASSERT_WITH_MESSAGE: | 2036 case Feature.ASSERT_WITH_MESSAGE: |
| 2041 registerBackendImpact(transformed, impacts.assertWithMessage); | 2037 backendUsage.registerBackendImpact( |
| 2038 transformed, impacts.assertWithMessage); |
| 2042 break; | 2039 break; |
| 2043 case Feature.ASYNC: | 2040 case Feature.ASYNC: |
| 2044 registerBackendImpact(transformed, impacts.asyncBody); | 2041 backendUsage.registerBackendImpact(transformed, impacts.asyncBody); |
| 2045 break; | 2042 break; |
| 2046 case Feature.ASYNC_FOR_IN: | 2043 case Feature.ASYNC_FOR_IN: |
| 2047 registerBackendImpact(transformed, impacts.asyncForIn); | 2044 backendUsage.registerBackendImpact(transformed, impacts.asyncForIn); |
| 2048 break; | 2045 break; |
| 2049 case Feature.ASYNC_STAR: | 2046 case Feature.ASYNC_STAR: |
| 2050 registerBackendImpact(transformed, impacts.asyncStarBody); | 2047 backendUsage.registerBackendImpact( |
| 2048 transformed, impacts.asyncStarBody); |
| 2051 break; | 2049 break; |
| 2052 case Feature.CATCH_STATEMENT: | 2050 case Feature.CATCH_STATEMENT: |
| 2053 registerBackendImpact(transformed, impacts.catchStatement); | 2051 backendUsage.registerBackendImpact( |
| 2052 transformed, impacts.catchStatement); |
| 2054 break; | 2053 break; |
| 2055 case Feature.COMPILE_TIME_ERROR: | 2054 case Feature.COMPILE_TIME_ERROR: |
| 2056 if (backend.compiler.options.generateCodeWithCompileTimeErrors) { | 2055 if (backend.compiler.options.generateCodeWithCompileTimeErrors) { |
| 2057 // TODO(johnniwinther): This should have its own uncatchable error. | 2056 // TODO(johnniwinther): This should have its own uncatchable error. |
| 2058 registerBackendImpact(transformed, impacts.throwRuntimeError); | 2057 backendUsage.registerBackendImpact( |
| 2058 transformed, impacts.throwRuntimeError); |
| 2059 } | 2059 } |
| 2060 break; | 2060 break; |
| 2061 case Feature.FALL_THROUGH_ERROR: | 2061 case Feature.FALL_THROUGH_ERROR: |
| 2062 registerBackendImpact(transformed, impacts.fallThroughError); | 2062 backendUsage.registerBackendImpact( |
| 2063 transformed, impacts.fallThroughError); |
| 2063 break; | 2064 break; |
| 2064 case Feature.FIELD_WITHOUT_INITIALIZER: | 2065 case Feature.FIELD_WITHOUT_INITIALIZER: |
| 2065 case Feature.LOCAL_WITHOUT_INITIALIZER: | 2066 case Feature.LOCAL_WITHOUT_INITIALIZER: |
| 2066 transformed.registerTypeUse( | 2067 transformed.registerTypeUse( |
| 2067 new TypeUse.instantiation(backend.commonElements.nullType)); | 2068 new TypeUse.instantiation(backend.commonElements.nullType)); |
| 2068 registerBackendImpact(transformed, impacts.nullLiteral); | 2069 backendUsage.registerBackendImpact(transformed, impacts.nullLiteral); |
| 2069 break; | 2070 break; |
| 2070 case Feature.LAZY_FIELD: | 2071 case Feature.LAZY_FIELD: |
| 2071 registerBackendImpact(transformed, impacts.lazyField); | 2072 backendUsage.registerBackendImpact(transformed, impacts.lazyField); |
| 2072 break; | 2073 break; |
| 2073 case Feature.STACK_TRACE_IN_CATCH: | 2074 case Feature.STACK_TRACE_IN_CATCH: |
| 2074 registerBackendImpact(transformed, impacts.stackTraceInCatch); | 2075 backendUsage.registerBackendImpact( |
| 2076 transformed, impacts.stackTraceInCatch); |
| 2075 break; | 2077 break; |
| 2076 case Feature.STRING_INTERPOLATION: | 2078 case Feature.STRING_INTERPOLATION: |
| 2077 registerBackendImpact(transformed, impacts.stringInterpolation); | 2079 backendUsage.registerBackendImpact( |
| 2080 transformed, impacts.stringInterpolation); |
| 2078 break; | 2081 break; |
| 2079 case Feature.STRING_JUXTAPOSITION: | 2082 case Feature.STRING_JUXTAPOSITION: |
| 2080 registerBackendImpact(transformed, impacts.stringJuxtaposition); | 2083 backendUsage.registerBackendImpact( |
| 2084 transformed, impacts.stringJuxtaposition); |
| 2081 break; | 2085 break; |
| 2082 case Feature.SUPER_NO_SUCH_METHOD: | 2086 case Feature.SUPER_NO_SUCH_METHOD: |
| 2083 registerBackendImpact(transformed, impacts.superNoSuchMethod); | 2087 backendUsage.registerBackendImpact( |
| 2088 transformed, impacts.superNoSuchMethod); |
| 2084 break; | 2089 break; |
| 2085 case Feature.SYMBOL_CONSTRUCTOR: | 2090 case Feature.SYMBOL_CONSTRUCTOR: |
| 2086 registerBackendImpact(transformed, impacts.symbolConstructor); | 2091 backendUsage.registerBackendImpact( |
| 2092 transformed, impacts.symbolConstructor); |
| 2087 break; | 2093 break; |
| 2088 case Feature.SYNC_FOR_IN: | 2094 case Feature.SYNC_FOR_IN: |
| 2089 registerBackendImpact(transformed, impacts.syncForIn); | 2095 backendUsage.registerBackendImpact(transformed, impacts.syncForIn); |
| 2090 break; | 2096 break; |
| 2091 case Feature.SYNC_STAR: | 2097 case Feature.SYNC_STAR: |
| 2092 registerBackendImpact(transformed, impacts.syncStarBody); | 2098 backendUsage.registerBackendImpact(transformed, impacts.syncStarBody); |
| 2093 break; | 2099 break; |
| 2094 case Feature.THROW_EXPRESSION: | 2100 case Feature.THROW_EXPRESSION: |
| 2095 registerBackendImpact(transformed, impacts.throwExpression); | 2101 backendUsage.registerBackendImpact( |
| 2102 transformed, impacts.throwExpression); |
| 2096 break; | 2103 break; |
| 2097 case Feature.THROW_NO_SUCH_METHOD: | 2104 case Feature.THROW_NO_SUCH_METHOD: |
| 2098 registerBackendImpact(transformed, impacts.throwNoSuchMethod); | 2105 backendUsage.registerBackendImpact( |
| 2106 transformed, impacts.throwNoSuchMethod); |
| 2099 break; | 2107 break; |
| 2100 case Feature.THROW_RUNTIME_ERROR: | 2108 case Feature.THROW_RUNTIME_ERROR: |
| 2101 registerBackendImpact(transformed, impacts.throwRuntimeError); | 2109 backendUsage.registerBackendImpact( |
| 2110 transformed, impacts.throwRuntimeError); |
| 2102 break; | 2111 break; |
| 2103 case Feature.TYPE_VARIABLE_BOUNDS_CHECK: | 2112 case Feature.TYPE_VARIABLE_BOUNDS_CHECK: |
| 2104 registerBackendImpact(transformed, impacts.typeVariableBoundCheck); | 2113 backendUsage.registerBackendImpact( |
| 2114 transformed, impacts.typeVariableBoundCheck); |
| 2105 break; | 2115 break; |
| 2106 } | 2116 } |
| 2107 } | 2117 } |
| 2108 | 2118 |
| 2109 bool hasAsCast = false; | 2119 bool hasAsCast = false; |
| 2110 bool hasTypeLiteral = false; | 2120 bool hasTypeLiteral = false; |
| 2111 for (TypeUse typeUse in worldImpact.typeUses) { | 2121 for (TypeUse typeUse in worldImpact.typeUses) { |
| 2112 ResolutionDartType type = typeUse.type; | 2122 ResolutionDartType type = typeUse.type; |
| 2113 switch (typeUse.kind) { | 2123 switch (typeUse.kind) { |
| 2114 case TypeUseKind.INSTANTIATION: | 2124 case TypeUseKind.INSTANTIATION: |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2134 case TypeUseKind.TYPE_LITERAL: | 2144 case TypeUseKind.TYPE_LITERAL: |
| 2135 backend.customElementsAnalysis.registerTypeLiteral(type); | 2145 backend.customElementsAnalysis.registerTypeLiteral(type); |
| 2136 if (type.isTypeVariable && type is! MethodTypeVariableType) { | 2146 if (type.isTypeVariable && type is! MethodTypeVariableType) { |
| 2137 // GENERIC_METHODS: The `is!` test above filters away method type | 2147 // GENERIC_METHODS: The `is!` test above filters away method type |
| 2138 // variables, because they have the value `dynamic` with the | 2148 // variables, because they have the value `dynamic` with the |
| 2139 // incomplete support for generic methods offered with | 2149 // incomplete support for generic methods offered with |
| 2140 // '--generic-method-syntax'. This must be revised in order to | 2150 // '--generic-method-syntax'. This must be revised in order to |
| 2141 // support generic methods fully. | 2151 // support generic methods fully. |
| 2142 ClassElement cls = type.element.enclosingClass; | 2152 ClassElement cls = type.element.enclosingClass; |
| 2143 backend.rti.registerClassUsingTypeVariableExpression(cls); | 2153 backend.rti.registerClassUsingTypeVariableExpression(cls); |
| 2144 registerBackendImpact(transformed, impacts.typeVariableExpression); | 2154 backendUsage.registerBackendImpact( |
| 2155 transformed, impacts.typeVariableExpression); |
| 2145 } | 2156 } |
| 2146 hasTypeLiteral = true; | 2157 hasTypeLiteral = true; |
| 2147 break; | 2158 break; |
| 2148 } | 2159 } |
| 2149 } | 2160 } |
| 2150 | 2161 |
| 2151 if (hasAsCast) { | 2162 if (hasAsCast) { |
| 2152 registerBackendImpact(transformed, impacts.asCheck); | 2163 backendUsage.registerBackendImpact(transformed, impacts.asCheck); |
| 2153 } | 2164 } |
| 2154 | 2165 |
| 2155 if (hasTypeLiteral) { | 2166 if (hasTypeLiteral) { |
| 2156 transformed.registerTypeUse( | 2167 transformed.registerTypeUse( |
| 2157 new TypeUse.instantiation(backend.compiler.commonElements.typeType)); | 2168 new TypeUse.instantiation(backend.compiler.commonElements.typeType)); |
| 2158 registerBackendImpact(transformed, impacts.typeLiteral); | 2169 backendUsage.registerBackendImpact(transformed, impacts.typeLiteral); |
| 2159 } | 2170 } |
| 2160 | 2171 |
| 2161 for (MapLiteralUse mapLiteralUse in worldImpact.mapLiterals) { | 2172 for (MapLiteralUse mapLiteralUse in worldImpact.mapLiterals) { |
| 2162 // TODO(johnniwinther): Use the [isEmpty] property when factory | 2173 // TODO(johnniwinther): Use the [isEmpty] property when factory |
| 2163 // constructors are registered directly. | 2174 // constructors are registered directly. |
| 2164 if (mapLiteralUse.isConstant) { | 2175 if (mapLiteralUse.isConstant) { |
| 2165 registerBackendImpact(transformed, impacts.constantMapLiteral); | 2176 backendUsage.registerBackendImpact( |
| 2177 transformed, impacts.constantMapLiteral); |
| 2166 } else { | 2178 } else { |
| 2167 transformed | 2179 transformed |
| 2168 .registerTypeUse(new TypeUse.instantiation(mapLiteralUse.type)); | 2180 .registerTypeUse(new TypeUse.instantiation(mapLiteralUse.type)); |
| 2169 } | 2181 } |
| 2170 ResolutionInterfaceType type = mapLiteralUse.type; | 2182 ResolutionInterfaceType type = mapLiteralUse.type; |
| 2171 registerRequiredType(type); | 2183 registerRequiredType(type); |
| 2172 } | 2184 } |
| 2173 | 2185 |
| 2174 for (ListLiteralUse listLiteralUse in worldImpact.listLiterals) { | 2186 for (ListLiteralUse listLiteralUse in worldImpact.listLiterals) { |
| 2175 // TODO(johnniwinther): Use the [isConstant] and [isEmpty] property when | 2187 // TODO(johnniwinther): Use the [isConstant] and [isEmpty] property when |
| 2176 // factory constructors are registered directly. | 2188 // factory constructors are registered directly. |
| 2177 transformed | 2189 transformed |
| 2178 .registerTypeUse(new TypeUse.instantiation(listLiteralUse.type)); | 2190 .registerTypeUse(new TypeUse.instantiation(listLiteralUse.type)); |
| 2179 ResolutionInterfaceType type = listLiteralUse.type; | 2191 ResolutionInterfaceType type = listLiteralUse.type; |
| 2180 registerRequiredType(type); | 2192 registerRequiredType(type); |
| 2181 } | 2193 } |
| 2182 | 2194 |
| 2183 if (worldImpact.constSymbolNames.isNotEmpty) { | 2195 if (worldImpact.constSymbolNames.isNotEmpty) { |
| 2184 registerBackendImpact(transformed, impacts.constSymbol); | 2196 backendUsage.registerBackendImpact(transformed, impacts.constSymbol); |
| 2185 for (String constSymbolName in worldImpact.constSymbolNames) { | 2197 for (String constSymbolName in worldImpact.constSymbolNames) { |
| 2186 backend.mirrorsData.registerConstSymbol(constSymbolName); | 2198 backend.mirrorsData.registerConstSymbol(constSymbolName); |
| 2187 } | 2199 } |
| 2188 } | 2200 } |
| 2189 | 2201 |
| 2190 for (StaticUse staticUse in worldImpact.staticUses) { | 2202 for (StaticUse staticUse in worldImpact.staticUses) { |
| 2191 switch (staticUse.kind) { | 2203 switch (staticUse.kind) { |
| 2192 case StaticUseKind.CLOSURE: | 2204 case StaticUseKind.CLOSURE: |
| 2193 registerBackendImpact(transformed, impacts.closure); | 2205 backendUsage.registerBackendImpact(transformed, impacts.closure); |
| 2194 LocalFunctionElement closure = staticUse.element; | 2206 LocalFunctionElement closure = staticUse.element; |
| 2195 if (closure.type.containsTypeVariables) { | 2207 if (closure.type.containsTypeVariables) { |
| 2196 registerBackendImpact(transformed, impacts.computeSignature); | 2208 backendUsage.registerBackendImpact( |
| 2209 transformed, impacts.computeSignature); |
| 2197 } | 2210 } |
| 2198 break; | 2211 break; |
| 2199 case StaticUseKind.CONST_CONSTRUCTOR_INVOKE: | 2212 case StaticUseKind.CONST_CONSTRUCTOR_INVOKE: |
| 2200 case StaticUseKind.CONSTRUCTOR_INVOKE: | 2213 case StaticUseKind.CONSTRUCTOR_INVOKE: |
| 2201 registerRequiredType(staticUse.type); | 2214 registerRequiredType(staticUse.type); |
| 2202 break; | 2215 break; |
| 2203 default: | 2216 default: |
| 2204 } | 2217 } |
| 2205 } | 2218 } |
| 2206 | 2219 |
| 2207 for (ConstantExpression constant in worldImpact.constantLiterals) { | 2220 for (ConstantExpression constant in worldImpact.constantLiterals) { |
| 2208 switch (constant.kind) { | 2221 switch (constant.kind) { |
| 2209 case ConstantExpressionKind.NULL: | 2222 case ConstantExpressionKind.NULL: |
| 2210 registerBackendImpact(transformed, impacts.nullLiteral); | 2223 backendUsage.registerBackendImpact(transformed, impacts.nullLiteral); |
| 2211 break; | 2224 break; |
| 2212 case ConstantExpressionKind.BOOL: | 2225 case ConstantExpressionKind.BOOL: |
| 2213 registerBackendImpact(transformed, impacts.boolLiteral); | 2226 backendUsage.registerBackendImpact(transformed, impacts.boolLiteral); |
| 2214 break; | 2227 break; |
| 2215 case ConstantExpressionKind.INT: | 2228 case ConstantExpressionKind.INT: |
| 2216 registerBackendImpact(transformed, impacts.intLiteral); | 2229 backendUsage.registerBackendImpact(transformed, impacts.intLiteral); |
| 2217 break; | 2230 break; |
| 2218 case ConstantExpressionKind.DOUBLE: | 2231 case ConstantExpressionKind.DOUBLE: |
| 2219 registerBackendImpact(transformed, impacts.doubleLiteral); | 2232 backendUsage.registerBackendImpact( |
| 2233 transformed, impacts.doubleLiteral); |
| 2220 break; | 2234 break; |
| 2221 case ConstantExpressionKind.STRING: | 2235 case ConstantExpressionKind.STRING: |
| 2222 registerBackendImpact(transformed, impacts.stringLiteral); | 2236 backendUsage.registerBackendImpact( |
| 2237 transformed, impacts.stringLiteral); |
| 2223 break; | 2238 break; |
| 2224 default: | 2239 default: |
| 2225 assert(invariant(NO_LOCATION_SPANNABLE, false, | 2240 assert(invariant(NO_LOCATION_SPANNABLE, false, |
| 2226 message: "Unexpected constant literal: ${constant.kind}.")); | 2241 message: "Unexpected constant literal: ${constant.kind}.")); |
| 2227 } | 2242 } |
| 2228 } | 2243 } |
| 2229 | 2244 |
| 2230 for (native.NativeBehavior behavior in worldImpact.nativeData) { | 2245 for (native.NativeBehavior behavior in worldImpact.nativeData) { |
| 2231 enqueuer.nativeEnqueuer | 2246 enqueuer.nativeEnqueuer |
| 2232 .registerNativeBehavior(transformed, behavior, worldImpact); | 2247 .registerNativeBehavior(transformed, behavior, worldImpact); |
| 2233 } | 2248 } |
| 2234 | 2249 |
| 2235 return transformed; | 2250 return transformed; |
| 2236 } | 2251 } |
| 2237 | 2252 |
| 2238 WorldImpact createImpactFor(BackendImpact impact) { | |
| 2239 WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl(); | |
| 2240 registerBackendImpact(impactBuilder, impact); | |
| 2241 return impactBuilder; | |
| 2242 } | |
| 2243 | |
| 2244 void registerBackendStaticUse( | |
| 2245 WorldImpactBuilder worldImpact, MethodElement element, | |
| 2246 {bool isGlobal: false}) { | |
| 2247 backend.backendUsage.registerBackendUse(element); | |
| 2248 worldImpact.registerStaticUse( | |
| 2249 // TODO(johnniwinther): Store the correct use in impacts. | |
| 2250 new StaticUse.foreignUse(element)); | |
| 2251 if (isGlobal) { | |
| 2252 backend.compiler.globalDependencies.registerDependency(element); | |
| 2253 } | |
| 2254 } | |
| 2255 | |
| 2256 void registerBackendInstantiation( | |
| 2257 WorldImpactBuilder worldImpact, ClassElement cls, | |
| 2258 {bool isGlobal: false}) { | |
| 2259 cls.ensureResolved(backend.resolution); | |
| 2260 backend.backendUsage.registerBackendUse(cls); | |
| 2261 worldImpact.registerTypeUse(new TypeUse.instantiation(cls.rawType)); | |
| 2262 if (isGlobal) { | |
| 2263 backend.compiler.globalDependencies.registerDependency(cls); | |
| 2264 } | |
| 2265 } | |
| 2266 | |
| 2267 void registerBackendImpact( | |
| 2268 WorldImpactBuilder worldImpact, BackendImpact backendImpact) { | |
| 2269 for (Element staticUse in backendImpact.staticUses) { | |
| 2270 assert(staticUse != null); | |
| 2271 registerBackendStaticUse(worldImpact, staticUse); | |
| 2272 } | |
| 2273 for (Element staticUse in backendImpact.globalUses) { | |
| 2274 assert(staticUse != null); | |
| 2275 registerBackendStaticUse(worldImpact, staticUse, isGlobal: true); | |
| 2276 } | |
| 2277 for (Selector selector in backendImpact.dynamicUses) { | |
| 2278 assert(selector != null); | |
| 2279 worldImpact.registerDynamicUse(new DynamicUse(selector, null)); | |
| 2280 } | |
| 2281 for (ResolutionInterfaceType instantiatedType | |
| 2282 in backendImpact.instantiatedTypes) { | |
| 2283 backend.backendUsage.registerBackendUse(instantiatedType.element); | |
| 2284 worldImpact.registerTypeUse(new TypeUse.instantiation(instantiatedType)); | |
| 2285 } | |
| 2286 for (ClassElement cls in backendImpact.instantiatedClasses) { | |
| 2287 registerBackendInstantiation(worldImpact, cls); | |
| 2288 } | |
| 2289 for (ClassElement cls in backendImpact.globalClasses) { | |
| 2290 registerBackendInstantiation(worldImpact, cls, isGlobal: true); | |
| 2291 } | |
| 2292 for (BackendImpact otherImpact in backendImpact.otherImpacts) { | |
| 2293 registerBackendImpact(worldImpact, otherImpact); | |
| 2294 } | |
| 2295 for (BackendFeature feature in backendImpact.features) { | |
| 2296 switch (feature) { | |
| 2297 case BackendFeature.needToInitializeDispatchProperty: | |
| 2298 backend.backendUsage.needToInitializeDispatchProperty = true; | |
| 2299 break; | |
| 2300 case BackendFeature.needToInitializeIsolateAffinityTag: | |
| 2301 backend.backendUsage.needToInitializeIsolateAffinityTag = true; | |
| 2302 break; | |
| 2303 } | |
| 2304 } | |
| 2305 } | |
| 2306 | |
| 2307 /// Register [type] as required for the runtime type information system. | 2253 /// Register [type] as required for the runtime type information system. |
| 2308 void registerRequiredType(ResolutionDartType type) { | 2254 void registerRequiredType(ResolutionDartType type) { |
| 2309 if (!type.isInterfaceType) return; | 2255 if (!type.isInterfaceType) return; |
| 2310 // If [argument] has type variables or is a type variable, this method | 2256 // If [argument] has type variables or is a type variable, this method |
| 2311 // registers a RTI dependency between the class where the type variable is | 2257 // registers a RTI dependency between the class where the type variable is |
| 2312 // defined (that is the enclosing class of the current element being | 2258 // defined (that is the enclosing class of the current element being |
| 2313 // resolved) and the class of [type]. If the class of [type] requires RTI, | 2259 // resolved) and the class of [type]. If the class of [type] requires RTI, |
| 2314 // then the class of the type variable does too. | 2260 // then the class of the type variable does too. |
| 2315 ClassElement contextClass = Types.getClassContext(type); | 2261 ClassElement contextClass = Types.getClassContext(type); |
| 2316 if (contextClass != null) { | 2262 if (contextClass != null) { |
| 2317 backend.rti.registerRtiDependency(type.element, contextClass); | 2263 backend.rti.registerRtiDependency(type.element, contextClass); |
| 2318 } | 2264 } |
| 2319 } | 2265 } |
| 2320 | 2266 |
| 2321 // TODO(johnniwinther): Maybe split this into [onAssertType] and [onTestType]. | 2267 // TODO(johnniwinther): Maybe split this into [onAssertType] and [onTestType]. |
| 2322 void onIsCheck(ResolutionDartType type, TransformedWorldImpact transformed) { | 2268 void onIsCheck(ResolutionDartType type, TransformedWorldImpact transformed) { |
| 2323 registerRequiredType(type); | 2269 registerRequiredType(type); |
| 2324 type.computeUnaliased(backend.resolution); | 2270 type.computeUnaliased(backend.resolution); |
| 2325 type = type.unaliased; | 2271 type = type.unaliased; |
| 2326 registerBackendImpact(transformed, impacts.typeCheck); | 2272 backendUsage.registerBackendImpact(transformed, impacts.typeCheck); |
| 2327 | 2273 |
| 2328 bool inCheckedMode = backend.compiler.options.enableTypeAssertions; | 2274 bool inCheckedMode = backend.compiler.options.enableTypeAssertions; |
| 2329 if (inCheckedMode) { | 2275 if (inCheckedMode) { |
| 2330 registerBackendImpact(transformed, impacts.checkedModeTypeCheck); | 2276 backendUsage.registerBackendImpact( |
| 2277 transformed, impacts.checkedModeTypeCheck); |
| 2331 } | 2278 } |
| 2332 if (type.isMalformed) { | 2279 if (type.isMalformed) { |
| 2333 registerBackendImpact(transformed, impacts.malformedTypeCheck); | 2280 backendUsage.registerBackendImpact( |
| 2281 transformed, impacts.malformedTypeCheck); |
| 2334 } | 2282 } |
| 2335 if (!type.treatAsRaw || type.containsTypeVariables || type.isFunctionType) { | 2283 if (!type.treatAsRaw || type.containsTypeVariables || type.isFunctionType) { |
| 2336 registerBackendImpact(transformed, impacts.genericTypeCheck); | 2284 backendUsage.registerBackendImpact(transformed, impacts.genericTypeCheck); |
| 2337 if (inCheckedMode) { | 2285 if (inCheckedMode) { |
| 2338 registerBackendImpact(transformed, impacts.genericCheckedModeTypeCheck); | 2286 backendUsage.registerBackendImpact( |
| 2287 transformed, impacts.genericCheckedModeTypeCheck); |
| 2339 } | 2288 } |
| 2340 if (type.isTypeVariable) { | 2289 if (type.isTypeVariable) { |
| 2341 registerBackendImpact(transformed, impacts.typeVariableTypeCheck); | 2290 backendUsage.registerBackendImpact( |
| 2291 transformed, impacts.typeVariableTypeCheck); |
| 2342 if (inCheckedMode) { | 2292 if (inCheckedMode) { |
| 2343 registerBackendImpact( | 2293 backendUsage.registerBackendImpact( |
| 2344 transformed, impacts.typeVariableCheckedModeTypeCheck); | 2294 transformed, impacts.typeVariableCheckedModeTypeCheck); |
| 2345 } | 2295 } |
| 2346 } | 2296 } |
| 2347 } | 2297 } |
| 2348 if (type is ResolutionFunctionType) { | 2298 if (type is ResolutionFunctionType) { |
| 2349 registerBackendImpact(transformed, impacts.functionTypeCheck); | 2299 backendUsage.registerBackendImpact( |
| 2300 transformed, impacts.functionTypeCheck); |
| 2350 } | 2301 } |
| 2351 if (type.element != null && backend.isNative(type.element)) { | 2302 if (type.element != null && backend.isNative(type.element)) { |
| 2352 registerBackendImpact(transformed, impacts.nativeTypeCheck); | 2303 backendUsage.registerBackendImpact(transformed, impacts.nativeTypeCheck); |
| 2353 } | 2304 } |
| 2354 } | 2305 } |
| 2355 | 2306 |
| 2356 void onIsCheckForCodegen( | 2307 void onIsCheckForCodegen( |
| 2357 ResolutionDartType type, TransformedWorldImpact transformed) { | 2308 ResolutionDartType type, TransformedWorldImpact transformed) { |
| 2358 if (type.isDynamic) return; | 2309 if (type.isDynamic) return; |
| 2359 type = type.unaliased; | 2310 type = type.unaliased; |
| 2360 registerBackendImpact(transformed, impacts.typeCheck); | 2311 backendUsage.registerBackendImpact(transformed, impacts.typeCheck); |
| 2361 | 2312 |
| 2362 bool inCheckedMode = backend.compiler.options.enableTypeAssertions; | 2313 bool inCheckedMode = backend.compiler.options.enableTypeAssertions; |
| 2363 // [registerIsCheck] is also called for checked mode checks, so we | 2314 // [registerIsCheck] is also called for checked mode checks, so we |
| 2364 // need to register checked mode helpers. | 2315 // need to register checked mode helpers. |
| 2365 if (inCheckedMode) { | 2316 if (inCheckedMode) { |
| 2366 // All helpers are added to resolution queue in enqueueHelpers. These | 2317 // All helpers are added to resolution queue in enqueueHelpers. These |
| 2367 // calls to [enqueue] with the resolution enqueuer serve as assertions | 2318 // calls to [enqueue] with the resolution enqueuer serve as assertions |
| 2368 // that the helper was in fact added. | 2319 // that the helper was in fact added. |
| 2369 // TODO(13155): Find a way to enqueue helpers lazily. | 2320 // TODO(13155): Find a way to enqueue helpers lazily. |
| 2370 CheckedModeHelper helper = backend.checkedModeHelpers | 2321 CheckedModeHelper helper = backend.checkedModeHelpers |
| 2371 .getCheckedModeHelper(type, typeCast: false); | 2322 .getCheckedModeHelper(type, typeCast: false); |
| 2372 if (helper != null) { | 2323 if (helper != null) { |
| 2373 StaticUse staticUse = helper.getStaticUse(backend.helpers); | 2324 StaticUse staticUse = helper.getStaticUse(backend.helpers); |
| 2374 transformed.registerStaticUse(staticUse); | 2325 transformed.registerStaticUse(staticUse); |
| 2375 backend.backendUsage.registerBackendUse(staticUse.element); | 2326 backend.backendUsage.registerBackendUse(staticUse.element); |
| 2376 } | 2327 } |
| 2377 // We also need the native variant of the check (for DOM types). | 2328 // We also need the native variant of the check (for DOM types). |
| 2378 helper = backend.checkedModeHelpers | 2329 helper = backend.checkedModeHelpers |
| 2379 .getNativeCheckedModeHelper(type, typeCast: false); | 2330 .getNativeCheckedModeHelper(type, typeCast: false); |
| 2380 if (helper != null) { | 2331 if (helper != null) { |
| 2381 StaticUse staticUse = helper.getStaticUse(backend.helpers); | 2332 StaticUse staticUse = helper.getStaticUse(backend.helpers); |
| 2382 transformed.registerStaticUse(staticUse); | 2333 transformed.registerStaticUse(staticUse); |
| 2383 backend.backendUsage.registerBackendUse(staticUse.element); | 2334 backend.backendUsage.registerBackendUse(staticUse.element); |
| 2384 } | 2335 } |
| 2385 } | 2336 } |
| 2386 if (!type.treatAsRaw || type.containsTypeVariables) { | 2337 if (!type.treatAsRaw || type.containsTypeVariables) { |
| 2387 registerBackendImpact(transformed, impacts.genericIsCheck); | 2338 backendUsage.registerBackendImpact(transformed, impacts.genericIsCheck); |
| 2388 } | 2339 } |
| 2389 if (type.element != null && backend.isNative(type.element)) { | 2340 if (type.element != null && backend.isNative(type.element)) { |
| 2390 // We will neeed to add the "$is" and "$as" properties on the | 2341 // We will neeed to add the "$is" and "$as" properties on the |
| 2391 // JavaScript object prototype, so we make sure | 2342 // JavaScript object prototype, so we make sure |
| 2392 // [:defineProperty:] is compiled. | 2343 // [:defineProperty:] is compiled. |
| 2393 registerBackendImpact(transformed, impacts.nativeTypeCheck); | 2344 backendUsage.registerBackendImpact(transformed, impacts.nativeTypeCheck); |
| 2394 } | 2345 } |
| 2395 } | 2346 } |
| 2396 | 2347 |
| 2397 @override | 2348 @override |
| 2398 WorldImpact transformCodegenImpact(CodegenImpact impact) { | 2349 WorldImpact transformCodegenImpact(CodegenImpact impact) { |
| 2399 TransformedWorldImpact transformed = new TransformedWorldImpact(impact); | 2350 TransformedWorldImpact transformed = new TransformedWorldImpact(impact); |
| 2400 | 2351 |
| 2401 for (TypeUse typeUse in impact.typeUses) { | 2352 for (TypeUse typeUse in impact.typeUses) { |
| 2402 ResolutionDartType type = typeUse.type; | 2353 ResolutionDartType type = typeUse.type; |
| 2403 switch (typeUse.kind) { | 2354 switch (typeUse.kind) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2419 for (Pair<ResolutionDartType, ResolutionDartType> check | 2370 for (Pair<ResolutionDartType, ResolutionDartType> check |
| 2420 in impact.typeVariableBoundsSubtypeChecks) { | 2371 in impact.typeVariableBoundsSubtypeChecks) { |
| 2421 backend.registerTypeVariableBoundsSubtypeCheck(check.a, check.b); | 2372 backend.registerTypeVariableBoundsSubtypeCheck(check.a, check.b); |
| 2422 } | 2373 } |
| 2423 | 2374 |
| 2424 for (StaticUse staticUse in impact.staticUses) { | 2375 for (StaticUse staticUse in impact.staticUses) { |
| 2425 switch (staticUse.kind) { | 2376 switch (staticUse.kind) { |
| 2426 case StaticUseKind.CLOSURE: | 2377 case StaticUseKind.CLOSURE: |
| 2427 LocalFunctionElement closure = staticUse.element; | 2378 LocalFunctionElement closure = staticUse.element; |
| 2428 if (backend.methodNeedsRti(closure)) { | 2379 if (backend.methodNeedsRti(closure)) { |
| 2429 registerBackendImpact(transformed, impacts.computeSignature); | 2380 backendUsage.registerBackendImpact( |
| 2381 transformed, impacts.computeSignature); |
| 2430 } | 2382 } |
| 2431 break; | 2383 break; |
| 2432 case StaticUseKind.CONST_CONSTRUCTOR_INVOKE: | 2384 case StaticUseKind.CONST_CONSTRUCTOR_INVOKE: |
| 2433 case StaticUseKind.CONSTRUCTOR_INVOKE: | 2385 case StaticUseKind.CONSTRUCTOR_INVOKE: |
| 2434 backend.lookupMapAnalysis.registerInstantiatedType(staticUse.type); | 2386 backend.lookupMapAnalysis.registerInstantiatedType(staticUse.type); |
| 2435 break; | 2387 break; |
| 2436 default: | 2388 default: |
| 2437 } | 2389 } |
| 2438 } | 2390 } |
| 2439 | 2391 |
| 2440 for (String name in impact.constSymbols) { | 2392 for (String name in impact.constSymbols) { |
| 2441 backend.mirrorsData.registerConstSymbol(name); | 2393 backend.mirrorsData.registerConstSymbol(name); |
| 2442 } | 2394 } |
| 2443 | 2395 |
| 2444 for (Set<ClassElement> classes in impact.specializedGetInterceptors) { | 2396 for (Set<ClassElement> classes in impact.specializedGetInterceptors) { |
| 2445 backend.interceptorData | 2397 backend.interceptorData |
| 2446 .registerSpecializedGetInterceptor(classes, backend.namer); | 2398 .registerSpecializedGetInterceptor(classes, backend.namer); |
| 2447 } | 2399 } |
| 2448 | 2400 |
| 2449 if (impact.usesInterceptor) { | 2401 if (impact.usesInterceptor) { |
| 2450 if (backend.codegenEnqueuer.nativeEnqueuer.hasInstantiatedNativeClasses) { | 2402 if (backend.codegenEnqueuer.nativeEnqueuer.hasInstantiatedNativeClasses) { |
| 2451 registerBackendImpact(transformed, impacts.interceptorUse); | 2403 backendUsage.registerBackendImpact(transformed, impacts.interceptorUse); |
| 2452 } | 2404 } |
| 2453 } | 2405 } |
| 2454 | 2406 |
| 2455 for (ClassElement element in impact.typeConstants) { | 2407 for (ClassElement element in impact.typeConstants) { |
| 2456 backend.customElementsAnalysis.registerTypeConstant(element); | 2408 backend.customElementsAnalysis.registerTypeConstant(element); |
| 2457 backend.lookupMapAnalysis.registerTypeConstant(element); | 2409 backend.lookupMapAnalysis.registerTypeConstant(element); |
| 2458 } | 2410 } |
| 2459 | 2411 |
| 2460 for (FunctionElement element in impact.asyncMarkers) { | 2412 for (FunctionElement element in impact.asyncMarkers) { |
| 2461 switch (element.asyncMarker) { | 2413 switch (element.asyncMarker) { |
| 2462 case AsyncMarker.ASYNC: | 2414 case AsyncMarker.ASYNC: |
| 2463 registerBackendImpact(transformed, impacts.asyncBody); | 2415 backendUsage.registerBackendImpact(transformed, impacts.asyncBody); |
| 2464 break; | 2416 break; |
| 2465 case AsyncMarker.SYNC_STAR: | 2417 case AsyncMarker.SYNC_STAR: |
| 2466 registerBackendImpact(transformed, impacts.syncStarBody); | 2418 backendUsage.registerBackendImpact(transformed, impacts.syncStarBody); |
| 2467 break; | 2419 break; |
| 2468 case AsyncMarker.ASYNC_STAR: | 2420 case AsyncMarker.ASYNC_STAR: |
| 2469 registerBackendImpact(transformed, impacts.asyncStarBody); | 2421 backendUsage.registerBackendImpact( |
| 2422 transformed, impacts.asyncStarBody); |
| 2470 break; | 2423 break; |
| 2471 } | 2424 } |
| 2472 } | 2425 } |
| 2473 | 2426 |
| 2474 // TODO(johnniwinther): Remove eager registration. | 2427 // TODO(johnniwinther): Remove eager registration. |
| 2475 return transformed; | 2428 return transformed; |
| 2476 } | 2429 } |
| 2477 } | 2430 } |
| 2478 | 2431 |
| 2479 /// Records that [constant] is used by the element behind [registry]. | 2432 /// Records that [constant] is used by the element behind [registry]. |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2608 } | 2561 } |
| 2609 | 2562 |
| 2610 @override | 2563 @override |
| 2611 FieldEntity get symbolField => helpers.symbolImplementationField; | 2564 FieldEntity get symbolField => helpers.symbolImplementationField; |
| 2612 | 2565 |
| 2613 @override | 2566 @override |
| 2614 InterfaceType get symbolType { | 2567 InterfaceType get symbolType { |
| 2615 return _env.getRawType(helpers.symbolImplementationClass); | 2568 return _env.getRawType(helpers.symbolImplementationClass); |
| 2616 } | 2569 } |
| 2617 } | 2570 } |
| OLD | NEW |