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

Unified Diff: pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart

Issue 1508543003: Initialize the deferred global for every fragment. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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
Index: pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
diff --git a/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart b/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
index 7fbd768820923fa63483f2f4c8995a5a128d231a..14dea34b877f1f462c89b5a9933a7188c4dac3a7 100644
--- a/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
@@ -55,11 +55,6 @@ const String cachedClassFieldNames = r'$cachedFieldNames';
// names we want. Furthermore, the pretty-printer minifies local variables, thus
// reducing their size.
const String mainBoilerplate = '''
-{
-// Declare deferred-initializer global, which is used to keep track of the
-// loaded fragments.
-#deferredInitializer;
-
(function() {
// Copies the own properties from [from] to [to].
function copyProperties(from, to) {
@@ -355,8 +350,8 @@ var #staticStateDeclaration = {};
// Invokes main (making sure that it records the 'current-script' value).
#invokeMain;
-})();
-}''';
+})()
+''';
/// Deferred fragments (aka 'hunks') are built similarly to the main fragment.
///
@@ -441,8 +436,7 @@ class FragmentEmitter {
.where((Holder holder) => !holder.isStaticStateHolder);
return js.js.statement(mainBoilerplate,
- {'deferredInitializer': emitDeferredInitializerGlobal(program.loadMap),
- 'typeNameProperty': js.string(ModelEmitter.typeNameProperty),
+ {'typeNameProperty': js.string(ModelEmitter.typeNameProperty),
'cyclicThrow': backend.emitter.staticFunctionAccess(
backend.helpers.cyclicThrowHelper),
'operatorIsPrefix': js.string(namer.operatorIsPrefix),
@@ -516,15 +510,6 @@ class FragmentEmitter {
});
}
- js.Statement emitDeferredInitializerGlobal(Map loadMap) {
- if (loadMap.isEmpty) return new js.Block.empty();
-
- String global = ModelEmitter.deferredInitializersGlobal;
- return js.js.statement(
- "if (typeof($global) === 'undefined') var # = Object.create(null);",
- new js.VariableDeclaration(global, allowRename: false));
- }
-
/// Emits all holders, except for the static-state holder.
///
/// The emitted holders contain classes (only the constructors) and all

Powered by Google App Engine
This is Rietveld 408576698