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

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

Issue 2582393002: Merge WorldImpl with ResolutionWorldBuilderImpl (Closed)
Patch Set: Updated cf. comment Created 4 years 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/resolution/resolution.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'; 9 import 'cache_strategy.dart';
10 import 'common/backend_api.dart' show Backend; 10 import 'common/backend_api.dart' show Backend;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 ResolutionEnqueuer get resolution => _resolution; 63 ResolutionEnqueuer get resolution => _resolution;
64 Enqueuer get codegen => _codegen; 64 Enqueuer get codegen => _codegen;
65 65
66 void forgetEntity(Entity entity) { 66 void forgetEntity(Entity entity) {
67 resolution.forgetEntity(entity, compiler); 67 resolution.forgetEntity(entity, compiler);
68 codegen.forgetEntity(entity, compiler); 68 codegen.forgetEntity(entity, compiler);
69 } 69 }
70 } 70 }
71 71
72 abstract class Enqueuer { 72 abstract class Enqueuer {
73 // TODO(johnniwinther): Rename to `worldBuilder`.
73 WorldBuilder get universe; 74 WorldBuilder get universe;
74 native.NativeEnqueuer get nativeEnqueuer; 75 native.NativeEnqueuer get nativeEnqueuer;
75 void forgetEntity(Entity entity, Compiler compiler); 76 void forgetEntity(Entity entity, Compiler compiler);
76 77
77 // TODO(johnniwinther): Initialize [_impactStrategy] to `null`. 78 // TODO(johnniwinther): Initialize [_impactStrategy] to `null`.
78 ImpactStrategy _impactStrategy = const ImpactStrategy(); 79 ImpactStrategy _impactStrategy = const ImpactStrategy();
79 80
80 ImpactStrategy get impactStrategy => _impactStrategy; 81 ImpactStrategy get impactStrategy => _impactStrategy;
81 82
82 void open(ImpactStrategy impactStrategy) { 83 void open(ImpactStrategy impactStrategy) {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 : this.backend = backend, 164 : this.backend = backend,
164 this._resolution = resolution, 165 this._resolution = resolution,
165 this.nativeEnqueuer = backend.nativeResolutionEnqueuer(), 166 this.nativeEnqueuer = backend.nativeResolutionEnqueuer(),
166 _universe = new ResolutionWorldBuilderImpl( 167 _universe = new ResolutionWorldBuilderImpl(
167 backend, resolution, cacheStrategy, const OpenWorldStrategy()) { 168 backend, resolution, cacheStrategy, const OpenWorldStrategy()) {
168 _impactVisitor = new EnqueuerImplImpactVisitor(this); 169 _impactVisitor = new EnqueuerImplImpactVisitor(this);
169 } 170 }
170 171
171 ResolutionWorldBuilder get universe => _universe; 172 ResolutionWorldBuilder get universe => _universe;
172 173
173 OpenWorld get _openWorld => universe.openWorld;
174
175 bool get queueIsEmpty => _queue.isEmpty; 174 bool get queueIsEmpty => _queue.isEmpty;
176 175
177 DiagnosticReporter get _reporter => _resolution.reporter; 176 DiagnosticReporter get _reporter => _resolution.reporter;
178 177
179 Iterable<ClassEntity> get processedClasses => _universe.processedClasses; 178 Iterable<ClassEntity> get processedClasses => _universe.processedClasses;
180 179
181 void applyImpact(WorldImpact worldImpact, {var impactSource}) { 180 void applyImpact(WorldImpact worldImpact, {var impactSource}) {
182 if (worldImpact.isEmpty) return; 181 if (worldImpact.isEmpty) return;
183 impactStrategy.visitImpact( 182 impactStrategy.visitImpact(
184 impactSource, worldImpact, _impactVisitor, impactUse); 183 impactSource, worldImpact, _impactVisitor, impactUse);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 case TypeUseKind.CATCH_TYPE: 292 case TypeUseKind.CATCH_TYPE:
294 _registerIsCheck(type); 293 _registerIsCheck(type);
295 break; 294 break;
296 case TypeUseKind.CHECKED_MODE_CHECK: 295 case TypeUseKind.CHECKED_MODE_CHECK:
297 if (_options.enableTypeAssertions) { 296 if (_options.enableTypeAssertions) {
298 _registerIsCheck(type); 297 _registerIsCheck(type);
299 } 298 }
300 break; 299 break;
301 case TypeUseKind.TYPE_LITERAL: 300 case TypeUseKind.TYPE_LITERAL:
302 if (type.isTypedef) { 301 if (type.isTypedef) {
303 universe.openWorld.registerTypedef(type.element); 302 universe.registerTypedef(type.element);
304 } 303 }
305 break; 304 break;
306 } 305 }
307 } 306 }
308 307
309 void _registerIsCheck(DartType type) { 308 void _registerIsCheck(DartType type) {
310 type = _universe.registerIsCheck(type); 309 type = _universe.registerIsCheck(type);
311 // Even in checked mode, type annotations for return type and argument 310 // Even in checked mode, type annotations for return type and argument
312 // types do not imply type checks, so there should never be a check 311 // types do not imply type checks, so there should never be a check
313 // against the type variable of a typedef. 312 // against the type variable of a typedef.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 378
380 assert(invariant(element, element is AnalyzableElement, 379 assert(invariant(element, element is AnalyzableElement,
381 message: 'Element $element is not analyzable.')); 380 message: 'Element $element is not analyzable.'));
382 if (hasBeenProcessed(element)) return; 381 if (hasBeenProcessed(element)) return;
383 if (queueIsClosed) { 382 if (queueIsClosed) {
384 throw new SpannableAssertionFailure( 383 throw new SpannableAssertionFailure(
385 element, "Resolution work list is closed. Trying to add $element."); 384 element, "Resolution work list is closed. Trying to add $element.");
386 } 385 }
387 386
388 applyImpact(backend.registerUsedElement(element, forResolution: true)); 387 applyImpact(backend.registerUsedElement(element, forResolution: true));
389 _openWorld.registerUsedElement(element); 388 _universe.registerUsedElement(element);
390 389
391 ResolutionWorkItem workItem = _resolution.createWorkItem(element); 390 ResolutionWorkItem workItem = _resolution.createWorkItem(element);
392 _queue.add(workItem); 391 _queue.add(workItem);
393 } 392 }
394 393
395 /// Adds an action to the deferred task queue. 394 /// Adds an action to the deferred task queue.
396 /// The action is performed the next time the resolution queue has been 395 /// The action is performed the next time the resolution queue has been
397 /// emptied. 396 /// emptied.
398 /// 397 ///
399 /// The queue is processed in FIFO order. 398 /// The queue is processed in FIFO order.
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 } 523 }
525 524
526 typedef void _DeferredActionFunction(); 525 typedef void _DeferredActionFunction();
527 526
528 class _DeferredAction { 527 class _DeferredAction {
529 final Element element; 528 final Element element;
530 final _DeferredActionFunction action; 529 final _DeferredActionFunction action;
531 530
532 _DeferredAction(this.element, this.action); 531 _DeferredAction(this.element, this.action);
533 } 532 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/compiler.dart ('k') | pkg/compiler/lib/src/resolution/resolution.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698