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

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

Issue 14986002: Make static tear-off closures a class, like instance tear-off closures. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 : types = new List<HType>(length), 72 : types = new List<HType>(length),
73 namedArguments = null; 73 namedArguments = null;
74 HTypeList.withNamedArguments(int length, this.namedArguments) 74 HTypeList.withNamedArguments(int length, this.namedArguments)
75 : types = new List<HType>(length); 75 : types = new List<HType>(length);
76 const HTypeList.withAllUnknown() 76 const HTypeList.withAllUnknown()
77 : types = null, 77 : types = null,
78 namedArguments = null; 78 namedArguments = null;
79 79
80 factory HTypeList.fromStaticInvocation(HInvokeStatic node) { 80 factory HTypeList.fromStaticInvocation(HInvokeStatic node) {
81 bool allUnknown = true; 81 bool allUnknown = true;
82 for (int i = 1; i < node.inputs.length; i++) { 82 for (int i = 0; i < node.inputs.length; i++) {
83 if (node.inputs[i].instructionType != HType.UNKNOWN) { 83 if (node.inputs[i].instructionType != HType.UNKNOWN) {
84 allUnknown = false; 84 allUnknown = false;
85 break; 85 break;
86 } 86 }
87 } 87 }
88 if (allUnknown) return HTypeList.ALL_UNKNOWN; 88 if (allUnknown) return HTypeList.ALL_UNKNOWN;
89 89
90 HTypeList result = new HTypeList(node.inputs.length - 1); 90 HTypeList result = new HTypeList(node.inputs.length);
91 for (int i = 0; i < result.types.length; i++) { 91 for (int i = 0; i < result.types.length; i++) {
92 result.types[i] = node.inputs[i + 1].instructionType; 92 result.types[i] = node.inputs[i].instructionType;
93 assert(!result.types[i].isConflicting()); 93 assert(!result.types[i].isConflicting());
94 } 94 }
95 return result; 95 return result;
96 } 96 }
97 97
98 factory HTypeList.fromDynamicInvocation(HInvokeDynamic node, 98 factory HTypeList.fromDynamicInvocation(HInvokeDynamic node,
99 Selector selector) { 99 Selector selector) {
100 HTypeList result; 100 HTypeList result;
101 int argumentsCount = node.inputs.length - 1; 101 int argumentsCount = node.inputs.length - 1;
102 int startInvokeIndex = HInvoke.ARGUMENTS_OFFSET; 102 int startInvokeIndex = HInvoke.ARGUMENTS_OFFSET;
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 */ 640 */
641 final Map<FunctionElement, bool> canBeInlined = 641 final Map<FunctionElement, bool> canBeInlined =
642 new Map<FunctionElement, bool>(); 642 new Map<FunctionElement, bool>();
643 643
644 ClassElement jsInterceptorClass; 644 ClassElement jsInterceptorClass;
645 ClassElement jsStringClass; 645 ClassElement jsStringClass;
646 ClassElement jsArrayClass; 646 ClassElement jsArrayClass;
647 ClassElement jsNumberClass; 647 ClassElement jsNumberClass;
648 ClassElement jsIntClass; 648 ClassElement jsIntClass;
649 ClassElement jsDoubleClass; 649 ClassElement jsDoubleClass;
650 ClassElement jsFunctionClass;
651 ClassElement jsNullClass; 650 ClassElement jsNullClass;
652 ClassElement jsBoolClass; 651 ClassElement jsBoolClass;
653 652
654 ClassElement jsIndexableClass; 653 ClassElement jsIndexableClass;
655 ClassElement jsMutableIndexableClass; 654 ClassElement jsMutableIndexableClass;
656 655
657 ClassElement jsMutableArrayClass; 656 ClassElement jsMutableArrayClass;
658 ClassElement jsFixedArrayClass; 657 ClassElement jsFixedArrayClass;
659 ClassElement jsExtendableArrayClass; 658 ClassElement jsExtendableArrayClass;
660 659
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 jsInterceptorClass = 911 jsInterceptorClass =
913 compiler.findInterceptor(const SourceString('Interceptor')), 912 compiler.findInterceptor(const SourceString('Interceptor')),
914 jsStringClass = compiler.findInterceptor(const SourceString('JSString')), 913 jsStringClass = compiler.findInterceptor(const SourceString('JSString')),
915 jsArrayClass = compiler.findInterceptor(const SourceString('JSArray')), 914 jsArrayClass = compiler.findInterceptor(const SourceString('JSArray')),
916 // The int class must be before the double class, because the 915 // The int class must be before the double class, because the
917 // emitter relies on this list for the order of type checks. 916 // emitter relies on this list for the order of type checks.
918 jsIntClass = compiler.findInterceptor(const SourceString('JSInt')), 917 jsIntClass = compiler.findInterceptor(const SourceString('JSInt')),
919 jsDoubleClass = compiler.findInterceptor(const SourceString('JSDouble')), 918 jsDoubleClass = compiler.findInterceptor(const SourceString('JSDouble')),
920 jsNumberClass = compiler.findInterceptor(const SourceString('JSNumber')), 919 jsNumberClass = compiler.findInterceptor(const SourceString('JSNumber')),
921 jsNullClass = compiler.findInterceptor(const SourceString('JSNull')), 920 jsNullClass = compiler.findInterceptor(const SourceString('JSNull')),
922 jsFunctionClass =
923 compiler.findInterceptor(const SourceString('JSFunction')),
924 jsBoolClass = compiler.findInterceptor(const SourceString('JSBool')), 921 jsBoolClass = compiler.findInterceptor(const SourceString('JSBool')),
925 jsMutableArrayClass = 922 jsMutableArrayClass =
926 compiler.findInterceptor(const SourceString('JSMutableArray')), 923 compiler.findInterceptor(const SourceString('JSMutableArray')),
927 jsFixedArrayClass = 924 jsFixedArrayClass =
928 compiler.findInterceptor(const SourceString('JSFixedArray')), 925 compiler.findInterceptor(const SourceString('JSFixedArray')),
929 jsExtendableArrayClass = 926 jsExtendableArrayClass =
930 compiler.findInterceptor(const SourceString('JSExtendableArray'))]; 927 compiler.findInterceptor(const SourceString('JSExtendableArray'))];
931 928
932 jsIndexableClass = 929 jsIndexableClass =
933 compiler.findInterceptor(const SourceString('JSIndexable')); 930 compiler.findInterceptor(const SourceString('JSIndexable'));
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 || cls == jsExtendableArrayClass) { 1112 || cls == jsExtendableArrayClass) {
1116 addInterceptors(jsArrayClass, enqueuer, elements); 1113 addInterceptors(jsArrayClass, enqueuer, elements);
1117 enqueuer.registerInstantiatedClass(jsFixedArrayClass, elements); 1114 enqueuer.registerInstantiatedClass(jsFixedArrayClass, elements);
1118 enqueuer.registerInstantiatedClass(jsExtendableArrayClass, elements); 1115 enqueuer.registerInstantiatedClass(jsExtendableArrayClass, elements);
1119 } else if (cls == compiler.intClass || cls == jsIntClass) { 1116 } else if (cls == compiler.intClass || cls == jsIntClass) {
1120 addInterceptors(jsIntClass, enqueuer, elements); 1117 addInterceptors(jsIntClass, enqueuer, elements);
1121 addInterceptors(jsNumberClass, enqueuer, elements); 1118 addInterceptors(jsNumberClass, enqueuer, elements);
1122 } else if (cls == compiler.doubleClass || cls == jsDoubleClass) { 1119 } else if (cls == compiler.doubleClass || cls == jsDoubleClass) {
1123 addInterceptors(jsDoubleClass, enqueuer, elements); 1120 addInterceptors(jsDoubleClass, enqueuer, elements);
1124 addInterceptors(jsNumberClass, enqueuer, elements); 1121 addInterceptors(jsNumberClass, enqueuer, elements);
1125 } else if (cls == compiler.functionClass || cls == jsFunctionClass) {
1126 addInterceptors(jsFunctionClass, enqueuer, elements);
1127 } else if (cls == compiler.boolClass || cls == jsBoolClass) { 1122 } else if (cls == compiler.boolClass || cls == jsBoolClass) {
1128 addInterceptors(jsBoolClass, enqueuer, elements); 1123 addInterceptors(jsBoolClass, enqueuer, elements);
1129 } else if (cls == compiler.nullClass || cls == jsNullClass) { 1124 } else if (cls == compiler.nullClass || cls == jsNullClass) {
1130 addInterceptors(jsNullClass, enqueuer, elements); 1125 addInterceptors(jsNullClass, enqueuer, elements);
1131 } else if (cls == compiler.numClass || cls == jsNumberClass) { 1126 } else if (cls == compiler.numClass || cls == jsNumberClass) {
1132 addInterceptors(jsIntClass, enqueuer, elements); 1127 addInterceptors(jsIntClass, enqueuer, elements);
1133 addInterceptors(jsDoubleClass, enqueuer, elements); 1128 addInterceptors(jsDoubleClass, enqueuer, elements);
1134 addInterceptors(jsNumberClass, enqueuer, elements); 1129 addInterceptors(jsNumberClass, enqueuer, elements);
1135 } else if (cls.isNative()) { 1130 } else if (cls.isNative()) {
1136 addInterceptorsForNativeClassMembers(cls, enqueuer); 1131 addInterceptorsForNativeClassMembers(cls, enqueuer);
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
1648 } else if (element == jsNumberClass || element == compiler.numClass) { 1643 } else if (element == jsNumberClass || element == compiler.numClass) {
1649 if (nativeCheckOnly) return null; 1644 if (nativeCheckOnly) return null;
1650 return typeCast 1645 return typeCast
1651 ? const SourceString("numTypeCast") 1646 ? const SourceString("numTypeCast")
1652 : const SourceString('numTypeCheck'); 1647 : const SourceString('numTypeCheck');
1653 } else if (element == jsBoolClass || element == compiler.boolClass) { 1648 } else if (element == jsBoolClass || element == compiler.boolClass) {
1654 if (nativeCheckOnly) return null; 1649 if (nativeCheckOnly) return null;
1655 return typeCast 1650 return typeCast
1656 ? const SourceString("boolTypeCast") 1651 ? const SourceString("boolTypeCast")
1657 : const SourceString('boolTypeCheck'); 1652 : const SourceString('boolTypeCheck');
1658 } else if (element == jsFunctionClass ||
1659 element == compiler.functionClass) {
1660 if (nativeCheckOnly) return null;
1661 return typeCast
1662 ? const SourceString("functionTypeCast")
1663 : const SourceString('functionTypeCheck');
1664 } else if (element == jsIntClass || element == compiler.intClass) { 1653 } else if (element == jsIntClass || element == compiler.intClass) {
1665 if (nativeCheckOnly) return null; 1654 if (nativeCheckOnly) return null;
1666 return typeCast ? 1655 return typeCast ?
1667 const SourceString("intTypeCast") : 1656 const SourceString("intTypeCast") :
1668 const SourceString('intTypeCheck'); 1657 const SourceString('intTypeCheck');
1669 } else if (Elements.isNumberOrStringSupertype(element, compiler)) { 1658 } else if (Elements.isNumberOrStringSupertype(element, compiler)) {
1670 if (nativeCheck) { 1659 if (nativeCheck) {
1671 return typeCast 1660 return typeCast
1672 ? const SourceString("numberOrStringSuperNativeTypeCast") 1661 ? const SourceString("numberOrStringSuperNativeTypeCast")
1673 : const SourceString('numberOrStringSuperNativeTypeCheck'); 1662 : const SourceString('numberOrStringSuperNativeTypeCheck');
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1837 ClassElement get intImplementation => jsIntClass; 1826 ClassElement get intImplementation => jsIntClass;
1838 ClassElement get doubleImplementation => jsDoubleClass; 1827 ClassElement get doubleImplementation => jsDoubleClass;
1839 ClassElement get numImplementation => jsNumberClass; 1828 ClassElement get numImplementation => jsNumberClass;
1840 ClassElement get stringImplementation => jsStringClass; 1829 ClassElement get stringImplementation => jsStringClass;
1841 ClassElement get listImplementation => jsArrayClass; 1830 ClassElement get listImplementation => jsArrayClass;
1842 ClassElement get constListImplementation => jsArrayClass; 1831 ClassElement get constListImplementation => jsArrayClass;
1843 ClassElement get fixedListImplementation => jsFixedArrayClass; 1832 ClassElement get fixedListImplementation => jsFixedArrayClass;
1844 ClassElement get growableListImplementation => jsExtendableArrayClass; 1833 ClassElement get growableListImplementation => jsExtendableArrayClass;
1845 ClassElement get mapImplementation => mapLiteralClass; 1834 ClassElement get mapImplementation => mapLiteralClass;
1846 ClassElement get constMapImplementation => constMapLiteralClass; 1835 ClassElement get constMapImplementation => constMapLiteralClass;
1847 ClassElement get functionImplementation => jsFunctionClass;
1848 ClassElement get typeImplementation => typeLiteralClass; 1836 ClassElement get typeImplementation => typeLiteralClass;
1849 ClassElement get boolImplementation => jsBoolClass; 1837 ClassElement get boolImplementation => jsBoolClass;
1850 ClassElement get nullImplementation => jsNullClass; 1838 ClassElement get nullImplementation => jsNullClass;
1851 } 1839 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698