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

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

Issue 2494093002: Refactor enqueuers (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/backend_api.dart ('k') | pkg/compiler/lib/src/deferred_load.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 536a2794bbbb4aab262ea5c37792bdea108da24f..c2dad31db863edc336d78b9bc1159352e74b27ff 100644
--- a/pkg/compiler/lib/src/compiler.dart
+++ b/pkg/compiler/lib/src/compiler.dart
@@ -76,7 +76,8 @@ 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;
+import 'universe/world_impact.dart'
+ show ImpactStrategy, WorldImpact, WorldImpactBuilderImpl;
import 'util/util.dart' show Link, Setlet;
import 'world.dart' show ClosedWorld, ClosedWorldRefiner, OpenWorld, WorldImpl;
@@ -114,16 +115,6 @@ abstract class Compiler implements LibraryLoaderListener {
*/
GlobalDependencyRegistry globalDependencies;
- /**
- * Dependencies that are only included due to mirrors.
- *
- * We should get rid of this and ensure that all dependencies are
- * associated with a particular element.
- */
- // TODO(johnniwinther): This should not be a [ResolutionRegistry].
- final Registry mirrorDependencies =
- new ResolutionRegistry(null, new TreeElementMapping(null));
-
/// Options provided from command-line arguments.
final CompilerOptions options;
@@ -687,7 +678,7 @@ abstract class Compiler implements LibraryLoaderListener {
}
// Elements required by enqueueHelpers are global dependencies
// that are not pulled in by a particular element.
- backend.enqueueHelpers(enqueuer.resolution, globalDependencies);
+ backend.enqueueHelpers(enqueuer.resolution);
resolveLibraryMetadata();
reporter.log('Resolving...');
processQueue(enqueuer.resolution, mainFunction);
@@ -737,7 +728,6 @@ abstract class Compiler implements LibraryLoaderListener {
reporter.log('Compiling...');
phase = PHASE_COMPILING;
backend.onCodegenStart();
- // TODO(johnniwinther): Move these to [CodegenEnqueuer].
if (hasIsolateSupport) {
backend.enableIsolateSupport(enqueuer.codegen);
}
@@ -817,7 +807,7 @@ abstract class Compiler implements LibraryLoaderListener {
ClassElement cls = element;
cls.ensureResolved(resolution);
cls.forEachLocalMember(enqueuer.resolution.addToWorkList);
- backend.registerInstantiatedType(cls.rawType, world, globalDependencies);
+ world.registerInstantiatedType(cls.rawType);
} else {
world.addToWorkList(element);
}
@@ -853,43 +843,42 @@ abstract class Compiler implements LibraryLoaderListener {
});
});
- void processQueue(Enqueuer world, Element main) =>
- selfTask.measureSubtask("Compiler.processQueue", () {
- world.nativeEnqueuer.processNativeClasses(libraryLoader.libraries);
- if (main != null && !main.isMalformed) {
- FunctionElement mainMethod = main;
- mainMethod.computeType(resolution);
- if (mainMethod.functionSignature.parameterCount != 0) {
- // The first argument could be a list of strings.
- backend.backendClasses.listImplementation
- .ensureResolved(resolution);
- backend.registerInstantiatedType(
- backend.backendClasses.listImplementation.rawType,
- world,
- globalDependencies);
- backend.backendClasses.stringImplementation
- .ensureResolved(resolution);
- backend.registerInstantiatedType(
- backend.backendClasses.stringImplementation.rawType,
- world,
- globalDependencies);
-
- backend.registerMainHasArguments(world);
- }
- world.addToWorkList(main);
+ void processQueue(Enqueuer enqueuer, Element main) {
+ selfTask.measureSubtask("Compiler.processQueue", () {
+ WorldImpactBuilderImpl nativeImpact = new WorldImpactBuilderImpl();
+ enqueuer.nativeEnqueuer
+ .processNativeClasses(nativeImpact, libraryLoader.libraries);
+ enqueuer.applyImpact(nativeImpact);
+ if (main != null && !main.isMalformed) {
+ FunctionElement mainMethod = main;
+ mainMethod.computeType(resolution);
+ if (mainMethod.functionSignature.parameterCount != 0) {
+ // The first argument could be a list of strings.
+ backend.backendClasses.listImplementation.ensureResolved(resolution);
+ enqueuer.registerInstantiatedType(
+ backend.backendClasses.listImplementation.rawType);
+ backend.backendClasses.stringImplementation
+ .ensureResolved(resolution);
+ enqueuer.registerInstantiatedType(
+ backend.backendClasses.stringImplementation.rawType);
+
+ backend.registerMainHasArguments(enqueuer);
}
- if (options.verbose) {
- progress.reset();
- }
- emptyQueue(world);
- world.queueIsClosed = true;
- // Notify the impact strategy impacts are no longer needed for this
- // enqueuer.
- impactStrategy.onImpactUsed(world.impactUse);
- backend.onQueueClosed();
- assert(
- compilationFailed || world.checkNoEnqueuedInvokedInstanceMethods());
- });
+ enqueuer.addToWorkList(main);
+ }
+ if (options.verbose) {
+ progress.reset();
+ }
+ emptyQueue(enqueuer);
+ enqueuer.queueIsClosed = true;
+ // Notify the impact strategy impacts are no longer needed for this
+ // enqueuer.
+ impactStrategy.onImpactUsed(enqueuer.impactUse);
+ backend.onQueueClosed();
+ assert(compilationFailed ||
+ enqueuer.checkNoEnqueuedInvokedInstanceMethods());
+ });
+ }
/**
* Perform various checks of the queues. This includes checking that
@@ -2150,7 +2139,8 @@ class _CompilerResolution implements Resolution {
WorldImpact transformResolutionImpact(
Element element, ResolutionImpact resolutionImpact) {
WorldImpact worldImpact = compiler.backend.impactTransformer
- .transformResolutionImpact(resolutionImpact);
+ .transformResolutionImpact(
+ compiler.enqueuer.resolution, resolutionImpact);
_worldImpactCache[element] = worldImpact;
return worldImpact;
}
« no previous file with comments | « pkg/compiler/lib/src/common/backend_api.dart ('k') | pkg/compiler/lib/src/deferred_load.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698