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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart

Issue 1394213002: Split RuntimesTypes into RuntimeTypes and RuntimeTypesEncoder (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 2 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.full_emitter; 5 library dart2js.js_emitter.full_emitter;
6 6
7 import 'dart:convert'; 7 import 'dart:convert';
8 import 'dart:collection' show HashMap; 8 import 'dart:collection' show HashMap;
9 9
10 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; 10 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames;
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 switch (builtin) { 374 switch (builtin) {
375 case JsBuiltin.dartObjectConstructor: 375 case JsBuiltin.dartObjectConstructor:
376 return jsAst.js.expressionTemplateYielding( 376 return jsAst.js.expressionTemplateYielding(
377 typeAccess(compiler.objectClass)); 377 typeAccess(compiler.objectClass));
378 378
379 case JsBuiltin.isCheckPropertyToJsConstructorName: 379 case JsBuiltin.isCheckPropertyToJsConstructorName:
380 int isPrefixLength = namer.operatorIsPrefix.length; 380 int isPrefixLength = namer.operatorIsPrefix.length;
381 return jsAst.js.expressionTemplateFor('#.substring($isPrefixLength)'); 381 return jsAst.js.expressionTemplateFor('#.substring($isPrefixLength)');
382 382
383 case JsBuiltin.isFunctionType: 383 case JsBuiltin.isFunctionType:
384 return backend.rti.representationGenerator.templateForIsFunctionType; 384 return backend.rtiEncoder.templateForIsFunctionType;
385 385
386 case JsBuiltin.rawRtiToJsConstructorName: 386 case JsBuiltin.rawRtiToJsConstructorName:
387 return jsAst.js.expressionTemplateFor("#.$typeNameProperty"); 387 return jsAst.js.expressionTemplateFor("#.$typeNameProperty");
388 388
389 case JsBuiltin.rawRuntimeType: 389 case JsBuiltin.rawRuntimeType:
390 return jsAst.js.expressionTemplateFor("#.constructor"); 390 return jsAst.js.expressionTemplateFor("#.constructor");
391 391
392 case JsBuiltin.createFunctionTypeRti: 392 case JsBuiltin.createFunctionTypeRti:
393 return backend.rti.representationGenerator 393 return backend.rtiEncoder.templateForCreateFunctionType;
394 .templateForCreateFunctionType;
395 394
396 case JsBuiltin.isSubtype: 395 case JsBuiltin.isSubtype:
397 // TODO(floitsch): move this closer to where is-check properties are 396 // TODO(floitsch): move this closer to where is-check properties are
398 // built. 397 // built.
399 String isPrefix = namer.operatorIsPrefix; 398 String isPrefix = namer.operatorIsPrefix;
400 return jsAst.js.expressionTemplateFor( 399 return jsAst.js.expressionTemplateFor(
401 "('$isPrefix' + #) in #.prototype"); 400 "('$isPrefix' + #) in #.prototype");
402 401
403 case JsBuiltin.isGivenTypeRti: 402 case JsBuiltin.isGivenTypeRti:
404 return jsAst.js.expressionTemplateFor('#.$typeNameProperty === #'); 403 return jsAst.js.expressionTemplateFor('#.$typeNameProperty === #');
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 }''', 837 }''',
839 [namer.isolateName, makeConstListProperty]); 838 [namer.isolateName, makeConstListProperty]);
840 } else { 839 } else {
841 return js.comment("Output contains no constant list."); 840 return js.comment("Output contains no constant list.");
842 } 841 }
843 } 842 }
844 843
845 jsAst.Statement buildFunctionThatReturnsNull() { 844 jsAst.Statement buildFunctionThatReturnsNull() {
846 return js.statement('#.# = function() {}', 845 return js.statement('#.# = function() {}',
847 [namer.isolateName, 846 [namer.isolateName,
848 backend.rti.getFunctionThatReturnsNullName]); 847 backend.rtiEncoder.getFunctionThatReturnsNullName]);
849 } 848 }
850 849
851 jsAst.Expression generateFunctionThatReturnsNull() { 850 jsAst.Expression generateFunctionThatReturnsNull() {
852 return js("#.#", [namer.isolateName, 851 return js("#.#", [namer.isolateName,
853 backend.rti.getFunctionThatReturnsNullName]); 852 backend.rtiEncoder.getFunctionThatReturnsNullName]);
854 } 853 }
855 854
856 buildMain(jsAst.Statement invokeMain) { 855 buildMain(jsAst.Statement invokeMain) {
857 if (compiler.isMockCompilation) return js.comment("Mock compilation"); 856 if (compiler.isMockCompilation) return js.comment("Mock compilation");
858 857
859 List<jsAst.Statement> parts = <jsAst.Statement>[]; 858 List<jsAst.Statement> parts = <jsAst.Statement>[];
860 859
861 if (NativeGenerator.needsIsolateAffinityTagInitialization(backend)) { 860 if (NativeGenerator.needsIsolateAffinityTagInitialization(backend)) {
862 parts.add( 861 parts.add(
863 NativeGenerator.generateIsolateAffinityTagInitialization( 862 NativeGenerator.generateIsolateAffinityTagInitialization(
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 'getTypeFromName': getTypeFromNameAccess, 1009 'getTypeFromName': getTypeFromNameAccess,
1011 'interceptorsByTag': interceptorsByTagAccess, 1010 'interceptorsByTag': interceptorsByTagAccess,
1012 'leafTags': leafTagsAccess, 1011 'leafTags': leafTagsAccess,
1013 'finishedClasses': finishedClassesAccess, 1012 'finishedClasses': finishedClassesAccess,
1014 'needsLazyInitializer': needsLazyInitializer, 1013 'needsLazyInitializer': needsLazyInitializer,
1015 'lazies': laziesAccess, 'cyclicThrow': cyclicThrow, 1014 'lazies': laziesAccess, 'cyclicThrow': cyclicThrow,
1016 'isolatePropertiesName': namer.isolatePropertiesName, 1015 'isolatePropertiesName': namer.isolatePropertiesName,
1017 'outputContainsConstantList': outputContainsConstantList, 1016 'outputContainsConstantList': outputContainsConstantList,
1018 'makeConstListProperty': makeConstListProperty, 1017 'makeConstListProperty': makeConstListProperty,
1019 'functionThatReturnsNullProperty': 1018 'functionThatReturnsNullProperty':
1020 backend.rti.getFunctionThatReturnsNullName, 1019 backend.rtiEncoder.getFunctionThatReturnsNullName,
1021 'hasIncrementalSupport': compiler.hasIncrementalSupport, 1020 'hasIncrementalSupport': compiler.hasIncrementalSupport,
1022 'lazyInitializerProperty': lazyInitializerProperty,}); 1021 'lazyInitializerProperty': lazyInitializerProperty,});
1023 } 1022 }
1024 1023
1025 jsAst.Statement buildConvertToFastObjectFunction() { 1024 jsAst.Statement buildConvertToFastObjectFunction() {
1026 List<jsAst.Statement> debugCode = <jsAst.Statement>[]; 1025 List<jsAst.Statement> debugCode = <jsAst.Statement>[];
1027 if (DEBUG_FAST_OBJECTS) { 1026 if (DEBUG_FAST_OBJECTS) {
1028 debugCode.add(js.statement(r''' 1027 debugCode.add(js.statement(r'''
1029 // The following only works on V8 when run with option 1028 // The following only works on V8 when run with option
1030 // "--allow-natives-syntax". We use'new Function' because the 1029 // "--allow-natives-syntax". We use'new Function' because the
(...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after
2125 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { 2124 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) {
2126 if (element.isInstanceMember) { 2125 if (element.isInstanceMember) {
2127 cachedClassBuilders.remove(element.enclosingClass); 2126 cachedClassBuilders.remove(element.enclosingClass);
2128 2127
2129 nativeEmitter.cachedBuilders.remove(element.enclosingClass); 2128 nativeEmitter.cachedBuilders.remove(element.enclosingClass);
2130 2129
2131 } 2130 }
2132 } 2131 }
2133 } 2132 }
2134 } 2133 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/runtime_types.dart ('k') | pkg/compiler/lib/src/js_emitter/js_emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698