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

Side by Side Diff: runtime/vm/flow_graph_compiler.cc

Issue 12775009: Optimize TypedData operators [] and []= in the same way as ScalarList. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: ARM/MIPS build, comments, rebased 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
« no previous file with comments | « runtime/vm/flow_graph_compiler.h ('k') | runtime/vm/flow_graph_compiler_arm.cc » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX.
6 6
7 #include "vm/flow_graph_compiler.h" 7 #include "vm/flow_graph_compiler.h"
8 8
9 #include "vm/cha.h" 9 #include "vm/cha.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 return; 934 return;
935 } 935 }
936 } 936 }
937 937
938 // This move is not blocked. 938 // This move is not blocked.
939 EmitMove(index); 939 EmitMove(index);
940 } 940 }
941 941
942 942
943 intptr_t FlowGraphCompiler::ElementSizeFor(intptr_t cid) { 943 intptr_t FlowGraphCompiler::ElementSizeFor(intptr_t cid) {
944 if (RawObject::IsExternalTypedDataClassId(cid)) {
945 return ExternalTypedData::ElementSizeInBytes(cid);
946 } else if (RawObject::IsTypedDataClassId(cid)) {
947 return TypedData::ElementSizeInBytes(cid);
948 }
944 switch (cid) { 949 switch (cid) {
945 case kArrayCid: 950 case kArrayCid:
946 case kImmutableArrayCid: 951 case kImmutableArrayCid:
947 return Array::kBytesPerElement; 952 return Array::kBytesPerElement;
948 case kFloat32ArrayCid: 953 case kFloat32ArrayCid:
949 return Float32Array::kBytesPerElement; 954 return Float32Array::kBytesPerElement;
950 case kFloat64ArrayCid: 955 case kFloat64ArrayCid:
951 return Float64Array::kBytesPerElement; 956 return Float64Array::kBytesPerElement;
952 case kInt8ArrayCid: 957 case kInt8ArrayCid:
953 return Int8Array::kBytesPerElement; 958 return Int8Array::kBytesPerElement;
(...skipping 18 matching lines...) Expand all
972 case kExternalUint8ClampedArrayCid: 977 case kExternalUint8ClampedArrayCid:
973 return ExternalUint8ClampedArray::kBytesPerElement; 978 return ExternalUint8ClampedArray::kBytesPerElement;
974 default: 979 default:
975 UNIMPLEMENTED(); 980 UNIMPLEMENTED();
976 return 0; 981 return 0;
977 } 982 }
978 } 983 }
979 984
980 985
981 intptr_t FlowGraphCompiler::DataOffsetFor(intptr_t cid) { 986 intptr_t FlowGraphCompiler::DataOffsetFor(intptr_t cid) {
987 if (RawObject::IsExternalTypedDataClassId(cid)) {
988 // Elements start at offset 0 of the external data.
989 return 0;
990 }
991 if (RawObject::IsTypedDataClassId(cid)) {
992 return TypedData::data_offset();
993 }
982 switch (cid) { 994 switch (cid) {
983 case kArrayCid: 995 case kArrayCid:
984 case kImmutableArrayCid: 996 case kImmutableArrayCid:
985 return Array::data_offset(); 997 return Array::data_offset();
986 case kFloat32ArrayCid: 998 case kFloat32ArrayCid:
987 return Float32Array::data_offset(); 999 return Float32Array::data_offset();
988 case kFloat64ArrayCid: 1000 case kFloat64ArrayCid:
989 return Float64Array::data_offset(); 1001 return Float64Array::data_offset();
990 case kInt8ArrayCid: 1002 case kInt8ArrayCid:
991 return Int8Array::data_offset(); 1003 return Int8Array::data_offset();
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 if (i != largest_ix) { 1077 if (i != largest_ix) {
1066 // Swap. 1078 // Swap.
1067 CidTarget temp = (*sorted)[i]; 1079 CidTarget temp = (*sorted)[i];
1068 (*sorted)[i] = (*sorted)[largest_ix]; 1080 (*sorted)[i] = (*sorted)[largest_ix];
1069 (*sorted)[largest_ix] = temp; 1081 (*sorted)[largest_ix] = temp;
1070 } 1082 }
1071 } 1083 }
1072 } 1084 }
1073 1085
1074 } // namespace dart 1086 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler.h ('k') | runtime/vm/flow_graph_compiler_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698