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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_backend/backend.dart

Issue 12528008: Implement CHA through type mask and TypedSelector in the simple type inferrer. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
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 typedef void Recompile(Element element); 7 typedef void Recompile(Element element);
8 8
9 class ReturnInfo { 9 class ReturnInfo {
10 HType returnType; 10 HType returnType;
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 new Map<Element, jsAst.Expression>(); 635 new Map<Element, jsAst.Expression>();
636 636
637 ClassElement jsStringClass; 637 ClassElement jsStringClass;
638 ClassElement jsArrayClass; 638 ClassElement jsArrayClass;
639 ClassElement jsNumberClass; 639 ClassElement jsNumberClass;
640 ClassElement jsIntClass; 640 ClassElement jsIntClass;
641 ClassElement jsDoubleClass; 641 ClassElement jsDoubleClass;
642 ClassElement jsFunctionClass; 642 ClassElement jsFunctionClass;
643 ClassElement jsNullClass; 643 ClassElement jsNullClass;
644 ClassElement jsBoolClass; 644 ClassElement jsBoolClass;
645 ClassElement typeLiteralClass;
646 ClassElement mapLiteralClass;
647 ClassElement constMapLiteralClass;
645 ClassElement jsIndexableClass; 648 ClassElement jsIndexableClass;
646 Element jsArrayLength; 649 Element jsArrayLength;
647 Element jsStringLength; 650 Element jsStringLength;
648 Element jsArrayRemoveLast; 651 Element jsArrayRemoveLast;
649 Element jsArrayAdd; 652 Element jsArrayAdd;
650 Element jsStringSplit; 653 Element jsStringSplit;
651 Element jsStringConcat; 654 Element jsStringConcat;
652 Element jsStringToString; 655 Element jsStringToString;
653 Element getInterceptorMethod; 656 Element getInterceptorMethod;
654 Element interceptedNames; 657 Element interceptedNames;
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 jsStringClass, const SourceString('split')); 851 jsStringClass, const SourceString('split'));
849 jsStringConcat = compiler.lookupElementIn( 852 jsStringConcat = compiler.lookupElementIn(
850 jsStringClass, const SourceString('concat')); 853 jsStringClass, const SourceString('concat'));
851 jsStringToString = compiler.lookupElementIn( 854 jsStringToString = compiler.lookupElementIn(
852 jsStringClass, const SourceString('toString')); 855 jsStringClass, const SourceString('toString'));
853 856
854 for (ClassElement cls in classes) { 857 for (ClassElement cls in classes) {
855 if (cls != null) interceptedClasses.add(cls); 858 if (cls != null) interceptedClasses.add(cls);
856 } 859 }
857 860
861 typeLiteralClass = compiler.findHelper(const SourceString('TypeImpl'));
862 mapLiteralClass =
863 compiler.coreLibrary.find(const SourceString('LinkedHashMap'));
864 constMapLiteralClass =
865 compiler.findHelper(const SourceString('ConstantMap'));
866
858 specialOperatorEqClasses 867 specialOperatorEqClasses
859 ..add(jsNullClass) 868 ..add(jsNullClass)
860 ..add(jsNumberClass); 869 ..add(jsNumberClass);
861 } 870 }
862 871
863 void addInterceptors(ClassElement cls, Enqueuer enqueuer) { 872 void addInterceptors(ClassElement cls, Enqueuer enqueuer) {
864 if (enqueuer.isResolutionQueue) { 873 if (enqueuer.isResolutionQueue) {
865 cls.ensureResolved(compiler); 874 cls.ensureResolved(compiler);
866 cls.forEachMember((ClassElement classElement, Element member) { 875 cls.forEachMember((ClassElement classElement, Element member) {
867 Set<Element> set = interceptedElements.putIfAbsent( 876 Set<Element> set = interceptedElements.putIfAbsent(
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 enqueuer.registerStaticUse( 926 enqueuer.registerStaticUse(
918 compiler.findHelper(const SourceString('ioore'))); 927 compiler.findHelper(const SourceString('ioore')));
919 enqueuer.registerStaticUse( 928 enqueuer.registerStaticUse(
920 compiler.findHelper(const SourceString('iae'))); 929 compiler.findHelper(const SourceString('iae')));
921 } else if (cls == compiler.functionClass) { 930 } else if (cls == compiler.functionClass) {
922 enqueuer.registerInstantiatedClass(compiler.closureClass); 931 enqueuer.registerInstantiatedClass(compiler.closureClass);
923 } else if (cls == compiler.mapClass) { 932 } else if (cls == compiler.mapClass) {
924 // The backend will use a literal list to initialize the entries 933 // The backend will use a literal list to initialize the entries
925 // of the map. 934 // of the map.
926 enqueuer.registerInstantiatedClass(compiler.listClass); 935 enqueuer.registerInstantiatedClass(compiler.listClass);
927 enqueuer.registerInstantiatedClass(compiler.mapLiteralClass); 936 enqueuer.registerInstantiatedClass(mapLiteralClass);
928 enqueueInResolution(getMapMaker()); 937 enqueueInResolution(getMapMaker());
929 } 938 }
930 } 939 }
931 ClassElement result = null; 940 ClassElement result = null;
932 if (cls == compiler.stringClass) { 941 if (cls == compiler.stringClass) {
933 addInterceptors(jsStringClass, enqueuer); 942 addInterceptors(jsStringClass, enqueuer);
934 } else if (cls == compiler.listClass) { 943 } else if (cls == compiler.listClass) {
935 addInterceptors(jsArrayClass, enqueuer); 944 addInterceptors(jsArrayClass, enqueuer);
936 } else if (cls == compiler.intClass) { 945 } else if (cls == compiler.intClass) {
937 addInterceptors(jsIntClass, enqueuer); 946 addInterceptors(jsIntClass, enqueuer);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 } 1031 }
1023 1032
1024 void registerRuntimeType() { 1033 void registerRuntimeType() {
1025 enqueueInResolution(getSetRuntimeTypeInfo()); 1034 enqueueInResolution(getSetRuntimeTypeInfo());
1026 enqueueInResolution(getGetRuntimeTypeInfo()); 1035 enqueueInResolution(getGetRuntimeTypeInfo());
1027 enqueueInResolution(getGetRuntimeTypeArgument()); 1036 enqueueInResolution(getGetRuntimeTypeArgument());
1028 compiler.enqueuer.resolution.registerInstantiatedClass(compiler.listClass); 1037 compiler.enqueuer.resolution.registerInstantiatedClass(compiler.listClass);
1029 } 1038 }
1030 1039
1031 void registerIsCheck(DartType type, Enqueuer world) { 1040 void registerIsCheck(DartType type, Enqueuer world) {
1041 world.registerInstantiatedClass(compiler.boolClass);
1032 bool isTypeVariable = type.kind == TypeKind.TYPE_VARIABLE; 1042 bool isTypeVariable = type.kind == TypeKind.TYPE_VARIABLE;
1033 if (!type.isRaw || isTypeVariable) { 1043 if (!type.isRaw || isTypeVariable) {
1034 enqueueInResolution(getSetRuntimeTypeInfo()); 1044 enqueueInResolution(getSetRuntimeTypeInfo());
1035 enqueueInResolution(getGetRuntimeTypeInfo()); 1045 enqueueInResolution(getGetRuntimeTypeInfo());
1036 enqueueInResolution(getGetRuntimeTypeArgument()); 1046 enqueueInResolution(getGetRuntimeTypeArgument());
1037 enqueueInResolution(getCheckArguments()); 1047 enqueueInResolution(getCheckArguments());
1038 if (isTypeVariable) enqueueInResolution(getGetObjectIsSubtype()); 1048 if (isTypeVariable) enqueueInResolution(getGetObjectIsSubtype());
1039 world.registerInstantiatedClass(compiler.listClass); 1049 world.registerInstantiatedClass(compiler.listClass);
1040 } 1050 }
1041 // [registerIsCheck] is also called for checked mode checks, so we 1051 // [registerIsCheck] is also called for checked mode checks, so we
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
1524 void eagerRecompile(Element element) { 1534 void eagerRecompile(Element element) {
1525 assert(invariant(element, element.isDeclaration)); 1535 assert(invariant(element, element.isDeclaration));
1526 generatedCode.remove(element); 1536 generatedCode.remove(element);
1527 generatedBailoutCode.remove(element); 1537 generatedBailoutCode.remove(element);
1528 compiler.enqueuer.codegen.addToWorkList(element); 1538 compiler.enqueuer.codegen.addToWorkList(element);
1529 } 1539 }
1530 1540
1531 bool isNullImplementation(ClassElement cls) { 1541 bool isNullImplementation(ClassElement cls) {
1532 return cls == jsNullClass; 1542 return cls == jsNullClass;
1533 } 1543 }
1544
1545 ClassElement get intImplementation => jsIntClass;
1546 ClassElement get doubleImplementation => jsDoubleClass;
1547 ClassElement get numImplementation => jsNumberClass;
1548 ClassElement get stringImplementation => jsStringClass;
1549 ClassElement get listImplementation => jsArrayClass;
1550 ClassElement get mapImplementation => mapLiteralClass;
1551 ClassElement get constMapImplementation => constMapLiteralClass;
1552 ClassElement get functionImplementation => jsFunctionClass;
1553 ClassElement get typeImplementation => typeLiteralClass;
1554 ClassElement get boolImplementation => jsBoolClass;
1555 ClassElement get nullImplementation => jsNullClass;
1534 } 1556 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/compiler.dart ('k') | sdk/lib/_internal/compiler/implementation/native_handler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698