Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: pkg/compiler/lib/src/js_backend/backend.dart

Issue 2392943003: Handle const constructor invocation in kernel_impact. (Closed)
Patch Set: Updated cf. comments. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/compiler/lib/src/enqueue.dart ('k') | pkg/compiler/lib/src/js_backend/enqueuer.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2933 matching lines...) Expand 10 before | Expand all | Expand 10 after
2944 } 2944 }
2945 2945
2946 if (worldImpact.constSymbolNames.isNotEmpty) { 2946 if (worldImpact.constSymbolNames.isNotEmpty) {
2947 registerBackendImpact(transformed, impacts.constSymbol); 2947 registerBackendImpact(transformed, impacts.constSymbol);
2948 for (String constSymbolName in worldImpact.constSymbolNames) { 2948 for (String constSymbolName in worldImpact.constSymbolNames) {
2949 backend.registerConstSymbol(constSymbolName); 2949 backend.registerConstSymbol(constSymbolName);
2950 } 2950 }
2951 } 2951 }
2952 2952
2953 for (StaticUse staticUse in worldImpact.staticUses) { 2953 for (StaticUse staticUse in worldImpact.staticUses) {
2954 if (staticUse.kind == StaticUseKind.CLOSURE) { 2954 switch (staticUse.kind) {
2955 registerBackendImpact(transformed, impacts.closure); 2955 case StaticUseKind.CLOSURE:
2956 LocalFunctionElement closure = staticUse.element; 2956 registerBackendImpact(transformed, impacts.closure);
2957 if (closure.type.containsTypeVariables) { 2957 LocalFunctionElement closure = staticUse.element;
2958 resolutionEnqueuer.universe.closuresWithFreeTypeVariables 2958 if (closure.type.containsTypeVariables) {
2959 .add(closure); 2959 resolutionEnqueuer.universe.closuresWithFreeTypeVariables
2960 registerBackendImpact(transformed, impacts.computeSignature); 2960 .add(closure);
2961 } 2961 registerBackendImpact(transformed, impacts.computeSignature);
2962 }
2963 break;
2964 case StaticUseKind.CONST_CONSTRUCTOR_INVOKE:
2965 case StaticUseKind.CONSTRUCTOR_INVOKE:
2966 registerRequiredType(staticUse.type);
2967 break;
2968 default:
2962 } 2969 }
2963 } 2970 }
2964 2971
2965 for (ConstantExpression constant in worldImpact.constantLiterals) { 2972 for (ConstantExpression constant in worldImpact.constantLiterals) {
2966 switch (constant.kind) { 2973 switch (constant.kind) {
2967 case ConstantExpressionKind.NULL: 2974 case ConstantExpressionKind.NULL:
2968 registerBackendImpact(transformed, impacts.nullLiteral); 2975 registerBackendImpact(transformed, impacts.nullLiteral);
2969 break; 2976 break;
2970 case ConstantExpressionKind.BOOL: 2977 case ConstantExpressionKind.BOOL:
2971 registerBackendImpact(transformed, impacts.boolLiteral); 2978 registerBackendImpact(transformed, impacts.boolLiteral);
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
3137 backend.computeImpactForCompileTimeConstant(constant, transformed, false); 3144 backend.computeImpactForCompileTimeConstant(constant, transformed, false);
3138 backend.addCompileTimeConstantForEmission(constant); 3145 backend.addCompileTimeConstantForEmission(constant);
3139 } 3146 }
3140 3147
3141 for (Pair<DartType, DartType> check 3148 for (Pair<DartType, DartType> check
3142 in impact.typeVariableBoundsSubtypeChecks) { 3149 in impact.typeVariableBoundsSubtypeChecks) {
3143 backend.registerTypeVariableBoundsSubtypeCheck(check.a, check.b); 3150 backend.registerTypeVariableBoundsSubtypeCheck(check.a, check.b);
3144 } 3151 }
3145 3152
3146 for (StaticUse staticUse in impact.staticUses) { 3153 for (StaticUse staticUse in impact.staticUses) {
3147 if (staticUse.kind == StaticUseKind.CLOSURE) { 3154 switch (staticUse.kind) {
3148 LocalFunctionElement closure = staticUse.element; 3155 case StaticUseKind.CLOSURE:
3149 if (backend.methodNeedsRti(closure)) { 3156 LocalFunctionElement closure = staticUse.element;
3150 registerBackendImpact(transformed, impacts.computeSignature); 3157 if (backend.methodNeedsRti(closure)) {
3151 } 3158 registerBackendImpact(transformed, impacts.computeSignature);
3159 }
3160 break;
3161 case StaticUseKind.CONST_CONSTRUCTOR_INVOKE:
3162 case StaticUseKind.CONSTRUCTOR_INVOKE:
3163 backend.lookupMapAnalysis.registerInstantiatedType(staticUse.type);
3164 break;
3165 default:
3152 } 3166 }
3153 } 3167 }
3154 3168
3155 for (String name in impact.constSymbols) { 3169 for (String name in impact.constSymbols) {
3156 backend.registerConstSymbol(name); 3170 backend.registerConstSymbol(name);
3157 } 3171 }
3158 3172
3159 for (Set<ClassElement> classes in impact.specializedGetInterceptors) { 3173 for (Set<ClassElement> classes in impact.specializedGetInterceptors) {
3160 backend.registerSpecializedGetInterceptor(classes); 3174 backend.registerSpecializedGetInterceptor(classes);
3161 } 3175 }
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
3265 ClassElement get mapImplementation => helpers.mapLiteralClass; 3279 ClassElement get mapImplementation => helpers.mapLiteralClass;
3266 ClassElement get constMapImplementation => helpers.constMapLiteralClass; 3280 ClassElement get constMapImplementation => helpers.constMapLiteralClass;
3267 ClassElement get typeImplementation => helpers.typeLiteralClass; 3281 ClassElement get typeImplementation => helpers.typeLiteralClass;
3268 ClassElement get boolImplementation => helpers.jsBoolClass; 3282 ClassElement get boolImplementation => helpers.jsBoolClass;
3269 ClassElement get nullImplementation => helpers.jsNullClass; 3283 ClassElement get nullImplementation => helpers.jsNullClass;
3270 ClassElement get syncStarIterableImplementation => helpers.syncStarIterable; 3284 ClassElement get syncStarIterableImplementation => helpers.syncStarIterable;
3271 ClassElement get asyncFutureImplementation => helpers.futureImplementation; 3285 ClassElement get asyncFutureImplementation => helpers.futureImplementation;
3272 ClassElement get asyncStarStreamImplementation => helpers.controllerStream; 3286 ClassElement get asyncStarStreamImplementation => helpers.controllerStream;
3273 ClassElement get functionImplementation => helpers.coreClasses.functionClass; 3287 ClassElement get functionImplementation => helpers.coreClasses.functionClass;
3274 } 3288 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/enqueue.dart ('k') | pkg/compiler/lib/src/js_backend/enqueuer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698