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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/lazy_emitter/model_emitter.dart

Issue 2595493002: Merge CoreTypes and CoreClasses into CommonElements. (Closed)
Patch Set: Updated cf. comment Created 3 years, 12 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library dart2js.js_emitter.lazy_emitter.model_emitter; 5 library dart2js.js_emitter.lazy_emitter.model_emitter;
6 6
7 import 'package:js_runtime/shared/embedded_names.dart' 7 import 'package:js_runtime/shared/embedded_names.dart'
8 show 8 show
9 CREATE_NEW_ISOLATE, 9 CREATE_NEW_ISOLATE,
10 DEFERRED_LIBRARY_URIS, 10 DEFERRED_LIBRARY_URIS,
11 DEFERRED_LIBRARY_HASHES, 11 DEFERRED_LIBRARY_HASHES,
12 GET_TYPE_FROM_NAME, 12 GET_TYPE_FROM_NAME,
13 INITIALIZE_LOADED_HUNK, 13 INITIALIZE_LOADED_HUNK,
14 INTERCEPTORS_BY_TAG, 14 INTERCEPTORS_BY_TAG,
15 IS_HUNK_INITIALIZED, 15 IS_HUNK_INITIALIZED,
16 IS_HUNK_LOADED, 16 IS_HUNK_LOADED,
17 LEAF_TAGS, 17 LEAF_TAGS,
18 MANGLED_GLOBAL_NAMES, 18 MANGLED_GLOBAL_NAMES,
19 METADATA, 19 METADATA,
20 TYPE_TO_INTERCEPTOR_MAP, 20 TYPE_TO_INTERCEPTOR_MAP,
21 TYPES; 21 TYPES;
22 22
23 import '../../compiler.dart' show Compiler; 23 import '../../compiler.dart' show Compiler;
24 import '../../constants/values.dart' show ConstantValue, FunctionConstantValue; 24 import '../../constants/values.dart' show ConstantValue, FunctionConstantValue;
25 import '../../core_types.dart' show CoreClasses; 25 import '../../core_types.dart' show CommonElements;
26 import '../../elements/elements.dart' show ClassElement, FunctionElement; 26 import '../../elements/elements.dart' show ClassElement, FunctionElement;
27 import '../../js/js.dart' as js; 27 import '../../js/js.dart' as js;
28 import '../../js_backend/js_backend.dart' 28 import '../../js_backend/js_backend.dart'
29 show JavaScriptBackend, Namer, ConstantEmitter; 29 show JavaScriptBackend, Namer, ConstantEmitter;
30 import '../constant_ordering.dart' show deepCompareConstants; 30 import '../constant_ordering.dart' show deepCompareConstants;
31 import '../js_emitter.dart' show NativeEmitter; 31 import '../js_emitter.dart' show NativeEmitter;
32 import '../js_emitter.dart' show NativeGenerator, buildTearOffCode; 32 import '../js_emitter.dart' show NativeGenerator, buildTearOffCode;
33 import '../model.dart'; 33 import '../model.dart';
34 34
35 class ModelEmitter { 35 class ModelEmitter {
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 new js.VariableDeclaration("init", allowRename: false), 335 new js.VariableDeclaration("init", allowRename: false),
336 globalsObject) 336 globalsObject)
337 ])) 337 ]))
338 ]; 338 ];
339 return new js.Block(statements); 339 return new js.Block(statements);
340 } 340 }
341 341
342 js.Property emitMangledGlobalNames() { 342 js.Property emitMangledGlobalNames() {
343 List<js.Property> names = <js.Property>[]; 343 List<js.Property> names = <js.Property>[];
344 344
345 CoreClasses coreClasses = compiler.coreClasses; 345 CommonElements commonElements = compiler.commonElements;
346 // We want to keep the original names for the most common core classes when 346 // We want to keep the original names for the most common core classes when
347 // calling toString on them. 347 // calling toString on them.
348 List<ClassElement> nativeClassesNeedingUnmangledName = [ 348 List<ClassElement> nativeClassesNeedingUnmangledName = [
349 coreClasses.intClass, 349 commonElements.intClass,
350 coreClasses.doubleClass, 350 commonElements.doubleClass,
351 coreClasses.numClass, 351 commonElements.numClass,
352 coreClasses.stringClass, 352 commonElements.stringClass,
353 coreClasses.boolClass, 353 commonElements.boolClass,
354 coreClasses.nullClass, 354 commonElements.nullClass,
355 coreClasses.listClass 355 commonElements.listClass
356 ]; 356 ];
357 nativeClassesNeedingUnmangledName.forEach((element) { 357 nativeClassesNeedingUnmangledName.forEach((element) {
358 names.add(new js.Property( 358 names.add(new js.Property(
359 js.quoteName(namer.className(element)), js.string(element.name))); 359 js.quoteName(namer.className(element)), js.string(element.name)));
360 }); 360 });
361 361
362 return new js.Property( 362 return new js.Property(
363 js.string(MANGLED_GLOBAL_NAMES), new js.ObjectInitializer(names)); 363 js.string(MANGLED_GLOBAL_NAMES), new js.ObjectInitializer(names));
364 } 364 }
365 365
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after
1267 #eagerClasses; 1267 #eagerClasses;
1268 1268
1269 var end = Date.now(); 1269 var end = Date.now();
1270 // print('Setup: ' + (end - start) + ' ms.'); 1270 // print('Setup: ' + (end - start) + ' ms.');
1271 1271
1272 #invokeMain; // Start main. 1272 #invokeMain; // Start main.
1273 1273
1274 })(Date.now(), #code) 1274 })(Date.now(), #code)
1275 }"""; 1275 }""";
1276 } 1276 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/lazy_emitter/emitter.dart ('k') | pkg/compiler/lib/src/js_emitter/native_emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698