Remove EnqueuerImpl.processInstantiatedClassMembers

R=het@google.com

Review URL: https://codereview.chromium.org/2539043002 .
This commit is contained in:
Johnni Winther 2016-12-01 11:10:36 +01:00
parent c6412af7bb
commit 27afcc4296
2 changed files with 18 additions and 31 deletions

View file

@ -122,7 +122,6 @@ abstract class Enqueuer {
abstract class EnqueuerImpl extends Enqueuer { abstract class EnqueuerImpl extends Enqueuer {
CompilerTask get task; CompilerTask get task;
EnqueuerStrategy get strategy; EnqueuerStrategy get strategy;
void processInstantiatedClassMembers(ClassElement cls);
void processInstantiatedClassMember(ClassElement cls, Element member); void processInstantiatedClassMember(ClassElement cls, Element member);
void processStaticUse(StaticUse staticUse); void processStaticUse(StaticUse staticUse);
void processTypeUse(TypeUse typeUse); void processTypeUse(TypeUse typeUse);
@ -234,10 +233,6 @@ class ResolutionEnqueuer extends EnqueuerImpl {
return strategy.checkEnqueuerConsistency(this); return strategy.checkEnqueuerConsistency(this);
} }
void processInstantiatedClassMembers(ClassElement cls) {
strategy.processInstantiatedClass(this, cls);
}
void processInstantiatedClassMember(ClassElement cls, Element member) { void processInstantiatedClassMember(ClassElement cls, Element member) {
assert(invariant(member, member.isDeclaration)); assert(invariant(member, member.isDeclaration));
if (isProcessed(member)) return; if (isProcessed(member)) return;
@ -677,9 +672,6 @@ void removeFromSet(Map<String, Set<Element>> map, Element element) {
class EnqueuerStrategy { class EnqueuerStrategy {
const EnqueuerStrategy(); const EnqueuerStrategy();
/// Process a class instantiated in live code.
void processInstantiatedClass(EnqueuerImpl enqueuer, ClassElement cls) {}
/// Process a static use of and element in live code. /// Process a static use of and element in live code.
void processStaticUse(EnqueuerImpl enqueuer, StaticUse staticUse) {} void processStaticUse(EnqueuerImpl enqueuer, StaticUse staticUse) {}
@ -690,20 +682,7 @@ class EnqueuerStrategy {
void processDynamicUse(EnqueuerImpl enqueuer, DynamicUse dynamicUse) {} void processDynamicUse(EnqueuerImpl enqueuer, DynamicUse dynamicUse) {}
/// Check enqueuer consistency after the queue has been closed. /// Check enqueuer consistency after the queue has been closed.
bool checkEnqueuerConsistency(EnqueuerImpl enqueuer) { bool checkEnqueuerConsistency(EnqueuerImpl enqueuer) => true;
enqueuer.task.measure(() {
// Run through the classes and see if we need to enqueue more methods.
for (ClassElement classElement
in enqueuer.universe.directlyInstantiatedClasses) {
for (ClassElement currentClass = classElement;
currentClass != null;
currentClass = currentClass.superclass) {
enqueuer.processInstantiatedClassMembers(currentClass);
}
}
});
return true;
}
/// Process [work] using [f]. /// Process [work] using [f].
void processWorkItem(void f(WorkItem work), WorkItem work) { void processWorkItem(void f(WorkItem work), WorkItem work) {
@ -725,11 +704,6 @@ class DirectEnqueuerStrategy extends EnqueuerStrategy {
class TreeShakingEnqueuerStrategy extends EnqueuerStrategy { class TreeShakingEnqueuerStrategy extends EnqueuerStrategy {
const TreeShakingEnqueuerStrategy(); const TreeShakingEnqueuerStrategy();
@override
void processInstantiatedClass(EnqueuerImpl enqueuer, ClassElement cls) {
cls.implementation.forEachMember(enqueuer.processInstantiatedClassMember);
}
@override @override
void processStaticUse(EnqueuerImpl enqueuer, StaticUse staticUse) { void processStaticUse(EnqueuerImpl enqueuer, StaticUse staticUse) {
enqueuer.processStaticUse(staticUse); enqueuer.processStaticUse(staticUse);
@ -744,6 +718,23 @@ class TreeShakingEnqueuerStrategy extends EnqueuerStrategy {
void processDynamicUse(EnqueuerImpl enqueuer, DynamicUse dynamicUse) { void processDynamicUse(EnqueuerImpl enqueuer, DynamicUse dynamicUse) {
enqueuer.processDynamicUse(dynamicUse); enqueuer.processDynamicUse(dynamicUse);
} }
/// Check enqueuer consistency after the queue has been closed.
bool checkEnqueuerConsistency(EnqueuerImpl enqueuer) {
enqueuer.task.measure(() {
// Run through the classes and see if we need to enqueue more methods.
for (ClassElement classElement
in enqueuer.universe.directlyInstantiatedClasses) {
for (ClassElement currentClass = classElement;
currentClass != null;
currentClass = currentClass.superclass) {
currentClass.implementation
.forEachMember(enqueuer.processInstantiatedClassMember);
}
}
});
return true;
}
} }
class EnqueuerImplImpactVisitor implements WorldImpactVisitor { class EnqueuerImplImpactVisitor implements WorldImpactVisitor {

View file

@ -163,10 +163,6 @@ class CodegenEnqueuer extends EnqueuerImpl {
return strategy.checkEnqueuerConsistency(this); return strategy.checkEnqueuerConsistency(this);
} }
void processInstantiatedClassMembers(ClassElement cls) {
strategy.processInstantiatedClass(this, cls);
}
void processInstantiatedClassMember(ClassElement cls, Element member) { void processInstantiatedClassMember(ClassElement cls, Element member) {
assert(invariant(member, member.isDeclaration)); assert(invariant(member, member.isDeclaration));
if (isProcessed(member)) return; if (isProcessed(member)) return;