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

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

Issue 14253008: Optimize length access on all JSIndexable things. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix test. Created 7 years, 8 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
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/lib/interceptors.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 ClassElement jsDoubleClass; 649 ClassElement jsDoubleClass;
650 ClassElement jsFunctionClass; 650 ClassElement jsFunctionClass;
651 ClassElement jsNullClass; 651 ClassElement jsNullClass;
652 ClassElement jsBoolClass; 652 ClassElement jsBoolClass;
653 653
654 ClassElement jsIndexableClass; 654 ClassElement jsIndexableClass;
655 ClassElement jsMutableArrayClass; 655 ClassElement jsMutableArrayClass;
656 ClassElement jsFixedArrayClass; 656 ClassElement jsFixedArrayClass;
657 ClassElement jsExtendableArrayClass; 657 ClassElement jsExtendableArrayClass;
658 658
659 Element jsArrayLength; 659 Element jsIndexableLength;
660 Element jsStringLength;
661 Element jsArrayRemoveLast; 660 Element jsArrayRemoveLast;
662 Element jsArrayAdd; 661 Element jsArrayAdd;
663 Element jsStringSplit; 662 Element jsStringSplit;
664 Element jsStringConcat; 663 Element jsStringConcat;
665 Element jsStringToString; 664 Element jsStringToString;
666 Element objectEquals; 665 Element objectEquals;
667 666
668 ClassElement typeLiteralClass; 667 ClassElement typeLiteralClass;
669 ClassElement mapLiteralClass; 668 ClassElement mapLiteralClass;
670 ClassElement constMapLiteralClass; 669 ClassElement constMapLiteralClass;
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 // TODO(kasperl): Some tests do not define the special JSArray 902 // TODO(kasperl): Some tests do not define the special JSArray
904 // subclasses, so we check to see if they are defined before 903 // subclasses, so we check to see if they are defined before
905 // trying to resolve them. 904 // trying to resolve them.
906 if (jsFixedArrayClass != null) { 905 if (jsFixedArrayClass != null) {
907 jsFixedArrayClass.ensureResolved(compiler); 906 jsFixedArrayClass.ensureResolved(compiler);
908 } 907 }
909 if (jsExtendableArrayClass != null) { 908 if (jsExtendableArrayClass != null) {
910 jsExtendableArrayClass.ensureResolved(compiler); 909 jsExtendableArrayClass.ensureResolved(compiler);
911 } 910 }
912 911
912 jsIndexableClass.ensureResolved(compiler);
913 jsIndexableLength = compiler.lookupElementIn(
914 jsIndexableClass, const SourceString('length'));
915 if (jsIndexableLength != null && jsIndexableLength.isAbstractField()) {
916 AbstractFieldElement element = jsIndexableLength;
917 jsIndexableLength = element.getter;
918 }
919
913 jsArrayClass.ensureResolved(compiler); 920 jsArrayClass.ensureResolved(compiler);
914 jsArrayLength = compiler.lookupElementIn(
915 jsArrayClass, const SourceString('length'));
916 if (jsArrayLength != null && jsArrayLength.isAbstractField()) {
917 AbstractFieldElement element = jsArrayLength;
918 jsArrayLength = element.getter;
919 }
920 jsArrayRemoveLast = compiler.lookupElementIn( 921 jsArrayRemoveLast = compiler.lookupElementIn(
921 jsArrayClass, const SourceString('removeLast')); 922 jsArrayClass, const SourceString('removeLast'));
922 jsArrayAdd = compiler.lookupElementIn( 923 jsArrayAdd = compiler.lookupElementIn(
923 jsArrayClass, const SourceString('add')); 924 jsArrayClass, const SourceString('add'));
924 925
925 jsStringClass.ensureResolved(compiler); 926 jsStringClass.ensureResolved(compiler);
926 jsStringLength = compiler.lookupElementIn(
927 jsStringClass, const SourceString('length'));
928 if (jsStringLength != null && jsStringLength.isAbstractField()) {
929 AbstractFieldElement element = jsStringLength;
930 jsStringLength = element.getter;
931 }
932 jsStringSplit = compiler.lookupElementIn( 927 jsStringSplit = compiler.lookupElementIn(
933 jsStringClass, const SourceString('split')); 928 jsStringClass, const SourceString('split'));
934 jsStringConcat = compiler.lookupElementIn( 929 jsStringConcat = compiler.lookupElementIn(
935 jsStringClass, const SourceString('concat')); 930 jsStringClass, const SourceString('concat'));
936 jsStringToString = compiler.lookupElementIn( 931 jsStringToString = compiler.lookupElementIn(
937 jsStringClass, const SourceString('toString')); 932 jsStringClass, const SourceString('toString'));
938 933
939 for (ClassElement cls in classes) { 934 for (ClassElement cls in classes) {
940 if (cls != null) interceptedClasses.add(cls); 935 if (cls != null) interceptedClasses.add(cls);
941 } 936 }
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
1780 ClassElement get constListImplementation => jsArrayClass; 1775 ClassElement get constListImplementation => jsArrayClass;
1781 ClassElement get fixedListImplementation => jsFixedArrayClass; 1776 ClassElement get fixedListImplementation => jsFixedArrayClass;
1782 ClassElement get growableListImplementation => jsExtendableArrayClass; 1777 ClassElement get growableListImplementation => jsExtendableArrayClass;
1783 ClassElement get mapImplementation => mapLiteralClass; 1778 ClassElement get mapImplementation => mapLiteralClass;
1784 ClassElement get constMapImplementation => constMapLiteralClass; 1779 ClassElement get constMapImplementation => constMapLiteralClass;
1785 ClassElement get functionImplementation => jsFunctionClass; 1780 ClassElement get functionImplementation => jsFunctionClass;
1786 ClassElement get typeImplementation => typeLiteralClass; 1781 ClassElement get typeImplementation => typeLiteralClass;
1787 ClassElement get boolImplementation => jsBoolClass; 1782 ClassElement get boolImplementation => jsBoolClass;
1788 ClassElement get nullImplementation => jsNullClass; 1783 ClassElement get nullImplementation => jsNullClass;
1789 } 1784 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/lib/interceptors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698