| OLD | NEW |
| 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 'common/backend_api.dart' show Backend; | |
| 10 import 'common/resolution.dart' show Resolution; | 9 import 'common/resolution.dart' show Resolution; |
| 11 import 'common/tasks.dart' show CompilerTask; | 10 import 'common/tasks.dart' show CompilerTask; |
| 12 import 'common/work.dart' show WorkItem; | 11 import 'common/work.dart' show WorkItem; |
| 13 import 'common.dart'; | 12 import 'common.dart'; |
| 14 import 'compiler.dart' show Compiler, GlobalDependencyRegistry; | 13 import 'compiler.dart' show Compiler, GlobalDependencyRegistry; |
| 15 import 'options.dart'; | 14 import 'options.dart'; |
| 16 import 'elements/elements.dart' | 15 import 'elements/elements.dart' |
| 17 show | 16 show |
| 18 AnalyzableElement, | 17 AnalyzableElement, |
| 19 ClassElement, | 18 ClassElement, |
| 20 ConstructorElement, | 19 ConstructorElement, |
| 21 Element, | 20 Element, |
| 22 MemberElement; | 21 MemberElement; |
| 23 import 'elements/entities.dart'; | 22 import 'elements/entities.dart'; |
| 24 import 'elements/resolution_types.dart' | 23 import 'elements/resolution_types.dart' |
| 25 show ResolutionDartType, ResolutionInterfaceType; | 24 show ResolutionDartType, ResolutionInterfaceType; |
| 25 import 'js_backend/backend.dart' show JavaScriptBackend; |
| 26 import 'native/native.dart' as native; | 26 import 'native/native.dart' as native; |
| 27 import 'universe/world_builder.dart'; | 27 import 'universe/world_builder.dart'; |
| 28 import 'universe/use.dart' | 28 import 'universe/use.dart' |
| 29 show DynamicUse, StaticUse, StaticUseKind, TypeUse, TypeUseKind; | 29 show DynamicUse, StaticUse, StaticUseKind, TypeUse, TypeUseKind; |
| 30 import 'universe/world_impact.dart' | 30 import 'universe/world_impact.dart' |
| 31 show ImpactStrategy, ImpactUseCase, WorldImpact, WorldImpactVisitor; | 31 show ImpactStrategy, ImpactUseCase, WorldImpact, WorldImpactVisitor; |
| 32 import 'util/enumset.dart'; | 32 import 'util/enumset.dart'; |
| 33 import 'util/util.dart' show Setlet; | 33 import 'util/util.dart' show Setlet; |
| 34 | 34 |
| 35 class EnqueueTask extends CompilerTask { | 35 class EnqueueTask extends CompilerTask { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 111 |
| 112 /// [Enqueuer] which is specific to resolution. | 112 /// [Enqueuer] which is specific to resolution. |
| 113 class ResolutionEnqueuer extends EnqueuerImpl { | 113 class ResolutionEnqueuer extends EnqueuerImpl { |
| 114 static const ImpactUseCase IMPACT_USE = | 114 static const ImpactUseCase IMPACT_USE = |
| 115 const ImpactUseCase('ResolutionEnqueuer'); | 115 const ImpactUseCase('ResolutionEnqueuer'); |
| 116 | 116 |
| 117 final CompilerTask task; | 117 final CompilerTask task; |
| 118 final String name; | 118 final String name; |
| 119 final Resolution _resolution; | 119 final Resolution _resolution; |
| 120 final CompilerOptions _options; | 120 final CompilerOptions _options; |
| 121 final Backend backend; | 121 final JavaScriptBackend backend; |
| 122 final GlobalDependencyRegistry _globalDependencies; | 122 final GlobalDependencyRegistry _globalDependencies; |
| 123 final native.NativeEnqueuer nativeEnqueuer; | 123 final native.NativeEnqueuer nativeEnqueuer; |
| 124 | 124 |
| 125 final EnqueuerStrategy strategy; | 125 final EnqueuerStrategy strategy; |
| 126 final Set<ClassEntity> _recentClasses = new Setlet<ClassEntity>(); | 126 final Set<ClassEntity> _recentClasses = new Setlet<ClassEntity>(); |
| 127 final ResolutionWorldBuilderImpl _universe; | 127 final ResolutionWorldBuilderImpl _universe; |
| 128 final WorkItemBuilder _workItemBuilder; | 128 final WorkItemBuilder _workItemBuilder; |
| 129 | 129 |
| 130 bool queueIsClosed = false; | 130 bool queueIsClosed = false; |
| 131 | 131 |
| 132 WorldImpactVisitor _impactVisitor; | 132 WorldImpactVisitor _impactVisitor; |
| 133 | 133 |
| 134 /// All declaration elements that have been processed by the resolver. | 134 /// All declaration elements that have been processed by the resolver. |
| 135 final Set<Entity> _processedEntities = new Set<Entity>(); | 135 final Set<Entity> _processedEntities = new Set<Entity>(); |
| 136 | 136 |
| 137 final Queue<WorkItem> _queue = new Queue<WorkItem>(); | 137 final Queue<WorkItem> _queue = new Queue<WorkItem>(); |
| 138 | 138 |
| 139 /// Queue of deferred resolution actions to execute when the resolution queue | 139 /// Queue of deferred resolution actions to execute when the resolution queue |
| 140 /// has been emptied. | 140 /// has been emptied. |
| 141 final Queue<_DeferredAction> _deferredQueue = new Queue<_DeferredAction>(); | 141 final Queue<_DeferredAction> _deferredQueue = new Queue<_DeferredAction>(); |
| 142 | 142 |
| 143 ResolutionEnqueuer(this.task, this._options, Resolution resolution, | 143 ResolutionEnqueuer(this.task, this._options, Resolution resolution, |
| 144 this.strategy, this._globalDependencies, Backend backend, | 144 this.strategy, this._globalDependencies, JavaScriptBackend backend, |
| 145 [this.name = 'resolution enqueuer']) | 145 [this.name = 'resolution enqueuer']) |
| 146 : this.backend = backend, | 146 : this.backend = backend, |
| 147 this._resolution = resolution, | 147 this._resolution = resolution, |
| 148 this.nativeEnqueuer = backend.nativeResolutionEnqueuer(), | 148 this.nativeEnqueuer = backend.nativeResolutionEnqueuer(), |
| 149 _universe = new ResolutionWorldBuilderImpl( | 149 _universe = new ResolutionWorldBuilderImpl( |
| 150 backend, resolution, const OpenWorldStrategy()), | 150 backend, resolution, const OpenWorldStrategy()), |
| 151 _workItemBuilder = new ResolutionWorkItemBuilder(resolution) { | 151 _workItemBuilder = new ResolutionWorkItemBuilder(resolution) { |
| 152 _impactVisitor = new EnqueuerImplImpactVisitor(this); | 152 _impactVisitor = new EnqueuerImplImpactVisitor(this); |
| 153 } | 153 } |
| 154 | 154 |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 @override | 519 @override |
| 520 WorkItem createWorkItem(MemberElement element) { | 520 WorkItem createWorkItem(MemberElement element) { |
| 521 assert(invariant(element, element.isDeclaration)); | 521 assert(invariant(element, element.isDeclaration)); |
| 522 if (element.isMalformed) return null; | 522 if (element.isMalformed) return null; |
| 523 | 523 |
| 524 assert(invariant(element, element is AnalyzableElement, | 524 assert(invariant(element, element is AnalyzableElement, |
| 525 message: 'Element $element is not analyzable.')); | 525 message: 'Element $element is not analyzable.')); |
| 526 return _resolution.createWorkItem(element); | 526 return _resolution.createWorkItem(element); |
| 527 } | 527 } |
| 528 } | 528 } |
| OLD | NEW |