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

Unified Diff: pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart

Issue 1575603002: dart2js: lazily load fields in their own deferred parts (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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/js_emitter/full_emitter/emitter.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
diff --git a/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart b/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
index 9471cac584dc5366edb071db14adff70c8a67242..e6d06ed1416116a007bdb43a8f69e88374a9f294 100644
--- a/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
+++ b/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
@@ -310,15 +310,12 @@ class ProgramBuilder {
List<StaticField> _buildStaticLazilyInitializedFields(
LibrariesMap librariesMap) {
- // TODO(floitsch): lazy fields should just be in their respective
- // libraries.
- if (librariesMap != _registry.mainLibrariesMap) {
- return const <StaticField>[];
- }
-
JavaScriptConstantCompiler handler = backend.constants;
- List<VariableElement> lazyFields =
- handler.getLazilyInitializedFieldsForEmission();
+ DeferredLoadTask loadTask = _compiler.deferredLoadTask;
+ List<VariableElement> lazyFields = handler
+ .getLazilyInitializedFieldsForEmission()
+ .where((element) =>
+ loadTask.outputUnitForElement(element) == librariesMap.outputUnit);
return Elements.sortedByPosition(lazyFields)
.map(_buildLazyField)
.where((field) => field != null) // Happens when the field was unused.
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698