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

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

Issue 2871583002: Pass InterceptorData through ResolutionWorldBuilder and access it through ClosedWorld (Closed)
Patch Set: Created 3 years, 7 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/frontend_strategy.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/backend.dart
diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart
index d531ffdb5275446188fba7a0c378d31fc35e2b19..10f6dd4c91b2a9e924e992068cf25a754bec0639 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -441,8 +441,6 @@ class JavaScriptBackend {
NativeBasicDataImpl _nativeBasicData;
NativeDataBuilder get nativeDataBuilder => _nativeDataBuilder;
final NativeDataResolver _nativeDataResolver;
- InterceptorDataBuilder _interceptorDataBuilder;
- InterceptorData _interceptorData;
OneShotInterceptorData _oneShotInterceptorData;
BackendUsage _backendUsage;
BackendUsageBuilder _backendUsageBuilder;
@@ -602,18 +600,6 @@ class JavaScriptBackend {
return _lookupMapAnalysis;
}
- InterceptorData get interceptorData {
- assert(invariant(NO_LOCATION_SPANNABLE, _interceptorData != null,
- message: "InterceptorData has not been computed yet."));
- return _interceptorData;
- }
-
- InterceptorDataBuilder get interceptorDataBuilder {
- assert(invariant(NO_LOCATION_SPANNABLE, _interceptorData == null,
- message: "InterceptorData has already been computed."));
- return _interceptorDataBuilder;
- }
-
OneShotInterceptorData get oneShotInterceptorData {
assert(invariant(NO_LOCATION_SPANNABLE, _oneShotInterceptorData != null,
message: "OneShotInterceptorData has not been prepared yet."));
@@ -777,7 +763,6 @@ class JavaScriptBackend {
compiler.frontEndStrategy.annotationProcesser
.processJsInteropAnnotations(nativeBasicData, nativeDataBuilder);
_backendUsage = backendUsageBuilder.close();
- _interceptorData = interceptorDataBuilder.onResolutionComplete();
}
/// Called when the closed world from resolution has been computed.
@@ -796,8 +781,6 @@ class JavaScriptBackend {
commonElements,
_backendUsage,
enableTypeAssertions: compiler.options.enableTypeAssertions);
- _oneShotInterceptorData =
- new OneShotInterceptorData(interceptorData, commonElements);
mirrorsResolutionAnalysis.onResolutionComplete();
}
@@ -862,8 +845,9 @@ class JavaScriptBackend {
mirrorsDataBuilder,
customElementsResolutionAnalysis,
rtiNeedBuilder);
- _interceptorDataBuilder = new InterceptorDataBuilderImpl(
- nativeBasicData, compiler.elementEnvironment, commonElements);
+ InterceptorDataBuilder interceptorDataBuilder =
+ new InterceptorDataBuilderImpl(
+ nativeBasicData, compiler.elementEnvironment, commonElements);
return new ResolutionEnqueuer(
task,
compiler.options,
@@ -890,7 +874,10 @@ class JavaScriptBackend {
compiler.deferredLoadTask,
kernelTask),
compiler.frontEndStrategy.createResolutionWorldBuilder(
- nativeBasicData, _nativeDataBuilder, const OpenWorldStrategy()),
+ nativeBasicData,
+ _nativeDataBuilder,
+ interceptorDataBuilder,
+ const OpenWorldStrategy()),
compiler.frontEndStrategy
.createResolutionWorkItemBuilder(impactTransformer));
}
@@ -923,7 +910,7 @@ class JavaScriptBackend {
const TreeShakingEnqueuerStrategy(),
new CodegenWorldBuilderImpl(
nativeBasicData, closedWorld, constants, const TypeMaskStrategy()),
- new CodegenWorkItemBuilder(this, compiler.options),
+ new CodegenWorkItemBuilder(this, closedWorld, compiler.options),
new CodegenEnqueuerListener(
compiler.elementEnvironment,
commonElements,
@@ -937,7 +924,7 @@ class JavaScriptBackend {
nativeCodegenEnqueuer));
}
- WorldImpact codegen(CodegenWorkItem work) {
+ WorldImpact codegen(CodegenWorkItem work, ClosedWorld closedWorld) {
MemberElement element = work.element;
if (compiler.elementHasCompileTimeError(element)) {
DiagnosticMessage message =
@@ -995,7 +982,7 @@ class JavaScriptBackend {
}
}
- jsAst.Fun function = functionCompiler.compile(work, _closedWorld);
+ jsAst.Fun function = functionCompiler.compile(work, closedWorld);
if (function.sourceInformation == null) {
function = function.withSourceInformation(
sourceInformationStrategy.buildSourceMappedMarker());
@@ -1126,24 +1113,12 @@ class JavaScriptBackend {
}
}
- // TODO(johnniwinther): Create a CodegenPhase object for the backend to hold
- // data only available during code generation.
- ClosedWorld _closedWorldCache;
- ClosedWorld get _closedWorld {
- assert(invariant(NO_LOCATION_SPANNABLE, _closedWorldCache != null,
- message: "ClosedWorld has not be set yet."));
- return _closedWorldCache;
- }
-
- void set _closedWorld(ClosedWorld value) {
- _closedWorldCache = value;
- }
-
/// Called when the compiler starts running the codegen enqueuer. The
/// [WorldImpact] of enabled backend features is returned.
WorldImpact onCodegenStart(
ClosedWorld closedWorld, CodegenWorldBuilder codegenWorldBuilder) {
- _closedWorld = closedWorld;
+ _oneShotInterceptorData =
+ new OneShotInterceptorData(closedWorld.interceptorData, commonElements);
_namer = determineNamer(closedWorld, codegenWorldBuilder);
tracer = new Tracer(closedWorld, namer, compiler);
_rtiEncoder =
« no previous file with comments | « pkg/compiler/lib/src/frontend_strategy.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