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

Side by Side Diff: pkg/compiler/lib/src/js_backend/backend.dart

Issue 1299413002: Move common identifiers, names and selectors to a separate library. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 js_backend; 5 part of js_backend;
6 6
7 const VERBOSE_OPTIMIZER_HINTS = false; 7 const VERBOSE_OPTIMIZER_HINTS = false;
8 8
9 class JavaScriptItemCompilationContext extends ItemCompilationContext { 9 class JavaScriptItemCompilationContext extends ItemCompilationContext {
10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); 10 final Set<HInstruction> boundsChecked = new Set<HInstruction>();
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 // differences. 886 // differences.
887 assert(interceptorMember.enclosingClass == interceptorClass); 887 assert(interceptorMember.enclosingClass == interceptorClass);
888 }); 888 });
889 } 889 }
890 890
891 void addInterceptorsForNativeClassMembers( 891 void addInterceptorsForNativeClassMembers(
892 ClassElement cls, Enqueuer enqueuer) { 892 ClassElement cls, Enqueuer enqueuer) {
893 if (enqueuer.isResolutionQueue) { 893 if (enqueuer.isResolutionQueue) {
894 cls.ensureResolved(compiler); 894 cls.ensureResolved(compiler);
895 cls.forEachMember((ClassElement classElement, Element member) { 895 cls.forEachMember((ClassElement classElement, Element member) {
896 if (member.name == Compiler.CALL_OPERATOR_NAME) { 896 if (member.name == Identifiers.call) {
897 compiler.reportError( 897 compiler.reportError(
898 member, 898 member,
899 MessageKind.CALL_NOT_SUPPORTED_ON_NATIVE_CLASS); 899 MessageKind.CALL_NOT_SUPPORTED_ON_NATIVE_CLASS);
900 return; 900 return;
901 } 901 }
902 if (member.isSynthesized) return; 902 if (member.isSynthesized) return;
903 // All methods on [Object] are shadowed by [Interceptor]. 903 // All methods on [Object] are shadowed by [Interceptor].
904 if (classElement == compiler.objectClass) return; 904 if (classElement == compiler.objectClass) return;
905 Set<Element> set = interceptedElements.putIfAbsent( 905 Set<Element> set = interceptedElements.putIfAbsent(
906 member.name, () => new Set<Element>()); 906 member.name, () => new Set<Element>());
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
1295 enqueueClass(compiler.enqueuer.resolution, compiler.stringClass, registry); 1295 enqueueClass(compiler.enqueuer.resolution, compiler.stringClass, registry);
1296 } 1296 }
1297 1297
1298 void registerNoSuchMethod(FunctionElement noSuchMethod) { 1298 void registerNoSuchMethod(FunctionElement noSuchMethod) {
1299 noSuchMethodRegistry.registerNoSuchMethod(noSuchMethod); 1299 noSuchMethodRegistry.registerNoSuchMethod(noSuchMethod);
1300 } 1300 }
1301 1301
1302 void enableNoSuchMethod(Enqueuer world) { 1302 void enableNoSuchMethod(Enqueuer world) {
1303 enqueue(world, getCreateInvocationMirror(), compiler.globalDependencies); 1303 enqueue(world, getCreateInvocationMirror(), compiler.globalDependencies);
1304 world.registerInvocation( 1304 world.registerInvocation(
1305 new UniverseSelector(compiler.noSuchMethodSelector, null)); 1305 new UniverseSelector(Selectors.noSuchMethod_, null));
1306 } 1306 }
1307 1307
1308 void enableIsolateSupport(Enqueuer enqueuer) { 1308 void enableIsolateSupport(Enqueuer enqueuer) {
1309 // TODO(floitsch): We should also ensure that the class IsolateMessage is 1309 // TODO(floitsch): We should also ensure that the class IsolateMessage is
1310 // instantiated. Currently, just enabling isolate support works. 1310 // instantiated. Currently, just enabling isolate support works.
1311 if (compiler.mainFunction != null) { 1311 if (compiler.mainFunction != null) {
1312 // The JavaScript backend implements [Isolate.spawn] by looking up 1312 // The JavaScript backend implements [Isolate.spawn] by looking up
1313 // top-level functions by name. So all top-level function tear-off 1313 // top-level functions by name. So all top-level function tear-off
1314 // closures have a private name field. 1314 // closures have a private name field.
1315 // 1315 //
(...skipping 1731 matching lines...) Expand 10 before | Expand all | Expand 10 after
3047 registerBackendStaticInvocation(backend.getThrowRuntimeError(), registry); 3047 registerBackendStaticInvocation(backend.getThrowRuntimeError(), registry);
3048 // Also register the types of the arguments passed to this method. 3048 // Also register the types of the arguments passed to this method.
3049 registerBackendInstantiation(backend.compiler.stringClass, registry); 3049 registerBackendInstantiation(backend.compiler.stringClass, registry);
3050 } 3050 }
3051 3051
3052 void onSuperNoSuchMethod(Registry registry) { 3052 void onSuperNoSuchMethod(Registry registry) {
3053 assert(registry.isForResolution); 3053 assert(registry.isForResolution);
3054 registerBackendStaticInvocation( 3054 registerBackendStaticInvocation(
3055 backend.getCreateInvocationMirror(), registry); 3055 backend.getCreateInvocationMirror(), registry);
3056 registerBackendStaticInvocation( 3056 registerBackendStaticInvocation(
3057 backend.compiler.objectClass.lookupLocalMember(Compiler.NO_SUCH_METHOD), 3057 backend.compiler.objectClass.lookupLocalMember(
3058 Identifiers.noSuchMethod_),
3058 registry); 3059 registry);
3059 registerBackendInstantiation(backend.compiler.listClass, registry); 3060 registerBackendInstantiation(backend.compiler.listClass, registry);
3060 registerBackendInstantiation(backend.compiler.stringClass, registry); 3061 registerBackendInstantiation(backend.compiler.stringClass, registry);
3061 } 3062 }
3062 3063
3063 void onMapLiteral(ResolutionRegistry registry, 3064 void onMapLiteral(ResolutionRegistry registry,
3064 DartType type, 3065 DartType type,
3065 bool isConstant) { 3066 bool isConstant) {
3066 assert(registry.isForResolution); 3067 assert(registry.isForResolution);
3067 void enqueue(String name) { 3068 void enqueue(String name) {
(...skipping 21 matching lines...) Expand all
3089 } 3090 }
3090 } 3091 }
3091 3092
3092 /// Records that [constant] is used by the element behind [registry]. 3093 /// Records that [constant] is used by the element behind [registry].
3093 class Dependency { 3094 class Dependency {
3094 final ConstantValue constant; 3095 final ConstantValue constant;
3095 final Element annotatedElement; 3096 final Element annotatedElement;
3096 3097
3097 const Dependency(this.constant, this.annotatedElement); 3098 const Dependency(this.constant, this.annotatedElement);
3098 } 3099 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698