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

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

Issue 1438453002: Use Feature directly in resolution. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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
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 part of js_backend; 5 part of js_backend;
6 6
7 const VERBOSE_OPTIMIZER_HINTS = false; 7 const VERBOSE_OPTIMIZER_HINTS = false;
8 8
9 class JavaScriptItemCompilationContext extends ItemCompilationContext { 9 class JavaScriptItemCompilationContext extends ItemCompilationContext {
10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); 10 final Set<HInstruction> boundsChecked = new Set<HInstruction>();
(...skipping 2725 matching lines...) Expand 10 before | Expand all | Expand 10 after
2736 break; 2736 break;
2737 case Feature.LAZY_FIELD: 2737 case Feature.LAZY_FIELD:
2738 registerBackendImpact(transformed, impacts.lazyField); 2738 registerBackendImpact(transformed, impacts.lazyField);
2739 break; 2739 break;
2740 case Feature.STACK_TRACE_IN_CATCH: 2740 case Feature.STACK_TRACE_IN_CATCH:
2741 registerBackendImpact(transformed, impacts.stackTraceInCatch); 2741 registerBackendImpact(transformed, impacts.stackTraceInCatch);
2742 break; 2742 break;
2743 case Feature.STRING_INTERPOLATION: 2743 case Feature.STRING_INTERPOLATION:
2744 registerBackendImpact(transformed, impacts.stringInterpolation); 2744 registerBackendImpact(transformed, impacts.stringInterpolation);
2745 break; 2745 break;
2746 case Feature.STRING_JUXTAPOSITION:
2747 registerBackendImpact(transformed, impacts.stringJuxtaposition);
2748 break;
2746 case Feature.SUPER_NO_SUCH_METHOD: 2749 case Feature.SUPER_NO_SUCH_METHOD:
2747 registerBackendImpact(transformed, impacts.superNoSuchMethod); 2750 registerBackendImpact(transformed, impacts.superNoSuchMethod);
2748 break; 2751 break;
2749 case Feature.SYMBOL_CONSTRUCTOR: 2752 case Feature.SYMBOL_CONSTRUCTOR:
2750 registerBackendImpact(transformed, impacts.symbolConstructor); 2753 registerBackendImpact(transformed, impacts.symbolConstructor);
2751 break; 2754 break;
2752 case Feature.SYNC_FOR_IN: 2755 case Feature.SYNC_FOR_IN:
2753 registerBackendImpact(transformed, impacts.syncForIn); 2756 registerBackendImpact(transformed, impacts.syncForIn);
2754 break; 2757 break;
2755 case Feature.SYNC_STAR: 2758 case Feature.SYNC_STAR:
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
2849 registerBackendImpact(transformed, impacts.closure); 2852 registerBackendImpact(transformed, impacts.closure);
2850 for (LocalFunctionElement closure in worldImpact.closures) { 2853 for (LocalFunctionElement closure in worldImpact.closures) {
2851 if (closure.computeType(backend.resolution).containsTypeVariables) { 2854 if (closure.computeType(backend.resolution).containsTypeVariables) {
2852 backend.compiler.enqueuer.resolution.universe 2855 backend.compiler.enqueuer.resolution.universe
2853 .closuresWithFreeTypeVariables.add(closure); 2856 .closuresWithFreeTypeVariables.add(closure);
2854 registerBackendImpact(transformed, impacts.computeSignature); 2857 registerBackendImpact(transformed, impacts.computeSignature);
2855 } 2858 }
2856 } 2859 }
2857 } 2860 }
2858 2861
2862 for (ConstantExpression constant in worldImpact.constantLiterals) {
2863 switch (constant.kind) {
2864 case ConstantExpressionKind.NULL:
2865 registerBackendImpact(transformed, impacts.nullLiteral);
2866 break;
2867 case ConstantExpressionKind.BOOL:
2868 registerBackendImpact(transformed, impacts.boolLiteral);
2869 break;
2870 case ConstantExpressionKind.INT:
2871 registerBackendImpact(transformed, impacts.intLiteral);
2872 break;
2873 case ConstantExpressionKind.DOUBLE:
2874 registerBackendImpact(transformed, impacts.doubleLiteral);
2875 break;
2876 case ConstantExpressionKind.STRING:
2877 registerBackendImpact(transformed, impacts.stringLiteral);
2878 break;
2879 default:
2880 assert(invariant(NO_LOCATION_SPANNABLE, false,
2881 message: "Unexpected constant literal: ${constant.kind}."));
2882 }
2883 }
2884
2859 return transformed; 2885 return transformed;
2860 } 2886 }
2861 2887
2862 void registerBackendImpact(TransformedWorldImpact worldImpact, 2888 void registerBackendImpact(TransformedWorldImpact worldImpact,
2863 BackendImpact backendImpact) { 2889 BackendImpact backendImpact) {
2864 for (Element staticUse in backendImpact.staticUses) { 2890 for (Element staticUse in backendImpact.staticUses) {
2865 assert(staticUse != null); 2891 assert(staticUse != null);
2866 backend.registerBackendUse(staticUse); 2892 backend.registerBackendUse(staticUse);
2867 worldImpact.registerStaticUse( 2893 worldImpact.registerStaticUse(
2868 // TODO(johnniwinther): Store the correct use in impacts. 2894 // TODO(johnniwinther): Store the correct use in impacts.
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
3041 } 3067 }
3042 } 3068 }
3043 3069
3044 /// Records that [constant] is used by the element behind [registry]. 3070 /// Records that [constant] is used by the element behind [registry].
3045 class Dependency { 3071 class Dependency {
3046 final ConstantValue constant; 3072 final ConstantValue constant;
3047 final Element annotatedElement; 3073 final Element annotatedElement;
3048 3074
3049 const Dependency(this.constant, this.annotatedElement); 3075 const Dependency(this.constant, this.annotatedElement);
3050 } 3076 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/dart_backend/backend.dart ('k') | pkg/compiler/lib/src/js_backend/backend_impact.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698