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

Unified Diff: pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart

Issue 1022103002: Do not include names of lazy globals in minified mode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebased Created 5 years, 9 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 | « no previous file | 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/old_emitter/emitter.dart
diff --git a/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart b/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
index 681a29b4d768b10bbb754751f12523a6a9f99564..d16d5c577b289c305f8aeb9d7dfced27f416d064 100644
--- a/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
@@ -540,25 +540,35 @@ class OldEmitter implements Emitter {
if (code == null) return null;
// The code only computes the initial value. We build the lazy-check
// here:
- // lazyInitializer(prototype, 'name', fieldName, getterName, initial);
+ // lazyInitializer(fieldName, getterName, initial, name, prototype);
// The name is used for error reporting. The 'initial' must be a
// closure that constructs the initial value.
if (isolateProperties != null) {
+ // This is currently only used in incremental compilation to patch
+ // in new lazy values.
return js('#(#,#,#,#,#)',
[js(lazyInitializerName),
- js.string(element.name),
js.string(namer.globalPropertyName(element)),
js.string(namer.lazyInitializerName(element)),
code,
+ js.string(element.name),
isolateProperties]);
}
- return js('#(#,#,#,#)',
- [js(lazyInitializerName),
- js.string(element.name),
- js.string(namer.globalPropertyName(element)),
- js.string(namer.lazyInitializerName(element)),
- code]);
+ if (compiler.enableMinification) {
+ return js('#(#,#,#)',
+ [js(lazyInitializerName),
+ js.string(namer.globalPropertyName(element)),
+ js.string(namer.lazyInitializerName(element)),
+ code]);
+ } else {
+ return js('#(#,#,#,#)',
+ [js(lazyInitializerName),
+ js.string(namer.globalPropertyName(element)),
+ js.string(namer.lazyInitializerName(element)),
+ code,
+ js.string(element.name)]);
+ }
}
void emitMetadata(Program program, CodeOutput output) {
@@ -700,8 +710,11 @@ class OldEmitter implements Emitter {
#finishedClasses = Object.create(null);
if (#needsLazyInitializer) {
- $lazyInitializerName = function (staticName, fieldName, getterName,
- lazyValue, prototype) {
+ // [staticName] is only provided in non-minified mode. If missing, we
+ // fall back to [fieldName]. Likewise, [prototype] is optional and
+ // defaults to the isolateProperties object.
+ $lazyInitializerName = function (fieldName, getterName, lazyValue,
+ staticName, prototype) {
if (!#lazies) #lazies = Object.create(null);
#lazies[fieldName] = getterName;
@@ -729,7 +742,9 @@ class OldEmitter implements Emitter {
}
} else {
if (result === sentinelInProgress)
- #cyclicThrow(staticName);
+ // In minified mode, static name might not have been
+ // provided, so fall back to the minified fieldName.
+ #cyclicThrow(staticName || fieldName);
}
return result;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698