| Index: pkg/compiler/lib/src/common/backend_api.dart
|
| diff --git a/pkg/compiler/lib/src/common/backend_api.dart b/pkg/compiler/lib/src/common/backend_api.dart
|
| index 2bb7001798d1f93dba50e4768471892cea45ef41..089058ca32bf9c5d80ca95da9b373216c306c72d 100644
|
| --- a/pkg/compiler/lib/src/common/backend_api.dart
|
| +++ b/pkg/compiler/lib/src/common/backend_api.dart
|
| @@ -82,7 +82,8 @@ abstract class Backend extends Target {
|
|
|
| void initializeHelperClasses() {}
|
|
|
| - void enqueueHelpers(ResolutionEnqueuer world);
|
| + /// Compute the [WorldImpact] for backend helper methods.
|
| + WorldImpact computeHelpersImpact();
|
|
|
| /// Creates an [Enqueuer] for code generation specific to this backend.
|
| Enqueuer createCodegenEnqueuer(CompilerTask task, Compiler compiler);
|
| @@ -116,21 +117,27 @@ abstract class Backend extends Target {
|
|
|
| /// Enable deferred loading. Returns `true` if the backend supports deferred
|
| /// loading.
|
| - bool enableDeferredLoadingIfSupported(
|
| - ResolutionEnqueuer enqueuer, Spannable node);
|
| + bool enableDeferredLoadingIfSupported(Spannable node);
|
| +
|
| + /// Returns the [WorldImpact] of enabling deferred loading.
|
| + WorldImpact computeDeferredLoadingImpact() => const WorldImpact();
|
|
|
| /// Called during codegen when [constant] has been used.
|
| void computeImpactForCompileTimeConstant(ConstantValue constant,
|
| WorldImpactBuilder impactBuilder, bool isForResolution) {}
|
|
|
| - /// Called to notify to the backend that a class is being instantiated.
|
| - // TODO(johnniwinther): Remove this. It's only called once for each [cls] and
|
| - // only with [Compiler.globalDependencies] as [registry].
|
| - void registerInstantiatedClass(ClassElement cls, Enqueuer enqueuer) {}
|
| + /// 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}) =>
|
| + const WorldImpact();
|
|
|
| /// Called to notify to the backend that a class is implemented by an
|
| - /// instantiated class.
|
| - void registerImplementedClass(ClassElement cls, Enqueuer enqueuer) {}
|
| + /// instantiated class. Any backend specific [WorldImpact] of this is
|
| + /// returned.
|
| + WorldImpact registerImplementedClass(ClassElement cls,
|
| + {bool forResolution}) =>
|
| + const WorldImpact();
|
|
|
| /// Called to instruct to the backend register [type] as instantiated on
|
| /// [enqueuer].
|
| @@ -141,40 +148,47 @@ abstract class Backend extends Target {
|
| void registerTypeVariableBoundsSubtypeCheck(
|
| DartType typeArgument, DartType bound) {}
|
|
|
| - /**
|
| - * Call this to register that an instantiated generic class has a call
|
| - * method.
|
| - */
|
| - void registerCallMethodWithFreeTypeVariables(
|
| - Element callMethod, Enqueuer enqueuer) {}
|
| + /// Called to register that an instantiated generic class has a call method.
|
| + /// Any backend specific [WorldImpact] of this is returned.
|
| + ///
|
| + /// Note: The [callMethod] is registered even thought it doesn't reference
|
| + /// the type variables.
|
| + WorldImpact registerCallMethodWithFreeTypeVariables(Element callMethod,
|
| + {bool forResolution}) =>
|
| + const WorldImpact();
|
|
|
| /// Called to instruct the backend to register that a closure exists for a
|
| - /// function on an instantiated generic class.
|
| - void registerClosureWithFreeTypeVariables(
|
| - Element closure, Enqueuer enqueuer) {}
|
| + /// function on an instantiated generic class. Any backend specific
|
| + /// [WorldImpact] of this is returned.
|
| + WorldImpact registerClosureWithFreeTypeVariables(Element closure,
|
| + {bool forResolution}) =>
|
| + const WorldImpact();
|
|
|
| - /// Call this to register that a member has been closurized.
|
| - void registerBoundClosure(Enqueuer enqueuer) {}
|
| + /// Called to register that a member has been closurized. Any backend specific
|
| + /// [WorldImpact] of this is returned.
|
| + WorldImpact registerBoundClosure() => const WorldImpact();
|
|
|
| - /// Call this to register that a static function has been closurized.
|
| - void registerGetOfStaticFunction(Enqueuer enqueuer) {}
|
| + /// Called to register that a static function has been closurized. Any backend
|
| + /// specific [WorldImpact] of this is returned.
|
| + WorldImpact registerGetOfStaticFunction() => const WorldImpact();
|
|
|
| - /**
|
| - * Call this to register that the [:runtimeType:] property has been accessed.
|
| - */
|
| - void registerRuntimeType(Enqueuer enqueuer) {}
|
| + /// Called to register that the `runtimeType` property has been accessed. Any
|
| + /// backend specific [WorldImpact] of this is returned.
|
| + WorldImpact registerRuntimeType() => const WorldImpact();
|
|
|
| - /// Call this to register a `noSuchMethod` implementation.
|
| + /// Called to register a `noSuchMethod` implementation.
|
| void registerNoSuchMethod(FunctionElement noSuchMethodElement) {}
|
|
|
| - /// Call this method to enable support for `noSuchMethod`.
|
| - void enableNoSuchMethod(Enqueuer enqueuer) {}
|
| + /// Called to enable support for `noSuchMethod`. Any backend specific
|
| + /// [WorldImpact] of this is returned.
|
| + WorldImpact enableNoSuchMethod() => const WorldImpact();
|
|
|
| /// Returns whether or not `noSuchMethod` support has been enabled.
|
| bool get enabledNoSuchMethod => false;
|
|
|
| - /// Call this method to enable support for isolates.
|
| - void enableIsolateSupport(Enqueuer enqueuer) {}
|
| + /// Called to enable support for isolates. Any backend specific [WorldImpact]
|
| + /// of this is returned.
|
| + WorldImpact enableIsolateSupport({bool forResolution});
|
|
|
| void registerConstSymbol(String name) {}
|
|
|
| @@ -206,7 +220,10 @@ abstract class Backend extends Target {
|
| return false;
|
| }
|
|
|
| - void registerStaticUse(Enqueuer enqueuer, Element element) {}
|
| + /// Called to register that [element] is statically known to be used. Any
|
| + /// backend specific [WorldImpact] of this is returned.
|
| + WorldImpact registerStaticUse(Element element, {bool forResolution}) =>
|
| + const WorldImpact();
|
|
|
| /// This method is called immediately after the [LibraryElement] [library] has
|
| /// been created.
|
| @@ -314,7 +331,9 @@ abstract class Backend extends Target {
|
| void forgetElement(Element element) {}
|
|
|
| /// Computes the [WorldImpact] of calling [mainMethod] as the entry point.
|
| - WorldImpact computeMainImpact(Enqueuer enqueuer, MethodElement mainMethod) {}
|
| + WorldImpact computeMainImpact(MethodElement mainMethod,
|
| + {bool forResolution}) =>
|
| + const WorldImpact();
|
|
|
| /// Returns the location of the patch-file associated with [libraryName]
|
| /// resolved from [plaformConfigUri].
|
|
|