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

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

Issue 828753002: dart2js OldEmitter: Change to named holes in js output strings plus some extra clean-ups. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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/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 e5983d60808a9aee67176a7283c5164473183719..21f40e1d3d9743544ac588f48bc11bf2abc383e2 100644
--- a/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
@@ -457,15 +457,15 @@ class OldEmitter implements Emitter {
return js('''
(function(){
- # = Object.create(null); // embedded allClasses.
- # = Object.create(null); // embedded interceptorsByTag.
- # = Object.create(null); // embedded leafTags.
- # = Object.create(null); // embedded finishedClasses
+ #allClasses = Object.create(null);
floitsch 2014/12/29 18:09:12 Ok with change, but we could have just removed the
zarah 2014/12/30 10:29:25 Done, in another cl.
+ #interceptorsByTag = Object.create(null);
+ #leafTags = Object.create(null);
+ #finishedClasses = Object.create(null);
})()
- ''', [allClassesAccess,
- interceptorsByTagAccess,
- leafTagsAccess,
- finishedClassesAccess]);
+ ''', {'allClasses': allClassesAccess,
+ 'interceptorsByTag': interceptorsByTagAccess,
+ 'leafTags': leafTagsAccess,
+ 'finishedClasses': finishedClassesAccess});
}
jsAst.Fun get finishClassesFunction {
@@ -786,8 +786,8 @@ class OldEmitter implements Emitter {
return js('''
function (prototype, staticName, fieldName, getterName, lazyValue) {
- if (!#) # = Object.create(null);
- #[fieldName] = getterName;
+ if (!#lazies) #lazies = Object.create(null);
+ #lazies[fieldName] = getterName;
var sentinelUndefined = {};
var sentinelInProgress = {};
@@ -809,7 +809,7 @@ class OldEmitter implements Emitter {
}
} else {
if (result === sentinelInProgress)
- #(staticName);
+ #cyclicThrow(staticName);
}
return result;
@@ -818,9 +818,7 @@ class OldEmitter implements Emitter {
}
}
}
- ''', [laziesAccess, laziesAccess,
- laziesAccess,
- cyclicThrow]);
+ ''', {'lazies': laziesAccess, 'cyclicThrow': cyclicThrow});
}
List buildDefineClassAndFinishClassFunctionsIfNecessary() {
@@ -1225,8 +1223,8 @@ class OldEmitter implements Emitter {
return Object.keys(convertToFastObject(o))[0];
}
- # = function(name) { // embedded getIsolateTag
- return intern("___dart_" + name + #); // embedded isolateTag
+ #getIsolateTag = function(name) {
+ return intern("___dart_" + name + #isolateTag);
};
// To ensure that different programs loaded into the same context (page)
@@ -1241,14 +1239,13 @@ class OldEmitter implements Emitter {
var property = intern(rootProperty + "_" + i + "_");
if (!(property in usedProperties)) {
usedProperties[property] = 1;
- # = property; // embedded isolateTag
+ #isolateTag = property;
break;
}
}
}()
- ''', [getIsolateTagAccess,
- isolateTagAccess,
- isolateTagAccess]);
+ ''',
+ {'getIsolateTag': getIsolateTagAccess, 'isolateTag': isolateTagAccess});
}
jsAst.Expression generateDispatchPropertyNameInitialization() {
@@ -1326,16 +1323,15 @@ class OldEmitter implements Emitter {
scripts[i].addEventListener("load", onLoad, false);
}
})(function(currentScript) {
- # = currentScript; // embedded currentScript.
+ #currentScript = currentScript;
if (typeof dartMainRunner === "function") {
- dartMainRunner(#, []); // mainCallClosure.
+ dartMainRunner(#mainCallClosure, []);
} else {
- #([]); // mainCallClosure.
+ #mainCallClosure([]);
}
-})$N''', [currentScriptAccess,
- mainCallClosure,
- mainCallClosure]);
+})$N''', {'currentScript': currentScriptAccess,
floitsch 2014/12/29 18:09:12 I could be wrong, but I believe that the "$N" here
zarah 2014/12/30 10:29:26 I agree.
+ 'mainCallClosure': mainCallClosure});
buffer.write(';');
buffer.write(jsAst.prettyPrint(invokeMain,
@@ -1685,10 +1681,6 @@ class OldEmitter implements Emitter {
mainBuffer.add('var $classesCollector$_=${_}Object.create(null)$N$n');
}
- if (!nativeClasses.isEmpty) {
- addComment('Native classes', mainBuffer);
- }
-
List<ClassElement> classes = task.outputClassLists[mainOutputUnit];
if (classes != null) {
for (ClassElement element in classes) {

Powered by Google App Engine
This is Rietveld 408576698