| 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 7a6b935605d5a293a9c130b67bc5e69568fd1012..e7612f993f587a61ae47e7834fad81ab9e132d5f 100644
|
| --- a/pkg/compiler/lib/src/js_backend/backend.dart
|
| +++ b/pkg/compiler/lib/src/js_backend/backend.dart
|
| @@ -405,8 +405,11 @@ class JavaScriptBackend {
|
| /// Support for classifying `noSuchMethod` implementations.
|
| NoSuchMethodRegistry noSuchMethodRegistry;
|
|
|
| - /// Resolution and codegen support for computing reflectable elements.
|
| - MirrorsAnalysis mirrorsAnalysis;
|
| + /// Resolution support for computing reflectable elements.
|
| + MirrorsResolutionAnalysis _mirrorsResolutionAnalysis;
|
| +
|
| + /// Codegen support for computing reflectable elements.
|
| + MirrorsCodegenAnalysis _mirrorsCodegenAnalysis;
|
|
|
| /// Builds kernel representation for the program.
|
| KernelTask kernelTask;
|
| @@ -533,7 +536,8 @@ class JavaScriptBackend {
|
| helpers,
|
| nativeBaseData);
|
| jsInteropAnalysis = new JsInteropAnalysis(this);
|
| - mirrorsAnalysis = new MirrorsAnalysis(this, compiler.resolution);
|
| + _mirrorsResolutionAnalysis =
|
| + new MirrorsResolutionAnalysisImpl(this, compiler.resolution);
|
| lookupMapResolutionAnalysis =
|
| new LookupMapResolutionAnalysis(reporter, compiler.elementEnvironment);
|
|
|
| @@ -574,14 +578,16 @@ class JavaScriptBackend {
|
|
|
| /// Resolution analysis for tracking reflective access to type variables.
|
| TypeVariableResolutionAnalysis get typeVariableResolutionAnalysis {
|
| - assert(invariant(NO_LOCATION_SPANNABLE, _typeVariableCodegenAnalysis == null,
|
| + assert(invariant(
|
| + NO_LOCATION_SPANNABLE, _typeVariableCodegenAnalysis == null,
|
| message: "TypeVariableHandler has already been created."));
|
| return _typeVariableResolutionAnalysis;
|
| }
|
|
|
| /// Codegen handler for reflective access to type variables.
|
| TypeVariableCodegenAnalysis get typeVariableCodegenAnalysis {
|
| - assert(invariant(NO_LOCATION_SPANNABLE, _typeVariableCodegenAnalysis != null,
|
| + assert(invariant(
|
| + NO_LOCATION_SPANNABLE, _typeVariableCodegenAnalysis != null,
|
| message: "TypeVariableHandler has not been created yet."));
|
| return _typeVariableCodegenAnalysis;
|
| }
|
| @@ -590,6 +596,17 @@ class JavaScriptBackend {
|
|
|
| MirrorsDataBuilder get mirrorsDataBuilder => _mirrorsData;
|
|
|
| + /// Resolution support for computing reflectable elements.
|
| + MirrorsResolutionAnalysis get mirrorsResolutionAnalysis =>
|
| + _mirrorsResolutionAnalysis;
|
| +
|
| + /// Codegen support for computing reflectable elements.
|
| + MirrorsCodegenAnalysis get mirrorsCodegenAnalysis {
|
| + assert(invariant(NO_LOCATION_SPANNABLE, _mirrorsCodegenAnalysis != null,
|
| + message: "MirrorsCodegenAnalysis has not been created yet."));
|
| + return _mirrorsCodegenAnalysis;
|
| + }
|
| +
|
| /// Codegen support for tree-shaking entries of `LookupMap`.
|
| LookupMapAnalysis get lookupMapAnalysis {
|
| assert(invariant(NO_LOCATION_SPANNABLE, _lookupMapAnalysis != null,
|
| @@ -813,7 +830,7 @@ class JavaScriptBackend {
|
| _interceptorDataBuilder.onResolutionComplete(closedWorld);
|
| _oneShotInterceptorData =
|
| new OneShotInterceptorData(interceptorData, helpers);
|
| - mirrorsAnalysis.onResolutionComplete();
|
| + mirrorsResolutionAnalysis.onResolutionComplete();
|
| }
|
|
|
| void onTypeInferenceComplete() {
|
| @@ -895,7 +912,7 @@ class JavaScriptBackend {
|
| noSuchMethodRegistry,
|
| customElementsResolutionAnalysis,
|
| lookupMapResolutionAnalysis,
|
| - mirrorsAnalysis,
|
| + mirrorsResolutionAnalysis,
|
| typeVariableResolutionAnalysis,
|
| _nativeResolutionEnqueuer),
|
| new ElementResolutionWorldBuilder(
|
| @@ -906,7 +923,8 @@ class JavaScriptBackend {
|
| /// Creates an [Enqueuer] for code generation specific to this backend.
|
| CodegenEnqueuer createCodegenEnqueuer(
|
| CompilerTask task, Compiler compiler, ClosedWorld closedWorld) {
|
| - _typeVariableCodegenAnalysis = new TypeVariableCodegenAnalysis(this, helpers, mirrorsData);
|
| + _typeVariableCodegenAnalysis =
|
| + new TypeVariableCodegenAnalysis(this, helpers, mirrorsData);
|
| _lookupMapAnalysis = new LookupMapAnalysis(
|
| reporter,
|
| constantSystem,
|
| @@ -916,6 +934,7 @@ class JavaScriptBackend {
|
| helpers,
|
| backendClasses,
|
| lookupMapResolutionAnalysis);
|
| + _mirrorsCodegenAnalysis = mirrorsResolutionAnalysis.close();
|
| return new CodegenEnqueuer(
|
| task,
|
| compiler.options,
|
| @@ -934,7 +953,7 @@ class JavaScriptBackend {
|
| customElementsCodegenAnalysis,
|
| typeVariableCodegenAnalysis,
|
| lookupMapAnalysis,
|
| - mirrorsAnalysis,
|
| + mirrorsCodegenAnalysis,
|
| _nativeCodegenEnqueuer));
|
| }
|
|
|
| @@ -1043,9 +1062,9 @@ class JavaScriptBackend {
|
| int programSize = emitter.assembleProgram(namer, closedWorld);
|
| noSuchMethodRegistry.emitDiagnostic();
|
| int totalMethodCount = generatedCode.length;
|
| - if (totalMethodCount != mirrorsAnalysis.preMirrorsMethodCount) {
|
| + if (totalMethodCount != mirrorsCodegenAnalysis.preMirrorsMethodCount) {
|
| int mirrorCount =
|
| - totalMethodCount - mirrorsAnalysis.preMirrorsMethodCount;
|
| + totalMethodCount - mirrorsCodegenAnalysis.preMirrorsMethodCount;
|
| double percentage = (mirrorCount / totalMethodCount) * 100;
|
| DiagnosticMessage hint =
|
| reporter.createMessage(compiler.mainApp, MessageKind.MIRROR_BLOAT, {
|
|
|