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

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

Issue 2466353002: Revert "More functionality in kernel_impact." and "Compute NativeBehavior for foreign functions." (Closed)
Patch Set: Created 4 years, 1 month 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 library js_backend.backend; 5 library js_backend.backend;
6 6
7 import 'dart:async' show Future; 7 import 'dart:async' show Future;
8 8
9 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; 9 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames;
10 10
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 @override 847 @override
848 void resolveNativeElement(Element element, NativeRegistry registry) { 848 void resolveNativeElement(Element element, NativeRegistry registry) {
849 if (element.isFunction || 849 if (element.isFunction ||
850 element.isConstructor || 850 element.isConstructor ||
851 element.isGetter || 851 element.isGetter ||
852 element.isSetter) { 852 element.isSetter) {
853 compiler.enqueuer.resolution.nativeEnqueuer 853 compiler.enqueuer.resolution.nativeEnqueuer
854 .handleMethodAnnotations(element); 854 .handleMethodAnnotations(element);
855 if (isNative(element)) { 855 if (isNative(element)) {
856 native.NativeBehavior behavior = 856 native.NativeBehavior behavior =
857 native.NativeBehavior.ofMethodElement(element, compiler); 857 native.NativeBehavior.ofMethod(element, compiler);
858 nativeData.setNativeMethodBehavior(element, behavior); 858 nativeData.setNativeMethodBehavior(element, behavior);
859 registry.registerNativeData(behavior); 859 registry.registerNativeData(behavior);
860 } 860 }
861 } else if (element.isField) { 861 } else if (element.isField) {
862 compiler.enqueuer.resolution.nativeEnqueuer 862 compiler.enqueuer.resolution.nativeEnqueuer
863 .handleFieldAnnotations(element); 863 .handleFieldAnnotations(element);
864 if (isNative(element)) { 864 if (isNative(element)) {
865 native.NativeBehavior fieldLoadBehavior = 865 native.NativeBehavior fieldLoadBehavior =
866 native.NativeBehavior.ofFieldElementLoad(element, compiler); 866 native.NativeBehavior.ofFieldLoad(element, compiler);
867 native.NativeBehavior fieldStoreBehavior = native.NativeBehavior 867 native.NativeBehavior fieldStoreBehavior =
868 .ofFieldElementStore(element, compiler.resolution); 868 native.NativeBehavior.ofFieldStore(element, compiler);
869 nativeData.setNativeFieldLoadBehavior(element, fieldLoadBehavior); 869 nativeData.setNativeFieldLoadBehavior(element, fieldLoadBehavior);
870 nativeData.setNativeFieldStoreBehavior(element, fieldStoreBehavior); 870 nativeData.setNativeFieldStoreBehavior(element, fieldStoreBehavior);
871 871
872 // TODO(sra): Process fields for storing separately. 872 // TODO(sra): Process fields for storing separately.
873 // We have to handle both loading and storing to the field because we 873 // We have to handle both loading and storing to the field because we
874 // only get one look at each member and there might be a load or store 874 // only get one look at each member and there might be a load or store
875 // we have not seen yet. 875 // we have not seen yet.
876 registry.registerNativeData(fieldLoadBehavior); 876 registry.registerNativeData(fieldLoadBehavior);
877 registry.registerNativeData(fieldStoreBehavior); 877 registry.registerNativeData(fieldStoreBehavior);
878 } 878 }
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 1427
1428 void registerNoSuchMethod(FunctionElement noSuchMethod) { 1428 void registerNoSuchMethod(FunctionElement noSuchMethod) {
1429 noSuchMethodRegistry.registerNoSuchMethod(noSuchMethod); 1429 noSuchMethodRegistry.registerNoSuchMethod(noSuchMethod);
1430 } 1430 }
1431 1431
1432 /// Called when resolving a call to a foreign function. 1432 /// Called when resolving a call to a foreign function.
1433 native.NativeBehavior resolveForeignCall(Send node, Element element, 1433 native.NativeBehavior resolveForeignCall(Send node, Element element,
1434 CallStructure callStructure, ForeignResolver resolver) { 1434 CallStructure callStructure, ForeignResolver resolver) {
1435 native.NativeResolutionEnqueuer nativeEnqueuer = 1435 native.NativeResolutionEnqueuer nativeEnqueuer =
1436 compiler.enqueuer.resolution.nativeEnqueuer; 1436 compiler.enqueuer.resolution.nativeEnqueuer;
1437 if (element.name == BackendHelpers.JS) { 1437 if (element.name == 'JS') {
1438 return nativeEnqueuer.resolveJsCall(node, resolver); 1438 return nativeEnqueuer.resolveJsCall(node, resolver);
1439 } else if (element.name == BackendHelpers.JS_EMBEDDED_GLOBAL) { 1439 } else if (element.name == 'JS_EMBEDDED_GLOBAL') {
1440 return nativeEnqueuer.resolveJsEmbeddedGlobalCall(node, resolver); 1440 return nativeEnqueuer.resolveJsEmbeddedGlobalCall(node, resolver);
1441 } else if (element.name == BackendHelpers.JS_BUILTIN) { 1441 } else if (element.name == 'JS_BUILTIN') {
1442 return nativeEnqueuer.resolveJsBuiltinCall(node, resolver); 1442 return nativeEnqueuer.resolveJsBuiltinCall(node, resolver);
1443 } else if (element.name == BackendHelpers.JS_INTERCEPTOR_CONSTANT) { 1443 } else if (element.name == 'JS_INTERCEPTOR_CONSTANT') {
1444 // The type constant that is an argument to JS_INTERCEPTOR_CONSTANT names 1444 // The type constant that is an argument to JS_INTERCEPTOR_CONSTANT names
1445 // a class that will be instantiated outside the program by attaching a 1445 // a class that will be instantiated outside the program by attaching a
1446 // native class dispatch record referencing the interceptor. 1446 // native class dispatch record referencing the interceptor.
1447 if (!node.argumentsNode.isEmpty) { 1447 if (!node.argumentsNode.isEmpty) {
1448 Node argument = node.argumentsNode.nodes.head; 1448 Node argument = node.argumentsNode.nodes.head;
1449 ConstantExpression constant = resolver.getConstant(argument); 1449 ConstantExpression constant = resolver.getConstant(argument);
1450 if (constant != null && constant.kind == ConstantExpressionKind.TYPE) { 1450 if (constant != null && constant.kind == ConstantExpressionKind.TYPE) {
1451 TypeConstantExpression typeConstant = constant; 1451 TypeConstantExpression typeConstant = constant;
1452 if (typeConstant.type is InterfaceType) { 1452 if (typeConstant.type is InterfaceType) {
1453 resolver.registerInstantiatedType(typeConstant.type); 1453 resolver.registerInstantiatedType(typeConstant.type);
(...skipping 1834 matching lines...) Expand 10 before | Expand all | Expand 10 after
3288 ClassElement get mapImplementation => helpers.mapLiteralClass; 3288 ClassElement get mapImplementation => helpers.mapLiteralClass;
3289 ClassElement get constMapImplementation => helpers.constMapLiteralClass; 3289 ClassElement get constMapImplementation => helpers.constMapLiteralClass;
3290 ClassElement get typeImplementation => helpers.typeLiteralClass; 3290 ClassElement get typeImplementation => helpers.typeLiteralClass;
3291 ClassElement get boolImplementation => helpers.jsBoolClass; 3291 ClassElement get boolImplementation => helpers.jsBoolClass;
3292 ClassElement get nullImplementation => helpers.jsNullClass; 3292 ClassElement get nullImplementation => helpers.jsNullClass;
3293 ClassElement get syncStarIterableImplementation => helpers.syncStarIterable; 3293 ClassElement get syncStarIterableImplementation => helpers.syncStarIterable;
3294 ClassElement get asyncFutureImplementation => helpers.futureImplementation; 3294 ClassElement get asyncFutureImplementation => helpers.futureImplementation;
3295 ClassElement get asyncStarStreamImplementation => helpers.controllerStream; 3295 ClassElement get asyncStarStreamImplementation => helpers.controllerStream;
3296 ClassElement get functionImplementation => helpers.coreClasses.functionClass; 3296 ClassElement get functionImplementation => helpers.coreClasses.functionClass;
3297 } 3297 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/diagnostics/messages.dart ('k') | pkg/compiler/lib/src/js_backend/backend_helpers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698