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

Unified Diff: pkg/compiler/lib/src/enqueue.dart

Issue 2318593003: Split Universe into ResolutionUniverse and CodegenUniverse (Closed)
Patch Set: Updated cf. comments. Created 4 years, 3 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/enqueue.dart
diff --git a/pkg/compiler/lib/src/enqueue.dart b/pkg/compiler/lib/src/enqueue.dart
index 748a5e2e26c9ef9b3a8f9253cedc3cf34345f6de..c29912a3c3b02713883c71a3f2d81023fd9a939f 100644
--- a/pkg/compiler/lib/src/enqueue.dart
+++ b/pkg/compiler/lib/src/enqueue.dart
@@ -131,7 +131,8 @@ class ResolutionEnqueuer extends Enqueuer {
new Map<String, Set<Element>>();
final Set<ClassElement> _processedClasses = new Set<ClassElement>();
Set<ClassElement> recentClasses = new Setlet<ClassElement>();
- final Universe universe = new Universe(const TypeMaskStrategy());
+ final ResolutionUniverseImpl _universe =
+ new ResolutionUniverseImpl(const TypeMaskStrategy());
static final TRACE_MIRROR_ENQUEUING =
const bool.fromEnvironment("TRACE_MIRROR_ENQUEUING");
@@ -155,6 +156,8 @@ class ResolutionEnqueuer extends Enqueuer {
// TODO(johnniwinther): Move this to [ResolutionEnqueuer].
Resolution get resolution => compiler.resolution;
+ ResolutionUniverse get universe => _universe;
+
bool get queueIsEmpty => queue.isEmpty;
QueueFilter get filter => compiler.enqueuerFilter;
@@ -191,7 +194,7 @@ class ResolutionEnqueuer extends Enqueuer {
ClassElement cls = type.element;
cls.ensureResolved(resolution);
bool isNative = compiler.backend.isNative(cls);
- universe.registerTypeInstantiation(type,
+ _universe.registerTypeInstantiation(type,
isNative: isNative,
byMirrors: mirrorUsage, onImplemented: (ClassElement cls) {
compiler.backend
@@ -228,12 +231,12 @@ class ResolutionEnqueuer extends Enqueuer {
// classes, which may not be the case when a native class is subclassed.
if (compiler.backend.isNative(cls)) {
compiler.openWorld.registerUsedElement(member);
- if (universe.hasInvokedGetter(member, compiler.openWorld) ||
- universe.hasInvocation(member, compiler.openWorld)) {
+ if (_universe.hasInvokedGetter(member, compiler.openWorld) ||
+ _universe.hasInvocation(member, compiler.openWorld)) {
addToWorkList(member);
return;
}
- if (universe.hasInvokedSetter(member, compiler.openWorld)) {
+ if (_universe.hasInvokedSetter(member, compiler.openWorld)) {
addToWorkList(member);
return;
}
@@ -257,7 +260,7 @@ class ResolutionEnqueuer extends Enqueuer {
}
// If there is a property access with the same name as a method we
// need to emit the method.
- if (universe.hasInvokedGetter(function, compiler.openWorld)) {
+ if (_universe.hasInvokedGetter(function, compiler.openWorld)) {
registerClosurizedMember(function);
addToWorkList(function);
return;
@@ -267,27 +270,27 @@ class ResolutionEnqueuer extends Enqueuer {
instanceFunctionsByName
.putIfAbsent(memberName, () => new Set<Element>())
.add(member);
- if (universe.hasInvocation(function, compiler.openWorld)) {
+ if (_universe.hasInvocation(function, compiler.openWorld)) {
addToWorkList(function);
return;
}
} else if (member.isGetter) {
FunctionElement getter = member;
getter.computeType(resolution);
- if (universe.hasInvokedGetter(getter, compiler.openWorld)) {
+ if (_universe.hasInvokedGetter(getter, compiler.openWorld)) {
addToWorkList(getter);
return;
}
// We don't know what selectors the returned closure accepts. If
// the set contains any selector we have to assume that it matches.
- if (universe.hasInvocation(getter, compiler.openWorld)) {
+ if (_universe.hasInvocation(getter, compiler.openWorld)) {
addToWorkList(getter);
return;
}
} else if (member.isSetter) {
FunctionElement setter = member;
setter.computeType(resolution);
- if (universe.hasInvokedSetter(setter, compiler.openWorld)) {
+ if (_universe.hasInvokedSetter(setter, compiler.openWorld)) {
addToWorkList(setter);
return;
}
@@ -334,7 +337,7 @@ class ResolutionEnqueuer extends Enqueuer {
void registerDynamicUse(DynamicUse dynamicUse) {
task.measure(() {
- if (universe.registerDynamicUse(dynamicUse)) {
+ if (_universe.registerDynamicUse(dynamicUse)) {
handleUnseenSelector(dynamicUse);
}
});
@@ -570,7 +573,7 @@ class ResolutionEnqueuer extends Enqueuer {
Element element = staticUse.element;
assert(invariant(element, element.isDeclaration,
message: "Element ${element} is not the declaration."));
- universe.registerStaticUse(staticUse);
+ _universe.registerStaticUse(staticUse);
compiler.backend.registerStaticUse(element, this);
bool addElement = true;
switch (staticUse.kind) {
@@ -619,7 +622,7 @@ class ResolutionEnqueuer extends Enqueuer {
}
void _registerIsCheck(DartType type) {
- type = universe.registerIsCheck(type, compiler);
+ type = _universe.registerIsCheck(type, compiler);
// Even in checked mode, type annotations for return type and argument
// types do not imply type checks, so there should never be a check
// against the type variable of a typedef.
@@ -629,7 +632,7 @@ class ResolutionEnqueuer extends Enqueuer {
void registerCallMethodWithFreeTypeVariables(Element element) {
compiler.backend.registerCallMethodWithFreeTypeVariables(
element, this, compiler.globalDependencies);
- universe.callMethodsWithFreeTypeVariables.add(element);
+ _universe.callMethodsWithFreeTypeVariables.add(element);
}
void registerClosurizedMember(TypedElement element) {
@@ -637,9 +640,10 @@ class ResolutionEnqueuer extends Enqueuer {
if (element.computeType(resolution).containsTypeVariables) {
compiler.backend.registerClosureWithFreeTypeVariables(
element, this, compiler.globalDependencies);
+ _universe.closuresWithFreeTypeVariables.add(element);
}
compiler.backend.registerBoundClosure(this);
- universe.closurizedMembers.add(element);
+ _universe.closurizedMembers.add(element);
}
void forEach(void f(WorkItem work)) {
@@ -809,7 +813,7 @@ class ResolutionEnqueuer extends Enqueuer {
}
void forgetElement(Element element) {
- universe.forgetElement(element, compiler);
+ _universe.forgetElement(element, compiler);
_processedClasses.remove(element);
instanceMembersByName[element.name]?.remove(element);
instanceFunctionsByName[element.name]?.remove(element);
« 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