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

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

Issue 612553002: Make LoadIndexedInstr for Uint32List use kUnboxedUint32 representation (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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) 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_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 case kExternalTypedDataUint8ArrayCid: 1006 case kExternalTypedDataUint8ArrayCid:
1007 case kExternalTypedDataUint8ClampedArrayCid: 1007 case kExternalTypedDataUint8ClampedArrayCid:
1008 case kTypedDataInt16ArrayCid: 1008 case kTypedDataInt16ArrayCid:
1009 case kTypedDataUint16ArrayCid: 1009 case kTypedDataUint16ArrayCid:
1010 case kOneByteStringCid: 1010 case kOneByteStringCid:
1011 case kTwoByteStringCid: 1011 case kTwoByteStringCid:
1012 return CompileType::FromCid(kSmiCid); 1012 return CompileType::FromCid(kSmiCid);
1013 1013
1014 case kTypedDataInt32ArrayCid: 1014 case kTypedDataInt32ArrayCid:
1015 case kTypedDataUint32ArrayCid: 1015 case kTypedDataUint32ArrayCid:
1016 return Typed32BitIsSmi() ? CompileType::FromCid(kSmiCid) 1016 return CompileType::Int();
1017 : CompileType::FromCid(kMintCid);
1018 1017
1019 default: 1018 default:
1020 UNIMPLEMENTED(); 1019 UNIMPLEMENTED();
1021 return CompileType::Dynamic(); 1020 return CompileType::Dynamic();
1022 } 1021 }
1023 } 1022 }
1024 1023
1025 1024
1026 Representation LoadIndexedInstr::representation() const { 1025 Representation LoadIndexedInstr::representation() const {
1027 switch (class_id_) { 1026 switch (class_id_) {
1028 case kArrayCid: 1027 case kArrayCid:
1029 case kImmutableArrayCid: 1028 case kImmutableArrayCid:
1030 case kTypedDataInt8ArrayCid: 1029 case kTypedDataInt8ArrayCid:
1031 case kTypedDataUint8ArrayCid: 1030 case kTypedDataUint8ArrayCid:
1032 case kTypedDataUint8ClampedArrayCid: 1031 case kTypedDataUint8ClampedArrayCid:
1033 case kExternalTypedDataUint8ArrayCid: 1032 case kExternalTypedDataUint8ArrayCid:
1034 case kExternalTypedDataUint8ClampedArrayCid: 1033 case kExternalTypedDataUint8ClampedArrayCid:
1035 case kTypedDataInt16ArrayCid: 1034 case kTypedDataInt16ArrayCid:
1036 case kTypedDataUint16ArrayCid: 1035 case kTypedDataUint16ArrayCid:
1037 case kOneByteStringCid: 1036 case kOneByteStringCid:
1038 case kTwoByteStringCid: 1037 case kTwoByteStringCid:
1039 return kTagged; 1038 return kTagged;
1040 case kTypedDataInt32ArrayCid: 1039 case kTypedDataInt32ArrayCid:
1040 return kUnboxedInt32;
1041 case kTypedDataUint32ArrayCid: 1041 case kTypedDataUint32ArrayCid:
1042 return Typed32BitIsSmi() ? kTagged : kUnboxedMint; 1042 return kUnboxedUint32;
1043 case kTypedDataFloat32ArrayCid: 1043 case kTypedDataFloat32ArrayCid:
1044 case kTypedDataFloat64ArrayCid: 1044 case kTypedDataFloat64ArrayCid:
1045 return kUnboxedDouble; 1045 return kUnboxedDouble;
1046 case kTypedDataFloat32x4ArrayCid: 1046 case kTypedDataFloat32x4ArrayCid:
1047 return kUnboxedFloat32x4; 1047 return kUnboxedFloat32x4;
1048 case kTypedDataInt32x4ArrayCid: 1048 case kTypedDataInt32x4ArrayCid:
1049 return kUnboxedInt32x4; 1049 return kUnboxedInt32x4;
1050 case kTypedDataFloat64x2ArrayCid: 1050 case kTypedDataFloat64x2ArrayCid:
1051 return kUnboxedFloat64x2; 1051 return kUnboxedFloat64x2;
1052 default: 1052 default:
(...skipping 18 matching lines...) Expand all
1071 // element sizes > 1). 1071 // element sizes > 1).
1072 locs->set_in(1, (index_scale() == 1) 1072 locs->set_in(1, (index_scale() == 1)
1073 ? Location::WritableRegister() 1073 ? Location::WritableRegister()
1074 : Location::RequiresRegister()); 1074 : Location::RequiresRegister());
1075 } 1075 }
1076 if ((representation() == kUnboxedDouble) || 1076 if ((representation() == kUnboxedDouble) ||
1077 (representation() == kUnboxedFloat32x4) || 1077 (representation() == kUnboxedFloat32x4) ||
1078 (representation() == kUnboxedInt32x4) || 1078 (representation() == kUnboxedInt32x4) ||
1079 (representation() == kUnboxedFloat64x2)) { 1079 (representation() == kUnboxedFloat64x2)) {
1080 locs->set_out(0, Location::RequiresFpuRegister()); 1080 locs->set_out(0, Location::RequiresFpuRegister());
1081 } else if (representation() == kUnboxedMint) { 1081 } else if (representation() == kUnboxedUint32) {
1082 if (class_id() == kTypedDataInt32ArrayCid) { 1082 ASSERT(class_id() == kTypedDataUint32ArrayCid);
1083 locs->set_out(0, Location::Pair(Location::RegisterLocation(EAX), 1083 locs->set_out(0, Location::RequiresRegister());
1084 Location::RegisterLocation(EDX))); 1084 } else if (representation() == kUnboxedInt32) {
1085 } else { 1085 ASSERT(class_id() == kTypedDataInt32ArrayCid);
1086 ASSERT(class_id() == kTypedDataUint32ArrayCid); 1086 locs->set_out(0, Location::RequiresRegister());
1087 locs->set_out(0, Location::Pair(Location::RequiresRegister(),
1088 Location::RequiresRegister()));
1089 }
1090 } else { 1087 } else {
1091 ASSERT(representation() == kTagged); 1088 ASSERT(representation() == kTagged);
1092 locs->set_out(0, Location::RequiresRegister()); 1089 locs->set_out(0, Location::RequiresRegister());
1093 } 1090 }
1094 return locs; 1091 return locs;
1095 } 1092 }
1096 1093
1097 1094
1098 void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1095 void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1099 // The array register points to the backing store for external arrays. 1096 // The array register points to the backing store for external arrays.
(...skipping 26 matching lines...) Expand all
1126 case kTypedDataFloat32x4ArrayCid: 1123 case kTypedDataFloat32x4ArrayCid:
1127 case kTypedDataFloat64x2ArrayCid: 1124 case kTypedDataFloat64x2ArrayCid:
1128 __ movups(result, element_address); 1125 __ movups(result, element_address);
1129 break; 1126 break;
1130 default: 1127 default:
1131 UNREACHABLE(); 1128 UNREACHABLE();
1132 } 1129 }
1133 return; 1130 return;
1134 } 1131 }
1135 1132
1136 if (representation() == kUnboxedMint) { 1133 if (representation() == kUnboxedUint32) {
1137 ASSERT(locs()->out(0).IsPairLocation()); 1134 ASSERT(class_id() == kTypedDataUint32ArrayCid);
1138 PairLocation* result_pair = locs()->out(0).AsPairLocation(); 1135 Register result = locs()->out(0).reg();
1139 Register result1 = result_pair->At(0).reg();
1140 Register result2 = result_pair->At(1).reg();
1141 if ((index_scale() == 1) && index.IsRegister()) { 1136 if ((index_scale() == 1) && index.IsRegister()) {
1142 __ SmiUntag(index.reg()); 1137 __ SmiUntag(index.reg());
1143 } 1138 }
1144 switch (class_id()) { 1139 __ movl(result, element_address);
1145 case kTypedDataInt32ArrayCid:
1146 ASSERT(result1 == EAX);
1147 ASSERT(result2 == EDX);
1148 __ movl(result1, element_address);
1149 __ cdq();
1150 break;
1151 case kTypedDataUint32ArrayCid:
1152 __ movl(result1, element_address);
1153 __ xorl(result2, result2);
1154 break;
1155 default:
1156 UNREACHABLE();
1157 }
1158 return; 1140 return;
1159 } 1141 }
1160 1142
1143 if (representation() == kUnboxedInt32) {
1144 ASSERT(class_id() == kTypedDataInt32ArrayCid);
1145 Register result = locs()->out(0).reg();
1146 if ((index_scale() == 1) && index.IsRegister()) {
1147 __ SmiUntag(index.reg());
1148 }
1149 __ movl(result, element_address);
1150 return;
1151 }
1152
Vyacheslav Egorov (Google) 2014/09/30 16:52:52 I suggest to make it look more like on ARM64 to re
Cutch 2014/09/30 17:16:21 Done.
1161 ASSERT(representation() == kTagged); 1153 ASSERT(representation() == kTagged);
1162 1154
1163 Register result = locs()->out(0).reg(); 1155 Register result = locs()->out(0).reg();
1164 if ((index_scale() == 1) && index.IsRegister()) { 1156 if ((index_scale() == 1) && index.IsRegister()) {
1165 __ SmiUntag(index.reg()); 1157 __ SmiUntag(index.reg());
1166 } 1158 }
1167 switch (class_id()) { 1159 switch (class_id()) {
1168 case kTypedDataInt8ArrayCid: 1160 case kTypedDataInt8ArrayCid:
1169 ASSERT(index_scale() == 1); 1161 ASSERT(index_scale() == 1);
1170 __ movsxb(result, element_address); 1162 __ movsxb(result, element_address);
(...skipping 5614 matching lines...) Expand 10 before | Expand all | Expand 10 after
6785 __ movl(EDX, Immediate(kInvalidObjectPointer)); 6777 __ movl(EDX, Immediate(kInvalidObjectPointer));
6786 __ movl(EDX, Immediate(kInvalidObjectPointer)); 6778 __ movl(EDX, Immediate(kInvalidObjectPointer));
6787 #endif 6779 #endif
6788 } 6780 }
6789 6781
6790 } // namespace dart 6782 } // namespace dart
6791 6783
6792 #undef __ 6784 #undef __
6793 6785
6794 #endif // defined TARGET_ARCH_IA32 6786 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698