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

Unified Diff: dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart

Issue 22835003: Put constants in 'C', not '$'. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 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
Index: dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart b/dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
index 21e7b5ca20fb720a8661c077e3daa58b0f9b5429..02a8b4c0c4f37d36bcd0705cb71ada21574fe96e 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
@@ -879,6 +879,10 @@ class CodeEmitterTask extends CompilerTask {
js('str += "}\\n"'),
+ js('var Constants = #', js.fun('', [])),
+ // Install 'C' as a prototype to ensure it has a hidden class.
+ js('Constants.prototype = ${namer.globalObjectForConstant(null)}'),
+
js('var newIsolate = new Function(str)'),
js('newIsolate.prototype = isolatePrototype'),
js('isolatePrototype.constructor = newIsolate'),
@@ -2683,6 +2687,7 @@ class CodeEmitterTask extends CompilerTask {
List<Constant> constants = handler.getConstantsForEmission(
compareConstants);
bool addedMakeConstantList = false;
+ eagerBuffer.write('var ${namer.globalObjectForConstant(null)}$_=$_{}$N');
for (Constant constant in constants) {
if (isConstantInlinedOrAlreadyEmitted(constant)) continue;
String name = namer.constantName(constant);
@@ -2691,7 +2696,8 @@ class CodeEmitterTask extends CompilerTask {
emitMakeConstantList(eagerBuffer);
}
CodeBuffer buffer = bufferForConstant(constant, eagerBuffer);
- jsAst.Expression init = js('$isolateProperties.$name = #',
+ jsAst.Expression init = js(
+ '${namer.globalObjectForConstant(constant)}.$name = #',
constantInitializerExpression(constant));
buffer.write(jsAst.prettyPrint(init, compiler));
buffer.write('$N');

Powered by Google App Engine
This is Rietveld 408576698