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

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

Issue 2381793003: Rename Universe to WorldBuilder. (Closed)
Patch Set: Created 4 years, 2 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 Queue; 7 import 'dart:collection' show Queue;
8 8
9 import 'common/names.dart' show Identifiers; 9 import 'common/names.dart' show Identifiers;
10 import 'common/resolution.dart' show Resolution; 10 import 'common/resolution.dart' show Resolution;
(...skipping 14 matching lines...) Expand all
25 Entity, 25 Entity,
26 FunctionElement, 26 FunctionElement,
27 LibraryElement, 27 LibraryElement,
28 Member, 28 Member,
29 Name, 29 Name,
30 TypedElement, 30 TypedElement,
31 TypedefElement; 31 TypedefElement;
32 import 'native/native.dart' as native; 32 import 'native/native.dart' as native;
33 import 'types/types.dart' show TypeMaskStrategy; 33 import 'types/types.dart' show TypeMaskStrategy;
34 import 'universe/selector.dart' show Selector; 34 import 'universe/selector.dart' show Selector;
35 import 'universe/universe.dart'; 35 import 'universe/world_builder.dart';
36 import 'universe/use.dart' 36 import 'universe/use.dart'
37 show DynamicUse, StaticUse, StaticUseKind, TypeUse, TypeUseKind; 37 show DynamicUse, StaticUse, StaticUseKind, TypeUse, TypeUseKind;
38 import 'universe/world_impact.dart' 38 import 'universe/world_impact.dart'
39 show ImpactUseCase, WorldImpact, WorldImpactVisitor; 39 show ImpactUseCase, WorldImpact, WorldImpactVisitor;
40 import 'util/util.dart' show Setlet; 40 import 'util/util.dart' show Setlet;
41 41
42 class EnqueueTask extends CompilerTask { 42 class EnqueueTask extends CompilerTask {
43 final ResolutionEnqueuer resolution; 43 final ResolutionEnqueuer resolution;
44 final Enqueuer codegen; 44 final Enqueuer codegen;
45 final Compiler compiler; 45 final Compiler compiler;
(...skipping 18 matching lines...) Expand all
64 } 64 }
65 65
66 void forgetElement(Element element) { 66 void forgetElement(Element element) {
67 resolution.forgetElement(element); 67 resolution.forgetElement(element);
68 codegen.forgetElement(element); 68 codegen.forgetElement(element);
69 } 69 }
70 } 70 }
71 71
72 abstract class Enqueuer { 72 abstract class Enqueuer {
73 EnqueueTask task; 73 EnqueueTask task;
74 Universe get universe; 74 WorldBuilder get universe;
Siggi Cherem (dart-lang) 2016/09/29 18:14:48 might be worth renaming this field (and _universe
Johnni Winther 2016/09/30 08:43:14 Acknowledged.
75 native.NativeEnqueuer nativeEnqueuer; // Set by EnqueueTask 75 native.NativeEnqueuer nativeEnqueuer; // Set by EnqueueTask
76 void forgetElement(Element element); 76 void forgetElement(Element element);
77 void processInstantiatedClassMembers(ClassElement cls); 77 void processInstantiatedClassMembers(ClassElement cls);
78 void processInstantiatedClassMember(ClassElement cls, Element member); 78 void processInstantiatedClassMember(ClassElement cls, Element member);
79 void handleUnseenSelectorInternal(DynamicUse dynamicUse); 79 void handleUnseenSelectorInternal(DynamicUse dynamicUse);
80 void registerStaticUse(StaticUse staticUse); 80 void registerStaticUse(StaticUse staticUse);
81 void registerStaticUseInternal(StaticUse staticUse); 81 void registerStaticUseInternal(StaticUse staticUse);
82 void registerDynamicUse(DynamicUse dynamicUse); 82 void registerDynamicUse(DynamicUse dynamicUse);
83 void registerTypeUse(TypeUse typeUse); 83 void registerTypeUse(TypeUse typeUse);
84 84
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 class ResolutionEnqueuer extends Enqueuer { 128 class ResolutionEnqueuer extends Enqueuer {
129 final String name; 129 final String name;
130 final Compiler compiler; // TODO(ahe): Remove this dependency. 130 final Compiler compiler; // TODO(ahe): Remove this dependency.
131 final EnqueuerStrategy strategy; 131 final EnqueuerStrategy strategy;
132 final Map<String, Set<Element>> instanceMembersByName = 132 final Map<String, Set<Element>> instanceMembersByName =
133 new Map<String, Set<Element>>(); 133 new Map<String, Set<Element>>();
134 final Map<String, Set<Element>> instanceFunctionsByName = 134 final Map<String, Set<Element>> instanceFunctionsByName =
135 new Map<String, Set<Element>>(); 135 new Map<String, Set<Element>>();
136 final Set<ClassElement> _processedClasses = new Set<ClassElement>(); 136 final Set<ClassElement> _processedClasses = new Set<ClassElement>();
137 Set<ClassElement> recentClasses = new Setlet<ClassElement>(); 137 Set<ClassElement> recentClasses = new Setlet<ClassElement>();
138 final ResolutionUniverseImpl _universe = 138 final ResolutionWorldBuilderImpl _universe =
139 new ResolutionUniverseImpl(const TypeMaskStrategy()); 139 new ResolutionWorldBuilderImpl(const TypeMaskStrategy());
140 140
141 static final TRACE_MIRROR_ENQUEUING = 141 static final TRACE_MIRROR_ENQUEUING =
142 const bool.fromEnvironment("TRACE_MIRROR_ENQUEUING"); 142 const bool.fromEnvironment("TRACE_MIRROR_ENQUEUING");
143 143
144 bool queueIsClosed = false; 144 bool queueIsClosed = false;
145 145
146 bool hasEnqueuedReflectiveElements = false; 146 bool hasEnqueuedReflectiveElements = false;
147 bool hasEnqueuedReflectiveStaticFields = false; 147 bool hasEnqueuedReflectiveStaticFields = false;
148 148
149 WorldImpactVisitor impactVisitor; 149 WorldImpactVisitor impactVisitor;
150 150
151 ResolutionEnqueuer(Compiler compiler, this.strategy) 151 ResolutionEnqueuer(Compiler compiler, this.strategy)
152 : this.name = 'resolution enqueuer', 152 : this.name = 'resolution enqueuer',
153 this.compiler = compiler, 153 this.compiler = compiler,
154 processedElements = new Set<AstElement>(), 154 processedElements = new Set<AstElement>(),
155 queue = new Queue<ResolutionWorkItem>(), 155 queue = new Queue<ResolutionWorkItem>(),
156 deferredQueue = new Queue<_DeferredAction>() { 156 deferredQueue = new Queue<_DeferredAction>() {
157 impactVisitor = new _EnqueuerImpactVisitor(this); 157 impactVisitor = new _EnqueuerImpactVisitor(this);
158 } 158 }
159 159
160 // TODO(johnniwinther): Move this to [ResolutionEnqueuer]. 160 // TODO(johnniwinther): Move this to [ResolutionEnqueuer].
161 Resolution get resolution => compiler.resolution; 161 Resolution get resolution => compiler.resolution;
162 162
163 ResolutionUniverse get universe => _universe; 163 ResolutionWorldBuilder get universe => _universe;
164 164
165 bool get queueIsEmpty => queue.isEmpty; 165 bool get queueIsEmpty => queue.isEmpty;
166 166
167 QueueFilter get filter => compiler.enqueuerFilter; 167 QueueFilter get filter => compiler.enqueuerFilter;
168 168
169 DiagnosticReporter get reporter => compiler.reporter; 169 DiagnosticReporter get reporter => compiler.reporter;
170 170
171 bool isClassProcessed(ClassElement cls) => _processedClasses.contains(cls); 171 bool isClassProcessed(ClassElement cls) => _processedClasses.contains(cls);
172 172
173 Iterable<ClassElement> get processedClasses => _processedClasses; 173 Iterable<ClassElement> get processedClasses => _processedClasses;
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 } 908 }
909 909
910 typedef void _DeferredActionFunction(); 910 typedef void _DeferredActionFunction();
911 911
912 class _DeferredAction { 912 class _DeferredAction {
913 final Element element; 913 final Element element;
914 final _DeferredActionFunction action; 914 final _DeferredActionFunction action;
915 915
916 _DeferredAction(this.element, this.action); 916 _DeferredAction(this.element, this.action);
917 } 917 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698