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

Side by Side Diff: pkg/compiler/lib/src/enqueue.dart

Issue 1803303002: Move all flags to CompilerOptions (first step to stop passing the compiler to (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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
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 dart2js.enqueue; 5 library dart2js.enqueue;
6 6
7 import 'dart:collection' show 7 import 'dart:collection' show
8 Queue; 8 Queue;
9 9
10 import 'common.dart'; 10 import 'common.dart';
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 class EnqueueTask extends CompilerTask { 70 class EnqueueTask extends CompilerTask {
71 final ResolutionEnqueuer resolution; 71 final ResolutionEnqueuer resolution;
72 final CodegenEnqueuer codegen; 72 final CodegenEnqueuer codegen;
73 73
74 String get name => 'Enqueue'; 74 String get name => 'Enqueue';
75 75
76 EnqueueTask(Compiler compiler) 76 EnqueueTask(Compiler compiler)
77 : resolution = new ResolutionEnqueuer( 77 : resolution = new ResolutionEnqueuer(
78 compiler, compiler.backend.createItemCompilationContext, 78 compiler, compiler.backend.createItemCompilationContext,
79 compiler.analyzeOnly && compiler.analyzeMain 79 compiler.options.analyzeOnly && compiler.options.analyzeMain
80 ? const EnqueuerStrategy() : const TreeShakingEnqueuerStrategy()), 80 ? const EnqueuerStrategy() : const TreeShakingEnqueuerStrategy()),
81 codegen = new CodegenEnqueuer( 81 codegen = new CodegenEnqueuer(
82 compiler, compiler.backend.createItemCompilationContext, 82 compiler, compiler.backend.createItemCompilationContext,
83 const TreeShakingEnqueuerStrategy()), 83 const TreeShakingEnqueuerStrategy()),
84 super(compiler) { 84 super(compiler) {
85 codegen.task = this; 85 codegen.task = this;
86 resolution.task = this; 86 resolution.task = this;
87 87
88 codegen.nativeEnqueuer = compiler.backend.nativeCodegenEnqueuer(codegen); 88 codegen.nativeEnqueuer = compiler.backend.nativeCodegenEnqueuer(codegen);
89 resolution.nativeEnqueuer = 89 resolution.nativeEnqueuer =
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 150
151 ImpactUseCase get impactUse; 151 ImpactUseCase get impactUse;
152 152
153 /** 153 /**
154 * Documentation wanted -- johnniwinther 154 * Documentation wanted -- johnniwinther
155 * 155 *
156 * Invariant: [element] must be a declaration element. 156 * Invariant: [element] must be a declaration element.
157 */ 157 */
158 void addToWorkList(Element element) { 158 void addToWorkList(Element element) {
159 assert(invariant(element, element.isDeclaration)); 159 assert(invariant(element, element.isDeclaration));
160 if (internalAddToWorkList(element) && compiler.dumpInfo) { 160 if (internalAddToWorkList(element) && compiler.options.dumpInfo) {
161 // TODO(sigmund): add other missing dependencies (internals, selectors 161 // TODO(sigmund): add other missing dependencies (internals, selectors
162 // enqueued after allocations), also enable only for the codegen enqueuer. 162 // enqueued after allocations), also enable only for the codegen enqueuer.
163 compiler.dumpInfoTask.registerDependency( 163 compiler.dumpInfoTask.registerDependency(
164 compiler.currentElement, element); 164 compiler.currentElement, element);
165 } 165 }
166 } 166 }
167 167
168 /** 168 /**
169 * Adds [element] to the work list if it has not already been processed. 169 * Adds [element] to the work list if it has not already been processed.
170 * 170 *
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 case TypeUseKind.INSTANTIATION: 656 case TypeUseKind.INSTANTIATION:
657 registerInstantiatedType(type); 657 registerInstantiatedType(type);
658 break; 658 break;
659 case TypeUseKind.INSTANTIATION: 659 case TypeUseKind.INSTANTIATION:
660 case TypeUseKind.IS_CHECK: 660 case TypeUseKind.IS_CHECK:
661 case TypeUseKind.AS_CAST: 661 case TypeUseKind.AS_CAST:
662 case TypeUseKind.CATCH_TYPE: 662 case TypeUseKind.CATCH_TYPE:
663 _registerIsCheck(type); 663 _registerIsCheck(type);
664 break; 664 break;
665 case TypeUseKind.CHECKED_MODE_CHECK: 665 case TypeUseKind.CHECKED_MODE_CHECK:
666 if (compiler.enableTypeAssertions) { 666 if (compiler.options.enableTypeAssertions) {
667 _registerIsCheck(type); 667 _registerIsCheck(type);
668 } 668 }
669 break; 669 break;
670 case TypeUseKind.TYPE_LITERAL: 670 case TypeUseKind.TYPE_LITERAL:
671 break; 671 break;
672 } 672 }
673 } 673 }
674 674
675 void _registerIsCheck(DartType type) { 675 void _registerIsCheck(DartType type) {
676 type = universe.registerIsCheck(type, compiler); 676 type = universe.registerIsCheck(type, compiler);
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 return compiler.backend.isAccessibleByReflection(element); 935 return compiler.backend.isAccessibleByReflection(element);
936 } 936 }
937 937
938 bool internalAddToWorkList(Element element) { 938 bool internalAddToWorkList(Element element) {
939 // Don't generate code for foreign elements. 939 // Don't generate code for foreign elements.
940 if (compiler.backend.isForeign(element)) return false; 940 if (compiler.backend.isForeign(element)) return false;
941 941
942 // Codegen inlines field initializers. It only needs to generate 942 // Codegen inlines field initializers. It only needs to generate
943 // code for checked setters. 943 // code for checked setters.
944 if (element.isField && element.isInstanceMember) { 944 if (element.isField && element.isInstanceMember) {
945 if (!compiler.enableTypeAssertions 945 if (!compiler.options.enableTypeAssertions
946 || element.enclosingElement.isClosure) { 946 || element.enclosingElement.isClosure) {
947 return false; 947 return false;
948 } 948 }
949 } 949 }
950 950
951 if (compiler.hasIncrementalSupport && !isProcessed(element)) { 951 if (compiler.options.hasIncrementalSupport && !isProcessed(element)) {
952 newlyEnqueuedElements.add(element); 952 newlyEnqueuedElements.add(element);
953 } 953 }
954 954
955 if (queueIsClosed) { 955 if (queueIsClosed) {
956 throw new SpannableAssertionFailure(element, 956 throw new SpannableAssertionFailure(element,
957 "Codegen work list is closed. Trying to add $element"); 957 "Codegen work list is closed. Trying to add $element");
958 } 958 }
959 CodegenWorkItem workItem = new CodegenWorkItem( 959 CodegenWorkItem workItem = new CodegenWorkItem(
960 compiler, element, itemCompilationContextCreator()); 960 compiler, element, itemCompilationContextCreator());
961 queue.add(workItem); 961 queue.add(workItem);
(...skipping 17 matching lines...) Expand all
979 if (element is MemberElement) { 979 if (element is MemberElement) {
980 for (Element closure in element.nestedClosures) { 980 for (Element closure in element.nestedClosures) {
981 generatedCode.remove(closure); 981 generatedCode.remove(closure);
982 removeFromSet(instanceMembersByName, closure); 982 removeFromSet(instanceMembersByName, closure);
983 removeFromSet(instanceFunctionsByName, closure); 983 removeFromSet(instanceFunctionsByName, closure);
984 } 984 }
985 } 985 }
986 } 986 }
987 987
988 void handleUnseenSelector(DynamicUse dynamicUse) { 988 void handleUnseenSelector(DynamicUse dynamicUse) {
989 if (compiler.hasIncrementalSupport) { 989 if (compiler.options.hasIncrementalSupport) {
990 newlySeenSelectors.add(dynamicUse); 990 newlySeenSelectors.add(dynamicUse);
991 } 991 }
992 super.handleUnseenSelector(dynamicUse); 992 super.handleUnseenSelector(dynamicUse);
993 } 993 }
994 } 994 }
995 995
996 /// Parameterizes filtering of which work items are enqueued. 996 /// Parameterizes filtering of which work items are enqueued.
997 class QueueFilter { 997 class QueueFilter {
998 bool checkNoEnqueuedInvokedInstanceMethods(Enqueuer enqueuer) { 998 bool checkNoEnqueuedInvokedInstanceMethods(Enqueuer enqueuer) {
999 enqueuer.task.measure(() { 999 enqueuer.task.measure(() {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 @override 1068 @override
1069 void visitStaticUse(StaticUse staticUse) { 1069 void visitStaticUse(StaticUse staticUse) {
1070 enqueuer.registerStaticUse(staticUse); 1070 enqueuer.registerStaticUse(staticUse);
1071 } 1071 }
1072 1072
1073 @override 1073 @override
1074 void visitTypeUse(TypeUse typeUse) { 1074 void visitTypeUse(TypeUse typeUse) {
1075 enqueuer.registerTypeUse(typeUse); 1075 enqueuer.registerTypeUse(typeUse);
1076 } 1076 }
1077 } 1077 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/dump_info.dart ('k') | pkg/compiler/lib/src/inferrer/inferrer_visitor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698