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

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

Issue 2511403002: Compute [WorldImpact] for main method as entrypoint (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/compiler.dart ('k') | pkg/compiler/lib/src/js_backend/backend_impact.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 3aca346a44573348d6c7619816716c32462852b8..03e5839570856295873893783f61988c4c98356e 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,23 @@ 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) {
+ impactTransformer.registerBackendImpact(
+ mainImpact, impacts.mainWithArguments);
+ 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].
@@ -3000,7 +3012,7 @@ class JavaScriptImpactTransformer extends ImpactTransformer {
}
void registerBackendImpact(
- TransformedWorldImpact worldImpact, BackendImpact backendImpact) {
+ WorldImpactBuilder worldImpact, BackendImpact backendImpact) {
for (Element staticUse in backendImpact.staticUses) {
assert(staticUse != null);
backend.registerBackendUse(staticUse);
« no previous file with comments | « pkg/compiler/lib/src/compiler.dart ('k') | pkg/compiler/lib/src/js_backend/backend_impact.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698