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

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

Issue 1253443003: dart2js: Support const symbols in the startup emitter. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Update comment. Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart2js.js_emitter.startup_emitter.model_emitter; 5 part of dart2js.js_emitter.startup_emitter.model_emitter;
6 6
7 /// The name of the property that stores the tear-off getter on a static 7 /// The name of the property that stores the tear-off getter on a static
8 /// function. 8 /// function.
9 /// 9 ///
10 /// This property is only used when isolates are used. 10 /// This property is only used when isolates are used.
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 o[fieldNames[i]] = fields[i]; 1113 o[fieldNames[i]] = fields[i];
1114 } 1114 }
1115 return o; 1115 return o;
1116 }'''); 1116 }''');
1117 globals.add(new js.Property(js.string(INITIALIZE_EMPTY_INSTANCE), 1117 globals.add(new js.Property(js.string(INITIALIZE_EMPTY_INSTANCE),
1118 initializeEmptyInstanceFunction)); 1118 initializeEmptyInstanceFunction));
1119 } 1119 }
1120 1120
1121 globals.add(emitMangledGlobalNames()); 1121 globals.add(emitMangledGlobalNames());
1122 1122
1123 // The [MANGLED_NAMES] table is only relevant for reflection. 1123 // The [MANGLED_NAMES] table must contain the mapping for const symbols.
1124 // TODO(floitsch): verify that this is correct. 1124 // Without const symbols, the table is only relevant for reflection and
1125 globals.add(new js.Property(js.string(MANGLED_NAMES), 1125 // therefore unused in this emitter.
1126 new js.ObjectInitializer([]))); 1126 List<js.Property> mangledNamesProperties = <js.Property>[];
1127 program.symbolsMap.forEach((js.Name mangledName, String unmangledName) {
1128 mangledNamesProperties.add(
1129 new js.Property(mangledName, js.string(unmangledName)));
1130 });
1131 globals.add(new js.Property(
1132 js.string(MANGLED_NAMES),
1133 new js.ObjectInitializer(mangledNamesProperties)));
1127 1134
1128 globals.add(emitGetTypeFromName()); 1135 globals.add(emitGetTypeFromName());
1129 1136
1130 globals.addAll(emitMetadata(program)); 1137 globals.addAll(emitMetadata(program));
1131 1138
1132 if (program.needsNativeSupport) { 1139 if (program.needsNativeSupport) {
1133 globals.add(new js.Property(js.string(INTERCEPTORS_BY_TAG), 1140 globals.add(new js.Property(js.string(INTERCEPTORS_BY_TAG),
1134 new js.LiteralNull())); 1141 new js.LiteralNull()));
1135 globals.add(new js.Property(js.string(LEAF_TAGS), 1142 globals.add(new js.Property(js.string(LEAF_TAGS),
1136 new js.LiteralNull())); 1143 new js.LiteralNull()));
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 } 1201 }
1195 statements.add(js.js.statement("setOrUpdateInterceptorsByTag(#);", 1202 statements.add(js.js.statement("setOrUpdateInterceptorsByTag(#);",
1196 js.objectLiteral(interceptorsByTag))); 1203 js.objectLiteral(interceptorsByTag)));
1197 statements.add(js.js.statement("setOrUpdateLeafTags(#);", 1204 statements.add(js.js.statement("setOrUpdateLeafTags(#);",
1198 js.objectLiteral(leafTags))); 1205 js.objectLiteral(leafTags)));
1199 statements.add(subclassAssignment); 1206 statements.add(subclassAssignment);
1200 1207
1201 return new js.Block(statements); 1208 return new js.Block(statements);
1202 } 1209 }
1203 } 1210 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698