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

Side by Side Diff: runtime/vm/intermediate_language_arm.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_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 case kExternalTypedDataUint8ArrayCid: 1110 case kExternalTypedDataUint8ArrayCid:
1111 case kExternalTypedDataUint8ClampedArrayCid: 1111 case kExternalTypedDataUint8ClampedArrayCid:
1112 case kTypedDataInt16ArrayCid: 1112 case kTypedDataInt16ArrayCid:
1113 case kTypedDataUint16ArrayCid: 1113 case kTypedDataUint16ArrayCid:
1114 case kOneByteStringCid: 1114 case kOneByteStringCid:
1115 case kTwoByteStringCid: 1115 case kTwoByteStringCid:
1116 return CompileType::FromCid(kSmiCid); 1116 return CompileType::FromCid(kSmiCid);
1117 1117
1118 case kTypedDataInt32ArrayCid: 1118 case kTypedDataInt32ArrayCid:
1119 case kTypedDataUint32ArrayCid: 1119 case kTypedDataUint32ArrayCid:
1120 return Typed32BitIsSmi() ? CompileType::FromCid(kSmiCid) 1120 return CompileType::Int();
1121 : CompileType::FromCid(kMintCid);
1122 1121
1123 default: 1122 default:
1124 UNREACHABLE(); 1123 UNREACHABLE();
1125 return CompileType::Dynamic(); 1124 return CompileType::Dynamic();
1126 } 1125 }
1127 } 1126 }
1128 1127
1129 1128
1130 Representation LoadIndexedInstr::representation() const { 1129 Representation LoadIndexedInstr::representation() const {
1131 switch (class_id_) { 1130 switch (class_id_) {
1132 case kArrayCid: 1131 case kArrayCid:
1133 case kImmutableArrayCid: 1132 case kImmutableArrayCid:
1134 case kTypedDataInt8ArrayCid: 1133 case kTypedDataInt8ArrayCid:
1135 case kTypedDataUint8ArrayCid: 1134 case kTypedDataUint8ArrayCid:
1136 case kTypedDataUint8ClampedArrayCid: 1135 case kTypedDataUint8ClampedArrayCid:
1137 case kExternalTypedDataUint8ArrayCid: 1136 case kExternalTypedDataUint8ArrayCid:
1138 case kExternalTypedDataUint8ClampedArrayCid: 1137 case kExternalTypedDataUint8ClampedArrayCid:
1139 case kTypedDataInt16ArrayCid: 1138 case kTypedDataInt16ArrayCid:
1140 case kTypedDataUint16ArrayCid: 1139 case kTypedDataUint16ArrayCid:
1141 case kOneByteStringCid: 1140 case kOneByteStringCid:
1142 case kTwoByteStringCid: 1141 case kTwoByteStringCid:
1143 return kTagged; 1142 return kTagged;
1144 case kTypedDataInt32ArrayCid: 1143 case kTypedDataInt32ArrayCid:
1144 return kUnboxedInt32;
1145 case kTypedDataUint32ArrayCid: 1145 case kTypedDataUint32ArrayCid:
1146 return Typed32BitIsSmi() ? kTagged : kUnboxedMint; 1146 return kUnboxedUint32;
1147 case kTypedDataFloat32ArrayCid: 1147 case kTypedDataFloat32ArrayCid:
1148 case kTypedDataFloat64ArrayCid: 1148 case kTypedDataFloat64ArrayCid:
1149 return kUnboxedDouble; 1149 return kUnboxedDouble;
1150 case kTypedDataInt32x4ArrayCid: 1150 case kTypedDataInt32x4ArrayCid:
1151 return kUnboxedInt32x4; 1151 return kUnboxedInt32x4;
1152 case kTypedDataFloat32x4ArrayCid: 1152 case kTypedDataFloat32x4ArrayCid:
1153 return kUnboxedFloat32x4; 1153 return kUnboxedFloat32x4;
1154 case kTypedDataFloat64x2ArrayCid: 1154 case kTypedDataFloat64x2ArrayCid:
1155 return kUnboxedFloat64x2; 1155 return kUnboxedFloat64x2;
1156 default: 1156 default:
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 (representation() == kUnboxedInt32x4) || 1219 (representation() == kUnboxedInt32x4) ||
1220 (representation() == kUnboxedFloat64x2)) { 1220 (representation() == kUnboxedFloat64x2)) {
1221 if (class_id() == kTypedDataFloat32ArrayCid) { 1221 if (class_id() == kTypedDataFloat32ArrayCid) {
1222 // Need register <= Q7 for float operations. 1222 // Need register <= Q7 for float operations.
1223 // TODO(fschneider): Add a register policy to specify a subset of 1223 // TODO(fschneider): Add a register policy to specify a subset of
1224 // registers. 1224 // registers.
1225 locs->set_out(0, Location::FpuRegisterLocation(Q7)); 1225 locs->set_out(0, Location::FpuRegisterLocation(Q7));
1226 } else { 1226 } else {
1227 locs->set_out(0, Location::RequiresFpuRegister()); 1227 locs->set_out(0, Location::RequiresFpuRegister());
1228 } 1228 }
1229 } else if (representation() == kUnboxedMint) { 1229 } else if (representation() == kUnboxedUint32) {
1230 locs->set_out(0, Location::Pair(Location::RequiresRegister(), 1230 ASSERT(class_id() == kTypedDataUint32ArrayCid);
1231 Location::RequiresRegister())); 1231 locs->set_out(0, Location::RequiresRegister());
1232 } else if (representation() == kUnboxedInt32) {
1233 ASSERT(class_id() == kTypedDataInt32ArrayCid);
1234 locs->set_out(0, Location::RequiresRegister());
1232 } else { 1235 } else {
1233 ASSERT(representation() == kTagged); 1236 ASSERT(representation() == kTagged);
1234 locs->set_out(0, Location::RequiresRegister()); 1237 locs->set_out(0, Location::RequiresRegister());
1235 } 1238 }
1236 return locs; 1239 return locs;
1237 } 1240 }
1238 1241
1239 1242
1240 void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1243 void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1241 // The array register points to the backing store for external arrays. 1244 // The array register points to the backing store for external arrays.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1274 case kTypedDataFloat32x4ArrayCid: 1277 case kTypedDataFloat32x4ArrayCid:
1275 ASSERT(element_address.Equals(Address(IP))); 1278 ASSERT(element_address.Equals(Address(IP)));
1276 __ vldmd(IA, IP, dresult0, 2); 1279 __ vldmd(IA, IP, dresult0, 2);
1277 break; 1280 break;
1278 default: 1281 default:
1279 UNREACHABLE(); 1282 UNREACHABLE();
1280 } 1283 }
1281 return; 1284 return;
1282 } 1285 }
1283 1286
1284 if (representation() == kUnboxedMint) { 1287 if (representation() == kUnboxedInt32) {
1285 ASSERT(locs()->out(0).IsPairLocation()); 1288 ASSERT(class_id() == kTypedDataInt32ArrayCid);
1286 PairLocation* result_pair = locs()->out(0).AsPairLocation(); 1289 const Register result = locs()->out(0).reg();
1287 const Register result1 = result_pair->At(0).reg(); 1290 __ ldr(result, element_address);
1288 const Register result2 = result_pair->At(1).reg();
1289 switch (class_id()) {
1290 case kTypedDataInt32ArrayCid:
1291 // Load low word.
1292 __ ldr(result1, element_address);
1293 // Sign extend into high word.
1294 __ SignFill(result2, result1);
1295 break;
1296 case kTypedDataUint32ArrayCid:
1297 // Load low word.
1298 __ ldr(result1, element_address);
1299 // Zero high word.
1300 __ eor(result2, result2, Operand(result2));
1301 break;
1302 default:
1303 UNREACHABLE();
1304 break;
1305 }
1306 return; 1291 return;
1307 } 1292 }
1308 1293
1294 if (representation() == kUnboxedUint32) {
1295 ASSERT(class_id() == kTypedDataUint32ArrayCid);
1296 const Register result = locs()->out(0).reg();
1297 __ ldr(result, element_address);
1298 return;
1299 }
1300
Vyacheslav Egorov (Google) 2014/09/30 16:52:51 Maybe make code look more like on ARM64?
Cutch 2014/09/30 17:16:21 Done.
1309 ASSERT(representation() == kTagged); 1301 ASSERT(representation() == kTagged);
1310 1302
1311 const Register result = locs()->out(0).reg(); 1303 const Register result = locs()->out(0).reg();
1312 switch (class_id()) { 1304 switch (class_id()) {
1313 case kTypedDataInt8ArrayCid: 1305 case kTypedDataInt8ArrayCid:
1314 ASSERT(index_scale() == 1); 1306 ASSERT(index_scale() == 1);
1315 __ ldrsb(result, element_address); 1307 __ ldrsb(result, element_address);
1316 __ SmiTag(result); 1308 __ SmiTag(result);
1317 break; 1309 break;
1318 case kTypedDataUint8ArrayCid: 1310 case kTypedDataUint8ArrayCid:
(...skipping 5700 matching lines...) Expand 10 before | Expand all | Expand 10 after
7019 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); 7011 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
7020 #if defined(DEBUG) 7012 #if defined(DEBUG)
7021 __ LoadImmediate(R4, kInvalidObjectPointer); 7013 __ LoadImmediate(R4, kInvalidObjectPointer);
7022 __ LoadImmediate(R5, kInvalidObjectPointer); 7014 __ LoadImmediate(R5, kInvalidObjectPointer);
7023 #endif 7015 #endif
7024 } 7016 }
7025 7017
7026 } // namespace dart 7018 } // namespace dart
7027 7019
7028 #endif // defined TARGET_ARCH_ARM 7020 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698