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

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: Remove TODO. Created 5 years, 5 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 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 o[fieldNames[i]] = fields[i]; 1120 o[fieldNames[i]] = fields[i];
1121 } 1121 }
1122 return o; 1122 return o;
1123 }'''); 1123 }''');
1124 globals.add(new js.Property(js.string(INITIALIZE_EMPTY_INSTANCE), 1124 globals.add(new js.Property(js.string(INITIALIZE_EMPTY_INSTANCE),
1125 initializeEmptyInstanceFunction)); 1125 initializeEmptyInstanceFunction));
1126 } 1126 }
1127 1127
1128 globals.add(emitMangledGlobalNames()); 1128 globals.add(emitMangledGlobalNames());
1129 1129
1130 // The [MANGLED_NAMES] table is only relevant for reflection. 1130 // The [MANGLED_NAMES] table must contain the mapping for const symbols.
1131 // TODO(floitsch): verify that this is correct. 1131 // Otherwise, it is only relevant for reflection.
Siggi Cherem (dart-lang) 2015/07/23 18:09:50 I assume that by reflection here you also mean Fun
floitsch 2015/07/29 18:08:37 Rewrote comment: Without const symbols, the table
Siggi Cherem (dart-lang) 2015/07/30 16:44:02 But this emitter doesn't support dart:mirrors, rig
floitsch 2015/08/03 15:56:06 It's unused. Updated comment.
1132 globals.add(new js.Property(js.string(MANGLED_NAMES), 1132 List<js.Property> mangledNamesProperties = <js.Property>[];
1133 new js.ObjectInitializer([]))); 1133 program.symbolsMap.forEach((js.Name mangledName, String unmangledName) {
1134 mangledNamesProperties.add(
1135 new js.Property(mangledName, js.string(unmangledName)));
1136 });
1137 globals.add(new js.Property(
1138 js.string(MANGLED_NAMES),
1139 new js.ObjectInitializer(mangledNamesProperties)));
1134 1140
1135 globals.add(emitGetTypeFromName()); 1141 globals.add(emitGetTypeFromName());
1136 1142
1137 globals.addAll(emitMetadata(program)); 1143 globals.addAll(emitMetadata(program));
1138 1144
1139 if (program.needsNativeSupport) { 1145 if (program.needsNativeSupport) {
1140 globals.add(new js.Property(js.string(INTERCEPTORS_BY_TAG), 1146 globals.add(new js.Property(js.string(INTERCEPTORS_BY_TAG),
1141 new js.LiteralNull())); 1147 new js.LiteralNull()));
1142 globals.add(new js.Property(js.string(LEAF_TAGS), 1148 globals.add(new js.Property(js.string(LEAF_TAGS),
1143 new js.LiteralNull())); 1149 new js.LiteralNull()));
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 } 1213 }
1208 statements.add(js.js.statement("setOrUpdateInterceptorsByTag(#);", 1214 statements.add(js.js.statement("setOrUpdateInterceptorsByTag(#);",
1209 js.objectLiteral(interceptorsByTag))); 1215 js.objectLiteral(interceptorsByTag)));
1210 statements.add(js.js.statement("setOrUpdateLeafTags(#);", 1216 statements.add(js.js.statement("setOrUpdateLeafTags(#);",
1211 js.objectLiteral(leafTags))); 1217 js.objectLiteral(leafTags)));
1212 statements.add(subclassAssignment); 1218 statements.add(subclassAssignment);
1213 1219
1214 return new js.Block(statements); 1220 return new js.Block(statements);
1215 } 1221 }
1216 } 1222 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698