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

Side by Side Diff: pkg/compiler/lib/src/enqueue.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
« no previous file with comments | « pkg/compiler/lib/src/compiler.dart ('k') | pkg/compiler/lib/src/js_backend/backend.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 dart2js.enqueue; 5 library dart2js.enqueue;
6 6
7 import 'dart:collection' show Queue; 7 import 'dart:collection' show Queue;
8 8
9 import 'cache_strategy.dart';
10 import 'common/backend_api.dart' show Backend; 9 import 'common/backend_api.dart' show Backend;
11 import 'common/resolution.dart' show Resolution; 10 import 'common/resolution.dart' show Resolution;
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, GlobalDependencyRegistry; 14 import 'compiler.dart' show Compiler, GlobalDependencyRegistry;
16 import 'options.dart'; 15 import 'options.dart';
17 import 'elements/elements.dart' 16 import 'elements/elements.dart'
18 show 17 show
19 AnalyzableElement, 18 AnalyzableElement,
(...skipping 24 matching lines...) Expand all
44 : this.compiler = compiler, 43 : this.compiler = compiler,
45 super(compiler.measurer) { 44 super(compiler.measurer) {
46 _resolution = new ResolutionEnqueuer( 45 _resolution = new ResolutionEnqueuer(
47 this, 46 this,
48 compiler.options, 47 compiler.options,
49 compiler.resolution, 48 compiler.resolution,
50 compiler.options.analyzeOnly && compiler.options.analyzeMain 49 compiler.options.analyzeOnly && compiler.options.analyzeMain
51 ? const DirectEnqueuerStrategy() 50 ? const DirectEnqueuerStrategy()
52 : const TreeShakingEnqueuerStrategy(), 51 : const TreeShakingEnqueuerStrategy(),
53 compiler.globalDependencies, 52 compiler.globalDependencies,
54 compiler.backend, 53 compiler.backend);
55 compiler.cacheStrategy);
56 _codegen = compiler.backend.createCodegenEnqueuer(this, compiler); 54 _codegen = compiler.backend.createCodegenEnqueuer(this, compiler);
57 } 55 }
58 56
59 ResolutionEnqueuer get resolution => _resolution; 57 ResolutionEnqueuer get resolution => _resolution;
60 Enqueuer get codegen => _codegen; 58 Enqueuer get codegen => _codegen;
61
62 void forgetEntity(Entity entity) {
63 resolution.forgetEntity(entity, compiler);
64 codegen.forgetEntity(entity, compiler);
65 }
66 } 59 }
67 60
68 abstract class Enqueuer { 61 abstract class Enqueuer {
69 WorldBuilder get worldBuilder; 62 WorldBuilder get worldBuilder;
70 native.NativeEnqueuer get nativeEnqueuer; 63 native.NativeEnqueuer get nativeEnqueuer;
71 void forgetEntity(Entity entity, Compiler compiler);
72 64
73 // TODO(johnniwinther): Initialize [_impactStrategy] to `null`. 65 // TODO(johnniwinther): Initialize [_impactStrategy] to `null`.
74 ImpactStrategy _impactStrategy = const ImpactStrategy(); 66 ImpactStrategy _impactStrategy = const ImpactStrategy();
75 67
76 ImpactStrategy get impactStrategy => _impactStrategy; 68 ImpactStrategy get impactStrategy => _impactStrategy;
77 69
78 void open(ImpactStrategy impactStrategy) { 70 void open(ImpactStrategy impactStrategy) {
79 _impactStrategy = impactStrategy; 71 _impactStrategy = impactStrategy;
80 } 72 }
81 73
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 133
142 /// All declaration elements that have been processed by the resolver. 134 /// All declaration elements that have been processed by the resolver.
143 final Set<Entity> _processedEntities = new Set<Entity>(); 135 final Set<Entity> _processedEntities = new Set<Entity>();
144 136
145 final Queue<WorkItem> _queue = new Queue<WorkItem>(); 137 final Queue<WorkItem> _queue = new Queue<WorkItem>();
146 138
147 /// Queue of deferred resolution actions to execute when the resolution queue 139 /// Queue of deferred resolution actions to execute when the resolution queue
148 /// has been emptied. 140 /// has been emptied.
149 final Queue<_DeferredAction> _deferredQueue = new Queue<_DeferredAction>(); 141 final Queue<_DeferredAction> _deferredQueue = new Queue<_DeferredAction>();
150 142
151 ResolutionEnqueuer( 143 ResolutionEnqueuer(this.task, this._options, Resolution resolution,
152 this.task, 144 this.strategy, this._globalDependencies, Backend backend,
153 this._options,
154 Resolution resolution,
155 this.strategy,
156 this._globalDependencies,
157 Backend backend,
158 CacheStrategy cacheStrategy,
159 [this.name = 'resolution enqueuer']) 145 [this.name = 'resolution enqueuer'])
160 : this.backend = backend, 146 : this.backend = backend,
161 this._resolution = resolution, 147 this._resolution = resolution,
162 this.nativeEnqueuer = backend.nativeResolutionEnqueuer(), 148 this.nativeEnqueuer = backend.nativeResolutionEnqueuer(),
163 _universe = new ResolutionWorldBuilderImpl( 149 _universe = new ResolutionWorldBuilderImpl(
164 backend, resolution, cacheStrategy, const OpenWorldStrategy()), 150 backend, resolution, const OpenWorldStrategy()),
165 _workItemBuilder = new ResolutionWorkItemBuilder(resolution) { 151 _workItemBuilder = new ResolutionWorkItemBuilder(resolution) {
166 _impactVisitor = new EnqueuerImplImpactVisitor(this); 152 _impactVisitor = new EnqueuerImplImpactVisitor(this);
167 } 153 }
168 154
169 ResolutionWorldBuilder get worldBuilder => _universe; 155 ResolutionWorldBuilder get worldBuilder => _universe;
170 156
171 bool get queueIsEmpty => _queue.isEmpty; 157 bool get queueIsEmpty => _queue.isEmpty;
172 158
173 DiagnosticReporter get _reporter => _resolution.reporter; 159 DiagnosticReporter get _reporter => _resolution.reporter;
174 160
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 } 397 }
412 398
413 void emptyDeferredQueueForTesting() => _emptyDeferredQueue(); 399 void emptyDeferredQueueForTesting() => _emptyDeferredQueue();
414 400
415 void _emptyDeferredQueue() { 401 void _emptyDeferredQueue() {
416 while (!_deferredQueue.isEmpty) { 402 while (!_deferredQueue.isEmpty) {
417 _DeferredAction task = _deferredQueue.removeFirst(); 403 _DeferredAction task = _deferredQueue.removeFirst();
418 _reporter.withCurrentElement(task.element, task.action); 404 _reporter.withCurrentElement(task.element, task.action);
419 } 405 }
420 } 406 }
421
422 void forgetEntity(Entity entity, Compiler compiler) {
423 _universe.forgetEntity(entity, compiler);
424 _processedEntities.remove(entity);
425 }
426 } 407 }
427 408
428 /// Strategy used by the enqueuer to populate the world. 409 /// Strategy used by the enqueuer to populate the world.
429 class EnqueuerStrategy { 410 class EnqueuerStrategy {
430 const EnqueuerStrategy(); 411 const EnqueuerStrategy();
431 412
432 /// Process a static use of and element in live code. 413 /// Process a static use of and element in live code.
433 void processStaticUse(EnqueuerImpl enqueuer, StaticUse staticUse) {} 414 void processStaticUse(EnqueuerImpl enqueuer, StaticUse staticUse) {}
434 415
435 /// Process a type use in live code. 416 /// Process a type use in live code.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 @override 519 @override
539 WorkItem createWorkItem(MemberElement element) { 520 WorkItem createWorkItem(MemberElement element) {
540 assert(invariant(element, element.isDeclaration)); 521 assert(invariant(element, element.isDeclaration));
541 if (element.isMalformed) return null; 522 if (element.isMalformed) return null;
542 523
543 assert(invariant(element, element is AnalyzableElement, 524 assert(invariant(element, element is AnalyzableElement,
544 message: 'Element $element is not analyzable.')); 525 message: 'Element $element is not analyzable.'));
545 return _resolution.createWorkItem(element); 526 return _resolution.createWorkItem(element);
546 } 527 }
547 } 528 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/compiler.dart ('k') | pkg/compiler/lib/src/js_backend/backend.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698