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

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

Issue 2007353002: run dartfmt on dart2js (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/dart_types.dart ('k') | pkg/compiler/lib/src/library_loader.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/deferred_load.dart
diff --git a/pkg/compiler/lib/src/deferred_load.dart b/pkg/compiler/lib/src/deferred_load.dart
index 2f6df997fc1fa23fe73a9b25383d5f33d2abb7ed..18e85adfe2095ba5700e8b2dc03286d757c2d4cf 100644
--- a/pkg/compiler/lib/src/deferred_load.dart
+++ b/pkg/compiler/lib/src/deferred_load.dart
@@ -633,88 +633,97 @@ class DeferredLoadTask extends CompilerTask {
_constantsDeferredBy = new Map<_DeferredImport, Set<ConstantValue>>();
_importedDeferredBy[_fakeMainImport] = _mainElements;
- reporter.withCurrentElement(mainLibrary, () => measure(() {
- // Starting from main, traverse the program and find all dependencies.
- _mapDependencies(element: compiler.mainFunction, import: _fakeMainImport);
-
- // Also add "global" dependencies to the main OutputUnit. These are
- // things that the backend needs but cannot associate with a particular
- // element, for example, startRootIsolate. This set also contains
- // elements for which we lack precise information.
- for (Element element in compiler.globalDependencies.otherDependencies) {
- _mapDependencies(element: element, import: _fakeMainImport);
- }
+ reporter.withCurrentElement(
+ mainLibrary,
Siggi Cherem (dart-lang) 2016/05/25 17:04:16 thanks!
+ () => measure(() {
+ // Starting from main, traverse the program and find all
+ // dependencies.
+ _mapDependencies(
+ element: compiler.mainFunction, import: _fakeMainImport);
+
+ // Also add "global" dependencies to the main OutputUnit. These
+ // are things that the backend needs but cannot associate with a
+ // particular element, for example, startRootIsolate. This set
+ // also contains elements for which we lack precise information.
+ for (Element element
+ in compiler.globalDependencies.otherDependencies) {
+ _mapDependencies(element: element, import: _fakeMainImport);
+ }
- // Now check to see if we have to add more elements due to mirrors.
- if (compiler.mirrorsLibrary != null) {
- _addMirrorElements();
- }
+ // Now check to see if we have to add more elements due to
+ // mirrors.
+ if (compiler.mirrorsLibrary != null) {
+ _addMirrorElements();
+ }
- // Build the OutputUnits using these two maps.
- Map<Element, OutputUnit> elementToOutputUnitBuilder =
- new Map<Element, OutputUnit>();
- Map<ConstantValue, OutputUnit> constantToOutputUnitBuilder =
- new Map<ConstantValue, OutputUnit>();
-
- // Reverse the mappings. For each element record an OutputUnit collecting
- // all deferred imports mapped to this element. Same for constants.
- for (_DeferredImport import in _importedDeferredBy.keys) {
- for (Element element in _importedDeferredBy[import]) {
- // Only one file should be loaded when the program starts, so make
- // sure that only one OutputUnit is created for [fakeMainImport].
- if (import == _fakeMainImport) {
- elementToOutputUnitBuilder[element] = mainOutputUnit;
- } else {
- elementToOutputUnitBuilder
- .putIfAbsent(element, () => new OutputUnit())
- .imports
- .add(import);
- }
- }
- }
- for (_DeferredImport import in _constantsDeferredBy.keys) {
- for (ConstantValue constant in _constantsDeferredBy[import]) {
- // Only one file should be loaded when the program starts, so make
- // sure that only one OutputUnit is created for [fakeMainImport].
- if (import == _fakeMainImport) {
- constantToOutputUnitBuilder[constant] = mainOutputUnit;
- } else {
- constantToOutputUnitBuilder
- .putIfAbsent(constant, () => new OutputUnit())
- .imports
- .add(import);
- }
- }
- }
+ // Build the OutputUnits using these two maps.
+ Map<Element, OutputUnit> elementToOutputUnitBuilder =
+ new Map<Element, OutputUnit>();
+ Map<ConstantValue, OutputUnit> constantToOutputUnitBuilder =
+ new Map<ConstantValue, OutputUnit>();
+
+ // Reverse the mappings. For each element record an OutputUnit
+ // collecting all deferred imports mapped to this element. Same
+ // for constants.
+ for (_DeferredImport import in _importedDeferredBy.keys) {
+ for (Element element in _importedDeferredBy[import]) {
+ // Only one file should be loaded when the program starts, so
+ // make sure that only one OutputUnit is created for
+ // [fakeMainImport].
+ if (import == _fakeMainImport) {
+ elementToOutputUnitBuilder[element] = mainOutputUnit;
+ } else {
+ elementToOutputUnitBuilder
+ .putIfAbsent(element, () => new OutputUnit())
+ .imports
+ .add(import);
+ }
+ }
+ }
+ for (_DeferredImport import in _constantsDeferredBy.keys) {
+ for (ConstantValue constant in _constantsDeferredBy[import]) {
+ // Only one file should be loaded when the program starts, so
+ // make sure that only one OutputUnit is created for
+ // [fakeMainImport].
+ if (import == _fakeMainImport) {
+ constantToOutputUnitBuilder[constant] = mainOutputUnit;
+ } else {
+ constantToOutputUnitBuilder
+ .putIfAbsent(constant, () => new OutputUnit())
+ .imports
+ .add(import);
+ }
+ }
+ }
- // Release maps;
- _importedDeferredBy = null;
- _constantsDeferredBy = null;
-
- // Find all the output units elements/constants have been mapped to, and
- // canonicalize them.
- elementToOutputUnitBuilder
- .forEach((Element element, OutputUnit outputUnit) {
- OutputUnit representative = allOutputUnits.lookup(outputUnit);
- if (representative == null) {
- representative = outputUnit;
- allOutputUnits.add(representative);
- }
- _elementToOutputUnit[element] = representative;
- });
- constantToOutputUnitBuilder
- .forEach((ConstantValue constant, OutputUnit outputUnit) {
- OutputUnit representative = allOutputUnits.lookup(outputUnit);
- if (representative == null) {
- representative = outputUnit;
- allOutputUnits.add(representative);
- }
- _constantToOutputUnit[constant] = representative;
- });
+ // Release maps;
+ _importedDeferredBy = null;
+ _constantsDeferredBy = null;
+
+ // Find all the output units elements/constants have been mapped
+ // to, and canonicalize them.
+ elementToOutputUnitBuilder
+ .forEach((Element element, OutputUnit outputUnit) {
+ OutputUnit representative = allOutputUnits.lookup(outputUnit);
+ if (representative == null) {
+ representative = outputUnit;
+ allOutputUnits.add(representative);
+ }
+ _elementToOutputUnit[element] = representative;
+ });
+ constantToOutputUnitBuilder
+ .forEach((ConstantValue constant, OutputUnit outputUnit) {
+ OutputUnit representative = allOutputUnits.lookup(outputUnit);
+ if (representative == null) {
+ representative = outputUnit;
+ allOutputUnits.add(representative);
+ }
+ _constantToOutputUnit[constant] = representative;
+ });
- // Generate a unique name for each OutputUnit.
- _assignNamesToOutputUnits(allOutputUnits);
- }));
+ // Generate a unique name for each OutputUnit.
+ _assignNamesToOutputUnits(allOutputUnits);
+ }));
// Notify the impact strategy impacts are no longer needed for deferred
// load.
compiler.impactStrategy.onImpactUsed(IMPACT_USE);
« no previous file with comments | « pkg/compiler/lib/src/dart_types.dart ('k') | pkg/compiler/lib/src/library_loader.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698