Index: sdk/lib/_internal/compiler/js_lib/js_helper.dart |
diff --git a/sdk/lib/_internal/compiler/js_lib/js_helper.dart b/sdk/lib/_internal/compiler/js_lib/js_helper.dart |
index d2f38367b381e9d4d357e4e6a715f45953074e96..63a13931be7ac3c18a13c27912d7cba89619d9e0 100644 |
--- a/sdk/lib/_internal/compiler/js_lib/js_helper.dart |
+++ b/sdk/lib/_internal/compiler/js_lib/js_helper.dart |
@@ -15,6 +15,7 @@ import 'dart:_js_embedded_names' show |
DEFERRED_LIBRARY_HASHES, |
INITIALIZE_LOADED_HUNK, |
IS_HUNK_LOADED, |
+ IS_HUNK_INITIALIZED, |
NATIVE_SUPERCLASS_TAG_NAME; |
import 'dart:collection'; |
@@ -3313,15 +3314,18 @@ Future<Null> loadDeferredLibrary(String loadId) { |
// The indices into `uris` and `hashes` that we want to load. |
List<int> indices = new List.generate(uris.length, (i) => i); |
var isHunkLoaded = JS_EMBEDDED_GLOBAL('', IS_HUNK_LOADED); |
+ var isHunkInitialized = JS_EMBEDDED_GLOBAL('', IS_HUNK_INITIALIZED); |
// Filter away indices for hunks that have already been loaded. |
List<int> indicesToLoad = indices |
.where((int i) => !JS('bool','#(#)', isHunkLoaded, hashes[i])) |
.toList(); |
- // Load the needed hunks. |
+ List<int> indicesToInitialize = indices |
+ .where((int i) => !JS('bool','#(#)', isHunkInitialized, hashes[i])) |
+ .toList(); // Load the needed hunks. |
return Future.wait(indicesToLoad |
.map((int i) => _loadHunk(uris[i]))).then((_) { |
// Now all hunks have been loaded, we run the needed initializers. |
- for (int i in indicesToLoad) { |
+ for (int i in indicesToInitialize) { |
var initializer = JS_EMBEDDED_GLOBAL('', INITIALIZE_LOADED_HUNK); |
JS('void', '#(#)', initializer, hashes[i]); |
} |