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

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

Issue 2488353004: Remove Compiler access from ResolutionEnqueuer (Closed)
Patch Set: Updated cf. comments. Created 4 years, 1 month 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/common/resolution.dart ('k') | pkg/compiler/lib/src/dump_info.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/compiler.dart
diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart
index 27041ccf972cc9c2afd607044c53fdec3355cee5..c2f91fee4123a802c082b4713603f0b074dadf7c 100644
--- a/pkg/compiler/lib/src/compiler.dart
+++ b/pkg/compiler/lib/src/compiler.dart
@@ -76,7 +76,12 @@ import 'universe/selector.dart' show Selector;
import 'universe/world_builder.dart'
show ResolutionWorldBuilder, CodegenWorldBuilder;
import 'universe/use.dart' show StaticUse;
-import 'universe/world_impact.dart' show ImpactStrategy, WorldImpact, WorldImpactBuilderImpl;
+import 'universe/world_impact.dart'
+ show
+ ImpactStrategy,
+ WorldImpact,
+ WorldImpactBuilder,
+ WorldImpactBuilderImpl;
import 'util/util.dart' show Link, Setlet;
import 'world.dart' show ClosedWorld, ClosedWorldRefiner, OpenWorld, WorldImpl;
@@ -89,7 +94,7 @@ abstract class Compiler implements LibraryLoaderListener {
Measurer get measurer;
final IdGenerator idGenerator = new IdGenerator();
- WorldImpl _world;
+ WorldImpl get _world => resolverWorld.openWorld;
Types types;
_CompilerCoreTypes _coreTypes;
CompilerDiagnosticReporter _reporter;
@@ -139,7 +144,6 @@ abstract class Compiler implements LibraryLoaderListener {
CommonElements get commonElements => _coreTypes;
CoreClasses get coreClasses => _coreTypes;
CoreTypes get coreTypes => _coreTypes;
- CommonMasks get commonMasks => globalInference.masks;
Resolution get resolution => _resolution;
ParsingContext get parsingContext => _parsingContext;
@@ -184,10 +188,8 @@ abstract class Compiler implements LibraryLoaderListener {
/// A customizable filter that is applied to enqueued work items.
QueueFilter enqueuerFilter = new QueueFilter();
- bool enabledRuntimeType = false;
- bool enabledFunctionApply = false;
- bool enabledInvokeOn = false;
- bool hasIsolateSupport = false;
+ bool get hasFunctionApplySupport => resolverWorld.hasFunctionApplySupport;
+ bool get hasIsolateSupport => resolverWorld.hasIsolateSupport;
bool get hasCrashed => _reporter.hasCrashed;
@@ -216,7 +218,6 @@ abstract class Compiler implements LibraryLoaderListener {
this.userOutputProvider = outputProvider == null
? const NullCompilerOutput()
: outputProvider {
- _world = new WorldImpl(this);
if (makeReporter != null) {
_reporter = makeReporter(this, options);
} else {
@@ -248,6 +249,7 @@ abstract class Compiler implements LibraryLoaderListener {
useKernel: options.useKernel);
backend = jsBackend;
}
+ enqueuer = backend.makeEnqueuer();
if (options.dumpInfo && options.useStartupEmitter) {
throw new ArgumentError(
@@ -279,7 +281,9 @@ abstract class Compiler implements LibraryLoaderListener {
constants = backend.constantCompilerTask,
deferredLoadTask = new DeferredLoadTask(this),
mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this),
- enqueuer = backend.makeEnqueuer(),
+ // [enqueuer] is created earlier because it contains the resolution world
+ // objects needed by other tasks.
+ enqueuer,
dumpInfoTask = new DumpInfoTask(this),
selfTask = new GenericTask('self', measurer),
];
@@ -646,7 +650,7 @@ abstract class Compiler implements LibraryLoaderListener {
// something to the resolution queue. So we cannot wait with
// this until after the resolution queue is processed.
deferredLoadTask.beforeResolution(this);
- impactStrategy = backend.createImpactStrategy(
+ ImpactStrategy impactStrategy = backend.createImpactStrategy(
supportDeferredLoad: deferredLoadTask.isProgramSplit,
supportDumpInfo: options.dumpInfo,
supportSerialization: serialization.supportSerialization);
@@ -754,7 +758,7 @@ abstract class Compiler implements LibraryLoaderListener {
void closeResolution() {
phase = PHASE_DONE_RESOLVING;
- openWorld.closeWorld();
+ openWorld.closeWorld(reporter);
// Compute whole-program-knowledge that the backend needs. (This might
// require the information computed in [world.closeWorld].)
backend.onResolutionComplete();
@@ -826,28 +830,30 @@ abstract class Compiler implements LibraryLoaderListener {
}
/**
- * Empty the [world] queue.
+ * Empty the [enqueuer] queue.
*/
- void emptyQueue(Enqueuer world) =>
- selfTask.measureSubtask("Compiler.emptyQueue", () {
- world.forEach((WorkItem work) {
- reporter.withCurrentElement(
- work.element,
- () => selfTask.measureSubtask("world.applyImpact", () {
- world.applyImpact(
- selfTask.measureSubtask(
- "work.run", () => work.run(this, world)),
- impactSource: work.element);
- }));
- });
+ void emptyQueue(Enqueuer enqueuer) {
+ selfTask.measureSubtask("Compiler.emptyQueue", () {
+ enqueuer.forEach((WorkItem work) {
+ reporter.withCurrentElement(
+ work.element,
+ () => selfTask.measureSubtask("world.applyImpact", () {
+ enqueuer.applyImpact(
+ impactStrategy,
+ selfTask.measureSubtask(
+ "work.run", () => work.run(this, enqueuer)),
+ impactSource: work.element);
+ }));
});
+ });
+ }
void processQueue(Enqueuer enqueuer, Element main) {
selfTask.measureSubtask("Compiler.processQueue", () {
WorldImpactBuilderImpl nativeImpact = new WorldImpactBuilderImpl();
enqueuer.nativeEnqueuer
.processNativeClasses(nativeImpact, libraryLoader.libraries);
- enqueuer.applyImpact(nativeImpact);
+ enqueuer.applyImpact(impactStrategy, nativeImpact);
if (main != null && !main.isMalformed) {
FunctionElement mainMethod = main;
mainMethod.computeType(resolution);
@@ -2038,6 +2044,13 @@ class _CompilerResolution implements Resolution {
}
@override
+ void ensureClassMembers(ClassElement element) {
+ if (!compiler.serialization.isDeserialized(element)) {
+ compiler.resolver.checkClass(element);
+ }
+ }
+
+ @override
void registerCompileTimeError(Element element, DiagnosticMessage message) =>
compiler.registerCompileTimeError(element, message);
@@ -2138,7 +2151,8 @@ class _CompilerResolution implements Resolution {
WorldImpact transformResolutionImpact(
Element element, ResolutionImpact resolutionImpact) {
WorldImpact worldImpact = compiler.backend.impactTransformer
- .transformResolutionImpact(compiler.enqueuer.resolution, resolutionImpact);
+ .transformResolutionImpact(
+ compiler.enqueuer.resolution, resolutionImpact);
_worldImpactCache[element] = worldImpact;
return worldImpact;
}
« no previous file with comments | « pkg/compiler/lib/src/common/resolution.dart ('k') | pkg/compiler/lib/src/dump_info.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698