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

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

Issue 2668233002: Remove code supporting incremental compilation in dart2js (Closed)
Patch Set: Created 3 years, 10 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.js.enqueue; 5 library dart2js.js.enqueue;
6 6
7 import 'dart:collection' show Queue; 7 import 'dart:collection' show Queue;
8 8
9 import '../cache_strategy.dart' show CacheStrategy;
10 import '../common/backend_api.dart' show Backend; 9 import '../common/backend_api.dart' show Backend;
11 import '../common/codegen.dart' show CodegenWorkItem; 10 import '../common/codegen.dart' show CodegenWorkItem;
12 import '../common/tasks.dart' show CompilerTask; 11 import '../common/tasks.dart' show CompilerTask;
13 import '../common/work.dart' show WorkItem; 12 import '../common/work.dart' show WorkItem;
14 import '../common.dart'; 13 import '../common.dart';
15 import '../compiler.dart' show Compiler;
16 import '../elements/resolution_types.dart' 14 import '../elements/resolution_types.dart'
17 show ResolutionDartType, ResolutionInterfaceType; 15 show ResolutionDartType, ResolutionInterfaceType;
18 import '../elements/elements.dart' show MemberElement, TypedElement; 16 import '../elements/elements.dart' show MemberElement, TypedElement;
19 import '../elements/entities.dart'; 17 import '../elements/entities.dart';
20 import '../enqueue.dart'; 18 import '../enqueue.dart';
21 import '../native/native.dart' as native; 19 import '../native/native.dart' as native;
22 import '../options.dart'; 20 import '../options.dart';
23 import '../types/types.dart' show TypeMaskStrategy; 21 import '../types/types.dart' show TypeMaskStrategy;
24 import '../universe/world_builder.dart'; 22 import '../universe/world_builder.dart';
25 import '../universe/use.dart' 23 import '../universe/use.dart'
(...skipping 18 matching lines...) Expand all
44 final Backend _backend; 42 final Backend _backend;
45 final CompilerOptions _options; 43 final CompilerOptions _options;
46 44
47 WorldImpactVisitor _impactVisitor; 45 WorldImpactVisitor _impactVisitor;
48 46
49 final Queue<WorkItem> _queue = new Queue<WorkItem>(); 47 final Queue<WorkItem> _queue = new Queue<WorkItem>();
50 48
51 /// All declaration elements that have been processed by codegen. 49 /// All declaration elements that have been processed by codegen.
52 final Set<Entity> _processedEntities = new Set<Entity>(); 50 final Set<Entity> _processedEntities = new Set<Entity>();
53 51
54 final Set<Entity> newlyEnqueuedElements;
55
56 final Set<DynamicUse> newlySeenSelectors;
57
58 static const ImpactUseCase IMPACT_USE = 52 static const ImpactUseCase IMPACT_USE =
59 const ImpactUseCase('CodegenEnqueuer'); 53 const ImpactUseCase('CodegenEnqueuer');
60 54
61 CodegenEnqueuer(this.task, CacheStrategy cacheStrategy, Backend backend, 55 CodegenEnqueuer(
62 CompilerOptions options, this.strategy) 56 this.task, Backend backend, CompilerOptions options, this.strategy)
63 : _universe = 57 : _universe =
64 new CodegenWorldBuilderImpl(backend, const TypeMaskStrategy()), 58 new CodegenWorldBuilderImpl(backend, const TypeMaskStrategy()),
65 _workItemBuilder = new CodegenWorkItemBuilder(backend, options), 59 _workItemBuilder = new CodegenWorkItemBuilder(backend, options),
66 newlyEnqueuedElements = cacheStrategy.newSet(),
67 newlySeenSelectors = cacheStrategy.newSet(),
68 nativeEnqueuer = backend.nativeCodegenEnqueuer(), 60 nativeEnqueuer = backend.nativeCodegenEnqueuer(),
69 this._backend = backend, 61 this._backend = backend,
70 this._options = options, 62 this._options = options,
71 this.name = 'codegen enqueuer' { 63 this.name = 'codegen enqueuer' {
72 _impactVisitor = new EnqueuerImplImpactVisitor(this); 64 _impactVisitor = new EnqueuerImplImpactVisitor(this);
73 } 65 }
74 66
75 CodegenWorldBuilder get worldBuilder => _universe; 67 CodegenWorldBuilder get worldBuilder => _universe;
76 68
77 bool get queueIsEmpty => _queue.isEmpty; 69 bool get queueIsEmpty => _queue.isEmpty;
78 70
79 /// Returns [:true:] if this enqueuer is the resolution enqueuer. 71 /// Returns [:true:] if this enqueuer is the resolution enqueuer.
80 bool get isResolutionQueue => false; 72 bool get isResolutionQueue => false;
81 73
82 /// Create a [WorkItem] for [entity] and add it to the work list if it has not 74 /// Create a [WorkItem] for [entity] and add it to the work list if it has not
83 /// already been processed. 75 /// already been processed.
84 void _addToWorkList(MemberEntity entity) { 76 void _addToWorkList(MemberEntity entity) {
85 if (_processedEntities.contains(entity)) return; 77 if (_processedEntities.contains(entity)) return;
86 78
87 WorkItem workItem = _workItemBuilder.createWorkItem(entity); 79 WorkItem workItem = _workItemBuilder.createWorkItem(entity);
88 if (workItem == null) return; 80 if (workItem == null) return;
89 81
90 if (_options.hasIncrementalSupport) {
91 newlyEnqueuedElements.add(entity);
92 }
93
94 if (queueIsClosed) { 82 if (queueIsClosed) {
95 throw new SpannableAssertionFailure( 83 throw new SpannableAssertionFailure(
96 entity, "Codegen work list is closed. Trying to add $entity"); 84 entity, "Codegen work list is closed. Trying to add $entity");
97 } 85 }
98 86
99 applyImpact(_backend.registerUsedElement(entity, forResolution: false)); 87 applyImpact(_backend.registerUsedElement(entity, forResolution: false));
100 _queue.add(workItem); 88 _queue.add(workItem);
101 } 89 }
102 90
103 void applyImpact(WorldImpact worldImpact, {var impactSource}) { 91 void applyImpact(WorldImpact worldImpact, {var impactSource}) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 if (useSet.contains(MemberUse.CLOSURIZE_INSTANCE)) { 143 if (useSet.contains(MemberUse.CLOSURIZE_INSTANCE)) {
156 _registerClosurizedMember(member); 144 _registerClosurizedMember(member);
157 } 145 }
158 if (useSet.contains(MemberUse.CLOSURIZE_STATIC)) { 146 if (useSet.contains(MemberUse.CLOSURIZE_STATIC)) {
159 applyImpact(_backend.registerGetOfStaticFunction()); 147 applyImpact(_backend.registerGetOfStaticFunction());
160 } 148 }
161 } 149 }
162 150
163 void processDynamicUse(DynamicUse dynamicUse) { 151 void processDynamicUse(DynamicUse dynamicUse) {
164 task.measure(() { 152 task.measure(() {
165 if (_universe.registerDynamicUse(dynamicUse, _applyMemberUse)) { 153 _universe.registerDynamicUse(dynamicUse, _applyMemberUse);
166 if (_options.hasIncrementalSupport) {
167 newlySeenSelectors.add(dynamicUse);
168 }
169 }
170 }); 154 });
171 } 155 }
172 156
173 void processStaticUse(StaticUse staticUse) { 157 void processStaticUse(StaticUse staticUse) {
174 _universe.registerStaticUse(staticUse, _applyMemberUse); 158 _universe.registerStaticUse(staticUse, _applyMemberUse);
175 switch (staticUse.kind) { 159 switch (staticUse.kind) {
176 case StaticUseKind.CONSTRUCTOR_INVOKE: 160 case StaticUseKind.CONSTRUCTOR_INVOKE:
177 case StaticUseKind.CONST_CONSTRUCTOR_INVOKE: 161 case StaticUseKind.CONST_CONSTRUCTOR_INVOKE:
178 case StaticUseKind.REDIRECTION: 162 case StaticUseKind.REDIRECTION:
179 processTypeUse(new TypeUse.instantiation(staticUse.type)); 163 processTypeUse(new TypeUse.instantiation(staticUse.type));
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 241
258 void logSummary(log(message)) { 242 void logSummary(log(message)) {
259 log('Compiled ${_processedEntities.length} methods.'); 243 log('Compiled ${_processedEntities.length} methods.');
260 nativeEnqueuer.logSummary(log); 244 nativeEnqueuer.logSummary(log);
261 } 245 }
262 246
263 String toString() => 'Enqueuer($name)'; 247 String toString() => 'Enqueuer($name)';
264 248
265 ImpactUseCase get impactUse => IMPACT_USE; 249 ImpactUseCase get impactUse => IMPACT_USE;
266 250
267 void forgetEntity(Entity entity, Compiler compiler) {
268 _universe.forgetElement(entity, compiler);
269 _processedEntities.remove(entity);
270 }
271
272 @override 251 @override
273 Iterable<Entity> get processedEntities => _processedEntities; 252 Iterable<Entity> get processedEntities => _processedEntities;
274 253
275 @override 254 @override
276 Iterable<ClassEntity> get processedClasses => _universe.processedClasses; 255 Iterable<ClassEntity> get processedClasses => _universe.processedClasses;
277 } 256 }
278 257
279 /// Builder that creates the work item necessary for the code generation of a 258 /// Builder that creates the work item necessary for the code generation of a
280 /// [MemberElement]. 259 /// [MemberElement].
281 class CodegenWorkItemBuilder extends WorkItemBuilder { 260 class CodegenWorkItemBuilder extends WorkItemBuilder {
(...skipping 13 matching lines...) Expand all
295 // code for checked setters. 274 // code for checked setters.
296 if (element.isField && element.isInstanceMember) { 275 if (element.isField && element.isInstanceMember) {
297 if (!_options.enableTypeAssertions || 276 if (!_options.enableTypeAssertions ||
298 element.enclosingElement.isClosure) { 277 element.enclosingElement.isClosure) {
299 return null; 278 return null;
300 } 279 }
301 } 280 }
302 return new CodegenWorkItem(_backend, element); 281 return new CodegenWorkItem(_backend, element);
303 } 282 }
304 } 283 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/constant_handler_javascript.dart ('k') | pkg/compiler/lib/src/js_backend/namer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698