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

Side by Side Diff: pkg/compiler/lib/src/deferred_load.dart

Issue 2846433003: Run closed_world2_test using the normal compiler pipeline. (Closed)
Patch Set: Updated cf. comments Created 3 years, 7 months 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
« no previous file with comments | « pkg/compiler/lib/src/compiler.dart ('k') | pkg/compiler/lib/src/enqueue.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 deferred_load; 5 library deferred_load;
6 6
7 import 'common/tasks.dart' show CompilerTask; 7 import 'common/tasks.dart' show CompilerTask;
8 import 'common.dart'; 8 import 'common.dart';
9 import 'compiler.dart' show Compiler; 9 import 'compiler.dart' show Compiler;
10 import 'constants/expressions.dart' show ConstantExpression; 10 import 'constants/expressions.dart' show ConstantExpression;
(...skipping 14 matching lines...) Expand all
25 ExportElement, 25 ExportElement,
26 FunctionElement, 26 FunctionElement,
27 ImportElement, 27 ImportElement,
28 LibraryElement, 28 LibraryElement,
29 MemberElement, 29 MemberElement,
30 MethodElement, 30 MethodElement,
31 MetadataAnnotation, 31 MetadataAnnotation,
32 PrefixElement, 32 PrefixElement,
33 ResolvedAstKind, 33 ResolvedAstKind,
34 TypedefElement; 34 TypedefElement;
35 import 'elements/entities.dart';
35 import 'js_backend/js_backend.dart' show JavaScriptBackend; 36 import 'js_backend/js_backend.dart' show JavaScriptBackend;
36 import 'js_backend/backend_usage.dart' show BackendUsage; 37 import 'js_backend/backend_usage.dart' show BackendUsage;
37 import 'resolution/resolution.dart' show AnalyzableElementX; 38 import 'resolution/resolution.dart' show AnalyzableElementX;
38 import 'resolution/tree_elements.dart' show TreeElements; 39 import 'resolution/tree_elements.dart' show TreeElements;
39 import 'tree/tree.dart' as ast; 40 import 'tree/tree.dart' as ast;
40 import 'universe/use.dart' show StaticUse, StaticUseKind, TypeUse, TypeUseKind; 41 import 'universe/use.dart' show StaticUse, StaticUseKind, TypeUse, TypeUseKind;
41 import 'universe/world_impact.dart' 42 import 'universe/world_impact.dart'
42 show ImpactUseCase, WorldImpact, WorldImpactVisitorImpl; 43 show ImpactUseCase, WorldImpact, WorldImpactVisitorImpl;
43 import 'util/setlet.dart' show Setlet; 44 import 'util/setlet.dart' show Setlet;
44 import 'util/uri_extras.dart' as uri_extras; 45 import 'util/uri_extras.dart' as uri_extras;
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 hunksToLoad[importDeferName[import]] = new List<OutputUnit>(); 655 hunksToLoad[importDeferName[import]] = new List<OutputUnit>();
655 for (OutputUnit outputUnit in sortedOutputUnits) { 656 for (OutputUnit outputUnit in sortedOutputUnits) {
656 if (outputUnit == mainOutputUnit) continue; 657 if (outputUnit == mainOutputUnit) continue;
657 if (outputUnit.imports.contains(import)) { 658 if (outputUnit.imports.contains(import)) {
658 hunksToLoad[importDeferName[import]].add(outputUnit); 659 hunksToLoad[importDeferName[import]].add(outputUnit);
659 } 660 }
660 } 661 }
661 } 662 }
662 } 663 }
663 664
664 void onResolutionComplete(FunctionElement main) { 665 void onResolutionComplete(FunctionEntity main) {
665 if (!isProgramSplit) { 666 if (!isProgramSplit) {
666 allOutputUnits.add(mainOutputUnit); 667 allOutputUnits.add(mainOutputUnit);
667 return; 668 return;
668 } 669 }
669 if (main == null) return; 670 if (main == null) return;
670 LibraryElement mainLibrary = main.library; 671 MethodElement mainMethod = main;
672 LibraryElement mainLibrary = mainMethod.library;
671 _importedDeferredBy = new Map<_DeferredImport, Set<Element>>(); 673 _importedDeferredBy = new Map<_DeferredImport, Set<Element>>();
672 _constantsDeferredBy = new Map<_DeferredImport, Set<ConstantValue>>(); 674 _constantsDeferredBy = new Map<_DeferredImport, Set<ConstantValue>>();
673 _importedDeferredBy[_fakeMainImport] = _mainElements; 675 _importedDeferredBy[_fakeMainImport] = _mainElements;
674 676
675 reporter.withCurrentElement( 677 reporter.withCurrentElement(
676 mainLibrary, 678 mainLibrary,
677 () => measure(() { 679 () => measure(() {
678 // Starting from main, traverse the program and find all 680 // Starting from main, traverse the program and find all
679 // dependencies. 681 // dependencies.
680 _mapDependencies( 682 _mapDependencies(element: mainMethod, import: _fakeMainImport);
681 element: compiler.mainFunction, import: _fakeMainImport);
682 683
683 // Also add "global" dependencies to the main OutputUnit. These 684 // Also add "global" dependencies to the main OutputUnit. These
684 // are things that the backend needs but cannot associate with a 685 // are things that the backend needs but cannot associate with a
685 // particular element, for example, startRootIsolate. This set 686 // particular element, for example, startRootIsolate. This set
686 // also contains elements for which we lack precise information. 687 // also contains elements for which we lack precise information.
687 for (MethodElement element 688 for (MethodElement element
688 in _backendUsage.globalFunctionDependencies) { 689 in _backendUsage.globalFunctionDependencies) {
689 _mapDependencies( 690 _mapDependencies(
690 element: element.implementation, import: _fakeMainImport); 691 element: element.implementation, import: _fakeMainImport);
691 } 692 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 // Generate a unique name for each OutputUnit. 765 // Generate a unique name for each OutputUnit.
765 _assignNamesToOutputUnits(allOutputUnits); 766 _assignNamesToOutputUnits(allOutputUnits);
766 })); 767 }));
767 // Notify the impact strategy impacts are no longer needed for deferred 768 // Notify the impact strategy impacts are no longer needed for deferred
768 // load. 769 // load.
769 compiler.impactStrategy.onImpactUsed(IMPACT_USE); 770 compiler.impactStrategy.onImpactUsed(IMPACT_USE);
770 } 771 }
771 772
772 void beforeResolution(Compiler compiler) { 773 void beforeResolution(Compiler compiler) {
773 if (compiler.mainApp == null) return; 774 if (compiler.mainApp == null) return;
775 // TODO(johnniwinther): Support deferred load for kernel based elements.
776 if (compiler.options.loadFromDill) return;
774 _allDeferredImports[_fakeMainImport] = compiler.mainApp; 777 _allDeferredImports[_fakeMainImport] = compiler.mainApp;
775 var lastDeferred; 778 var lastDeferred;
776 // When detecting duplicate prefixes of deferred libraries there are 4 779 // When detecting duplicate prefixes of deferred libraries there are 4
777 // cases of duplicate prefixes: 780 // cases of duplicate prefixes:
778 // 1. 781 // 1.
779 // import "lib.dart" deferred as a; 782 // import "lib.dart" deferred as a;
780 // import "lib2.dart" deferred as a; 783 // import "lib2.dart" deferred as a;
781 // 2. 784 // 2.
782 // import "lib.dart" deferred as a; 785 // import "lib.dart" deferred as a;
783 // import "lib2.dart" as a; 786 // import "lib2.dart" as a;
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 1077
1075 bool operator ==(other) { 1078 bool operator ==(other) {
1076 if (other is! _DeclaredDeferredImport) return false; 1079 if (other is! _DeclaredDeferredImport) return false;
1077 return declaration == other.declaration; 1080 return declaration == other.declaration;
1078 } 1081 }
1079 1082
1080 int get hashCode => declaration.hashCode * 17; 1083 int get hashCode => declaration.hashCode * 17;
1081 1084
1082 String toString() => '$declaration'; 1085 String toString() => '$declaration';
1083 } 1086 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/compiler.dart ('k') | pkg/compiler/lib/src/enqueue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698