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

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

Issue 2693893003: Introduce EnqueuerListener (Closed)
Patch Set: Make listener private Created 3 years, 10 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/enqueue.dart ('k') | tests/compiler/dart2js/kernel/closed_world_test.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/backend.dart
diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart
index a10055ea2440b60d832213eb9181b7f13a866f02..4e86edfd533f031ffdd194fc40e1e8409a14370b 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -29,7 +29,12 @@ import '../elements/entities.dart';
import '../elements/resolution_types.dart';
import '../elements/types.dart';
import '../enqueue.dart'
- show Enqueuer, EnqueueTask, ResolutionEnqueuer, TreeShakingEnqueuerStrategy;
+ show
+ Enqueuer,
+ EnqueuerListener,
+ EnqueueTask,
+ ResolutionEnqueuer,
+ TreeShakingEnqueuerStrategy;
import '../io/position_information.dart' show PositionSourceInformationStrategy;
import '../io/source_information.dart' show SourceInformationStrategy;
import '../io/start_end_information.dart'
@@ -304,7 +309,7 @@ enum SyntheticConstantKind {
NAME
}
-class JavaScriptBackend extends Target {
+class JavaScriptBackend extends Target implements EnqueuerListener {
final Compiler compiler;
String get patchVersion => emitter.patchVersion;
@@ -794,16 +799,11 @@ class JavaScriptBackend extends Target {
}
}
- /// Called to notify to the backend that a class is being instantiated. Any
- /// backend specific [WorldImpact] of this is returned.
WorldImpact registerInstantiatedClass(ClassElement cls,
{bool forResolution}) {
return _processClass(cls, forResolution: forResolution);
}
- /// Called to notify to the backend that a class is implemented by an
- /// instantiated class. Any backend specific [WorldImpact] of this is
- /// returned.
WorldImpact registerImplementedClass(ClassElement cls, {bool forResolution}) {
return _processClass(cls, forResolution: forResolution);
}
@@ -936,8 +936,6 @@ class JavaScriptBackend extends Target {
return impactBuilder;
}
- /// Called to instruct to the backend register [type] as instantiated on
- /// [enqueuer].
void registerInstantiatedType(ResolutionInterfaceType type) {
lookupMapAnalysis.registerInstantiatedType(type);
}
@@ -995,10 +993,7 @@ class JavaScriptBackend extends Target {
return const WorldImpact();
}
- /// Called to instruct the backend to register that a closure exists for a
- /// function on an instantiated generic class. Any backend specific
- /// [WorldImpact] of this is returned.
- WorldImpact registerClosureWithFreeTypeVariables(Element closure,
+ WorldImpact registerClosureWithFreeTypeVariables(MethodElement closure,
{bool forResolution}) {
if (forResolution || methodNeedsRti(closure)) {
return _registerComputeSignature();
@@ -1006,14 +1001,10 @@ class JavaScriptBackend extends Target {
return const WorldImpact();
}
- /// Called to register that a member has been closurized. Any backend specific
- /// [WorldImpact] of this is returned.
WorldImpact registerBoundClosure() {
return impactTransformer.createImpactFor(impacts.memberClosure);
}
- /// Called to register that a static function has been closurized. Any backend
- /// specific [WorldImpact] of this is returned.
WorldImpact registerGetOfStaticFunction() {
return impactTransformer.createImpactFor(impacts.staticClosure);
}
@@ -1318,8 +1309,6 @@ class JavaScriptBackend extends Target {
return _closedWorld.hasOnlySubclasses(classElement);
}
- /// Called to register that [element] is statically known to be used. Any
- /// backend specific [WorldImpact] of this is returned.
WorldImpact registerUsedElement(MemberElement element, {bool forResolution}) {
WorldImpactBuilderImpl worldImpact = new WorldImpactBuilderImpl();
if (element == helpers.disableTreeShakingMarker) {
@@ -1526,22 +1515,6 @@ class JavaScriptBackend extends Target {
return staticFields;
}
- /// Called when [enqueuer]'s queue is empty, but before it is closed.
- ///
- /// This is used, for example, by the JS backend to enqueue additional
- /// elements needed for reflection. [recentClasses] is a collection of
- /// all classes seen for the first time by the [enqueuer] since the last call
- /// to [onQueueEmpty].
- ///
- /// A return value of [:true:] indicates that [recentClasses] has been
- /// processed and its elements do not need to be seen in the next round. When
- /// [:false:] is returned, [onQueueEmpty] will be called again once the
- /// resolution queue has drained and [recentClasses] will be a superset of the
- /// current value.
- ///
- /// There is no guarantee that a class is only present once in
- /// [recentClasses], but every class seen by the [enqueuer] will be present in
- /// [recentClasses] at least once.
bool onQueueEmpty(Enqueuer enqueuer, Iterable<ClassEntity> recentClasses) {
// Add elements used synthetically, that is, through features rather than
// syntax, for instance custom elements.
« no previous file with comments | « pkg/compiler/lib/src/enqueue.dart ('k') | tests/compiler/dart2js/kernel/closed_world_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698