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

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

Issue 2511403002: Compute [WorldImpact] for main method as entrypoint (Closed)
Patch Set: 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
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 3aca346a44573348d6c7619816716c32462852b8..4ef276bec241482cbca97de86b44cf150afbbe35 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -59,6 +59,7 @@ import '../universe/world_impact.dart'
TransformedWorldImpact,
WorldImpact,
WorldImpactBuilder,
+ WorldImpactBuilderImpl,
WorldImpactVisitor,
StagedWorldImpactBuilder;
import '../util/util.dart';
@@ -2577,12 +2578,26 @@ class JavaScriptBackend extends Backend {
aliasedSuperMembers.remove(element);
}
- void registerMainHasArguments(Enqueuer enqueuer) {
- // If the main method takes arguments, this compilation could be the target
- // of Isolate.spawnUri. Strictly speaking, that can happen also if main
- // takes no arguments, but in this case the spawned isolate can't
- // communicate with the spawning isolate.
- enqueuer.enableIsolateSupport();
+ @override
+ WorldImpact computeMainImpact(Enqueuer enqueuer, MethodElement mainMethod) {
+ WorldImpactBuilderImpl mainImpact = new WorldImpactBuilderImpl();
+ if (mainMethod.parameters.isNotEmpty) {
+ mainImpact.registerTypeUse(
+ new TypeUse.instantiation(backendClasses.listImplementation.rawType));
+ mainImpact.registerTypeUse(new TypeUse.instantiation(
+ backendClasses.stringImplementation.rawType));
+ mainImpact.registerStaticUse(
+ new StaticUse.staticInvoke(mainMethod, CallStructure.TWO_ARGS));
+
+ // If the main method takes arguments, this compilation could be the
+ // target of Isolate.spawnUri. Strictly speaking, that can happen also if
+ // main takes no arguments, but in this case the spawned isolate can't
+ // communicate with the spawning isolate.
+ enqueuer.enableIsolateSupport();
+ }
+ mainImpact.registerStaticUse(
+ new StaticUse.staticInvoke(mainMethod, CallStructure.NO_ARGS));
+ return mainImpact;
}
/// Returns the filename for the output-unit named [name].

Powered by Google App Engine
This is Rietveld 408576698