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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library js_backend.backend; 5 library js_backend.backend;
6 6
7 import 'dart:async' show Future; 7 import 'dart:async' show Future;
8 8
9 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; 9 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames;
10 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 import '../universe/world_builder.dart'; 52 import '../universe/world_builder.dart';
53 import '../universe/use.dart' 53 import '../universe/use.dart'
54 show DynamicUse, StaticUse, StaticUseKind, TypeUse, TypeUseKind; 54 show DynamicUse, StaticUse, StaticUseKind, TypeUse, TypeUseKind;
55 import '../universe/world_impact.dart' 55 import '../universe/world_impact.dart'
56 show 56 show
57 ImpactStrategy, 57 ImpactStrategy,
58 ImpactUseCase, 58 ImpactUseCase,
59 TransformedWorldImpact, 59 TransformedWorldImpact,
60 WorldImpact, 60 WorldImpact,
61 WorldImpactBuilder, 61 WorldImpactBuilder,
62 WorldImpactBuilderImpl,
62 WorldImpactVisitor, 63 WorldImpactVisitor,
63 StagedWorldImpactBuilder; 64 StagedWorldImpactBuilder;
64 import '../util/util.dart'; 65 import '../util/util.dart';
65 import '../world.dart' show ClosedWorld; 66 import '../world.dart' show ClosedWorld;
66 import 'backend_helpers.dart'; 67 import 'backend_helpers.dart';
67 import 'backend_impact.dart'; 68 import 'backend_impact.dart';
68 import 'backend_serialization.dart' show JavaScriptBackendSerialization; 69 import 'backend_serialization.dart' show JavaScriptBackendSerialization;
69 import 'checked_mode_helpers.dart'; 70 import 'checked_mode_helpers.dart';
70 import 'constant_handler_javascript.dart'; 71 import 'constant_handler_javascript.dart';
71 import 'custom_elements_analysis.dart'; 72 import 'custom_elements_analysis.dart';
(...skipping 2498 matching lines...) Expand 10 before | Expand all | Expand 10 after
2570 FunctionElement helperForMissingMain() => helpers.missingMain; 2571 FunctionElement helperForMissingMain() => helpers.missingMain;
2571 2572
2572 FunctionElement helperForMainArity() => helpers.mainHasTooManyParameters; 2573 FunctionElement helperForMainArity() => helpers.mainHasTooManyParameters;
2573 2574
2574 void forgetElement(Element element) { 2575 void forgetElement(Element element) {
2575 constants.forgetElement(element); 2576 constants.forgetElement(element);
2576 constantCompilerTask.dartConstantCompiler.forgetElement(element); 2577 constantCompilerTask.dartConstantCompiler.forgetElement(element);
2577 aliasedSuperMembers.remove(element); 2578 aliasedSuperMembers.remove(element);
2578 } 2579 }
2579 2580
2580 void registerMainHasArguments(Enqueuer enqueuer) { 2581 @override
2581 // If the main method takes arguments, this compilation could be the target 2582 WorldImpact computeMainImpact(Enqueuer enqueuer, MethodElement mainMethod) {
2582 // of Isolate.spawnUri. Strictly speaking, that can happen also if main 2583 WorldImpactBuilderImpl mainImpact = new WorldImpactBuilderImpl();
2583 // takes no arguments, but in this case the spawned isolate can't 2584 if (mainMethod.parameters.isNotEmpty) {
2584 // communicate with the spawning isolate. 2585 mainImpact.registerTypeUse(
2585 enqueuer.enableIsolateSupport(); 2586 new TypeUse.instantiation(backendClasses.listImplementation.rawType));
2587 mainImpact.registerTypeUse(new TypeUse.instantiation(
2588 backendClasses.stringImplementation.rawType));
2589 mainImpact.registerStaticUse(
2590 new StaticUse.staticInvoke(mainMethod, CallStructure.TWO_ARGS));
2591
2592 // If the main method takes arguments, this compilation could be the
2593 // target of Isolate.spawnUri. Strictly speaking, that can happen also if
2594 // main takes no arguments, but in this case the spawned isolate can't
2595 // communicate with the spawning isolate.
2596 enqueuer.enableIsolateSupport();
2597 }
2598 mainImpact.registerStaticUse(
2599 new StaticUse.staticInvoke(mainMethod, CallStructure.NO_ARGS));
2600 return mainImpact;
2586 } 2601 }
2587 2602
2588 /// Returns the filename for the output-unit named [name]. 2603 /// Returns the filename for the output-unit named [name].
2589 /// 2604 ///
2590 /// The filename is of the form "<main output file>_<name>.part.js". 2605 /// The filename is of the form "<main output file>_<name>.part.js".
2591 /// If [addExtension] is false, the ".part.js" suffix is left out. 2606 /// If [addExtension] is false, the ".part.js" suffix is left out.
2592 String deferredPartFileName(String name, {bool addExtension: true}) { 2607 String deferredPartFileName(String name, {bool addExtension: true}) {
2593 assert(name != ""); 2608 assert(name != "");
2594 String outPath = compiler.options.outputUri != null 2609 String outPath = compiler.options.outputUri != null
2595 ? compiler.options.outputUri.path 2610 ? compiler.options.outputUri.path
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
3278 ClassElement get mapImplementation => helpers.mapLiteralClass; 3293 ClassElement get mapImplementation => helpers.mapLiteralClass;
3279 ClassElement get constMapImplementation => helpers.constMapLiteralClass; 3294 ClassElement get constMapImplementation => helpers.constMapLiteralClass;
3280 ClassElement get typeImplementation => helpers.typeLiteralClass; 3295 ClassElement get typeImplementation => helpers.typeLiteralClass;
3281 ClassElement get boolImplementation => helpers.jsBoolClass; 3296 ClassElement get boolImplementation => helpers.jsBoolClass;
3282 ClassElement get nullImplementation => helpers.jsNullClass; 3297 ClassElement get nullImplementation => helpers.jsNullClass;
3283 ClassElement get syncStarIterableImplementation => helpers.syncStarIterable; 3298 ClassElement get syncStarIterableImplementation => helpers.syncStarIterable;
3284 ClassElement get asyncFutureImplementation => helpers.futureImplementation; 3299 ClassElement get asyncFutureImplementation => helpers.futureImplementation;
3285 ClassElement get asyncStarStreamImplementation => helpers.controllerStream; 3300 ClassElement get asyncStarStreamImplementation => helpers.controllerStream;
3286 ClassElement get functionImplementation => helpers.coreClasses.functionClass; 3301 ClassElement get functionImplementation => helpers.coreClasses.functionClass;
3287 } 3302 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698