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

Unified Diff: pkg/compiler/lib/src/js_backend/custom_elements_analysis.dart

Issue 2378063002: Remove Enqueuer argument from Backend.registerStaticUse (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/js_backend/backend.dart ('k') | pkg/compiler/lib/src/js_backend/enqueuer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_backend/custom_elements_analysis.dart
diff --git a/pkg/compiler/lib/src/js_backend/custom_elements_analysis.dart b/pkg/compiler/lib/src/js_backend/custom_elements_analysis.dart
index 807bcb95cedcb12c590189f40c2386ecb0c40a4c..d87ffa31d799423bb20367af7aa405e49855964b 100644
--- a/pkg/compiler/lib/src/js_backend/custom_elements_analysis.dart
+++ b/pkg/compiler/lib/src/js_backend/custom_elements_analysis.dart
@@ -71,10 +71,11 @@ class CustomElementsAnalysis {
codegenJoin.allClassesSelected = true;
}
- CustomElementsAnalysisJoin joinFor(Enqueuer enqueuer) =>
- enqueuer.isResolutionQueue ? resolutionJoin : codegenJoin;
+ CustomElementsAnalysisJoin joinFor({bool forResolution}) =>
+ forResolution ? resolutionJoin : codegenJoin;
- void registerInstantiatedClass(ClassElement classElement, Enqueuer enqueuer) {
+ void registerInstantiatedClass(ClassElement classElement,
+ {bool forResolution}) {
classElement.ensureResolved(compiler.resolution);
if (!backend.isNativeOrExtendsNative(classElement)) return;
if (classElement.isMixinApplication) return;
@@ -82,7 +83,7 @@ class CustomElementsAnalysis {
// JsInterop classes are opaque interfaces without a concrete
// implementation.
if (backend.isJsInterop(classElement)) return;
- joinFor(enqueuer).instantiatedClasses.add(classElement);
+ joinFor(forResolution: forResolution).instantiatedClasses.add(classElement);
}
void registerTypeLiteral(DartType type) {
@@ -104,19 +105,20 @@ class CustomElementsAnalysis {
codegenJoin.selectedClasses.add(element);
}
- void registerStaticUse(Element element, Enqueuer enqueuer) {
+ void registerStaticUse(Element element, {bool forResolution}) {
assert(element != null);
if (!fetchedTableAccessorMethod) {
fetchedTableAccessorMethod = true;
tableAccessorMethod = backend.helpers.findIndexForNativeSubclassType;
}
if (element == tableAccessorMethod) {
- joinFor(enqueuer).demanded = true;
+ joinFor(forResolution: forResolution).demanded = true;
}
}
- void onQueueEmpty(Enqueuer enqueuer) {
- joinFor(enqueuer).flush(enqueuer);
+ /// Computes the [WorldImpact] of the classes registered since last flush.
+ WorldImpact flush({bool forResolution}) {
+ return joinFor(forResolution: forResolution).flush();
}
bool get needsTable => codegenJoin.demanded;
@@ -152,8 +154,8 @@ class CustomElementsAnalysisJoin {
CustomElementsAnalysisJoin(this.backend);
- void flush(Enqueuer enqueuer) {
- if (!demanded) return;
+ WorldImpact flush() {
+ if (!demanded) return const WorldImpact();
var newActiveClasses = new Set<ClassElement>();
for (ClassElement classElement in instantiatedClasses) {
bool isNative = backend.isNative(classElement);
@@ -168,7 +170,8 @@ class CustomElementsAnalysisJoin {
Iterable<ConstructorElement> escapingConstructors =
computeEscapingConstructors(classElement);
for (ConstructorElement constructor in escapingConstructors) {
- enqueuer.registerStaticUse(new StaticUse.foreignUse(constructor));
+ impactBuilder
+ .registerStaticUse(new StaticUse.foreignUse(constructor));
}
escapingConstructors
.forEach(compiler.globalDependencies.registerDependency);
@@ -182,7 +185,7 @@ class CustomElementsAnalysisJoin {
}
activeClasses.addAll(newActiveClasses);
instantiatedClasses.removeAll(newActiveClasses);
- enqueuer.applyImpact(null, impactBuilder.flush());
+ return impactBuilder.flush();
}
TypeConstantValue makeTypeConstant(ClassElement element) {
« no previous file with comments | « pkg/compiler/lib/src/js_backend/backend.dart ('k') | pkg/compiler/lib/src/js_backend/enqueuer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698