OLD | NEW |
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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
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 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1077 case kExternalTypedDataUint8ArrayCid: | 1077 case kExternalTypedDataUint8ArrayCid: |
1078 case kExternalTypedDataUint8ClampedArrayCid: | 1078 case kExternalTypedDataUint8ClampedArrayCid: |
1079 case kTypedDataInt16ArrayCid: | 1079 case kTypedDataInt16ArrayCid: |
1080 case kTypedDataUint16ArrayCid: | 1080 case kTypedDataUint16ArrayCid: |
1081 case kOneByteStringCid: | 1081 case kOneByteStringCid: |
1082 case kTwoByteStringCid: | 1082 case kTwoByteStringCid: |
1083 return CompileType::FromCid(kSmiCid); | 1083 return CompileType::FromCid(kSmiCid); |
1084 | 1084 |
1085 case kTypedDataInt32ArrayCid: | 1085 case kTypedDataInt32ArrayCid: |
1086 case kTypedDataUint32ArrayCid: | 1086 case kTypedDataUint32ArrayCid: |
1087 return Typed32BitIsSmi() ? CompileType::FromCid(kSmiCid) | 1087 return CompileType::Int(); |
1088 : CompileType::FromCid(kMintCid); | |
1089 | 1088 |
1090 default: | 1089 default: |
1091 UNIMPLEMENTED(); | 1090 UNIMPLEMENTED(); |
1092 return CompileType::Dynamic(); | 1091 return CompileType::Dynamic(); |
1093 } | 1092 } |
1094 } | 1093 } |
1095 | 1094 |
1096 | 1095 |
1097 Representation LoadIndexedInstr::representation() const { | 1096 Representation LoadIndexedInstr::representation() const { |
1098 switch (class_id_) { | 1097 switch (class_id_) { |
1099 case kArrayCid: | 1098 case kArrayCid: |
1100 case kImmutableArrayCid: | 1099 case kImmutableArrayCid: |
1101 case kTypedDataInt8ArrayCid: | 1100 case kTypedDataInt8ArrayCid: |
1102 case kTypedDataUint8ArrayCid: | 1101 case kTypedDataUint8ArrayCid: |
1103 case kTypedDataUint8ClampedArrayCid: | 1102 case kTypedDataUint8ClampedArrayCid: |
1104 case kExternalTypedDataUint8ArrayCid: | 1103 case kExternalTypedDataUint8ArrayCid: |
1105 case kExternalTypedDataUint8ClampedArrayCid: | 1104 case kExternalTypedDataUint8ClampedArrayCid: |
1106 case kTypedDataInt16ArrayCid: | 1105 case kTypedDataInt16ArrayCid: |
1107 case kTypedDataUint16ArrayCid: | 1106 case kTypedDataUint16ArrayCid: |
1108 case kOneByteStringCid: | 1107 case kOneByteStringCid: |
1109 case kTwoByteStringCid: | 1108 case kTwoByteStringCid: |
1110 return kTagged; | 1109 return kTagged; |
1111 case kTypedDataInt32ArrayCid: | 1110 case kTypedDataInt32ArrayCid: |
| 1111 return kUnboxedInt32; |
1112 case kTypedDataUint32ArrayCid: | 1112 case kTypedDataUint32ArrayCid: |
1113 return Typed32BitIsSmi() ? kTagged : kUnboxedMint; | 1113 return kUnboxedUint32; |
1114 case kTypedDataFloat32ArrayCid: | 1114 case kTypedDataFloat32ArrayCid: |
1115 case kTypedDataFloat64ArrayCid: | 1115 case kTypedDataFloat64ArrayCid: |
1116 return kUnboxedDouble; | 1116 return kUnboxedDouble; |
1117 case kTypedDataInt32x4ArrayCid: | 1117 case kTypedDataInt32x4ArrayCid: |
1118 return kUnboxedInt32x4; | 1118 return kUnboxedInt32x4; |
1119 case kTypedDataFloat32x4ArrayCid: | 1119 case kTypedDataFloat32x4ArrayCid: |
1120 return kUnboxedFloat32x4; | 1120 return kUnboxedFloat32x4; |
1121 default: | 1121 default: |
1122 UNIMPLEMENTED(); | 1122 UNIMPLEMENTED(); |
1123 return kTagged; | 1123 return kTagged; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1173 Address element_address = index.IsRegister() | 1173 Address element_address = index.IsRegister() |
1174 ? __ ElementAddressForRegIndex(true, // Load. | 1174 ? __ ElementAddressForRegIndex(true, // Load. |
1175 IsExternal(), class_id(), index_scale(), | 1175 IsExternal(), class_id(), index_scale(), |
1176 array, index.reg()) | 1176 array, index.reg()) |
1177 : __ ElementAddressForIntIndex( | 1177 : __ ElementAddressForIntIndex( |
1178 IsExternal(), class_id(), index_scale(), | 1178 IsExternal(), class_id(), index_scale(), |
1179 array, Smi::Cast(index.constant()).Value()); | 1179 array, Smi::Cast(index.constant()).Value()); |
1180 // Warning: element_address may use register TMP as base. | 1180 // Warning: element_address may use register TMP as base. |
1181 | 1181 |
1182 if ((representation() == kUnboxedDouble) || | 1182 if ((representation() == kUnboxedDouble) || |
1183 (representation() == kUnboxedMint) || | |
1184 (representation() == kUnboxedFloat32x4) || | 1183 (representation() == kUnboxedFloat32x4) || |
1185 (representation() == kUnboxedInt32x4)) { | 1184 (representation() == kUnboxedInt32x4)) { |
1186 DRegister result = locs()->out(0).fpu_reg(); | 1185 DRegister result = locs()->out(0).fpu_reg(); |
1187 switch (class_id()) { | 1186 switch (class_id()) { |
1188 case kTypedDataInt32ArrayCid: | |
1189 UNIMPLEMENTED(); | |
1190 break; | |
1191 case kTypedDataUint32ArrayCid: | |
1192 UNIMPLEMENTED(); | |
1193 break; | |
1194 case kTypedDataFloat32ArrayCid: | 1187 case kTypedDataFloat32ArrayCid: |
1195 // Load single precision float. | 1188 // Load single precision float. |
1196 __ lwc1(EvenFRegisterOf(result), element_address); | 1189 __ lwc1(EvenFRegisterOf(result), element_address); |
1197 break; | 1190 break; |
1198 case kTypedDataFloat64ArrayCid: | 1191 case kTypedDataFloat64ArrayCid: |
1199 __ LoadDFromOffset(result, | 1192 __ LoadDFromOffset(result, |
1200 element_address.base(), element_address.offset()); | 1193 element_address.base(), element_address.offset()); |
1201 break; | 1194 break; |
1202 case kTypedDataInt32x4ArrayCid: | 1195 case kTypedDataInt32x4ArrayCid: |
1203 case kTypedDataFloat32x4ArrayCid: | 1196 case kTypedDataFloat32x4ArrayCid: |
1204 UNIMPLEMENTED(); | 1197 UNIMPLEMENTED(); |
1205 break; | 1198 break; |
1206 } | 1199 } |
1207 return; | 1200 return; |
1208 } | 1201 } |
1209 | 1202 |
| 1203 if ((representation() == kUnboxedUint32) || |
| 1204 (representation() == kUnboxedInt32)) { |
| 1205 const Register result = locs()->out(0).reg(); |
| 1206 switch (class_id()) { |
| 1207 case kTypedDataInt32ArrayCid: |
| 1208 ASSERT(representation() == kUnboxedUint32); |
| 1209 __ lw(result, element_address); |
| 1210 break; |
| 1211 case kTypedDataUint32ArrayCid: |
| 1212 ASSERT(representation() == kUnboxedInt32); |
| 1213 __ lw(result, element_address); |
| 1214 break; |
| 1215 default: |
| 1216 UNREACHABLE(); |
| 1217 } |
| 1218 return; |
| 1219 } |
| 1220 |
| 1221 ASSERT(representation() == kTagged); |
| 1222 |
1210 const Register result = locs()->out(0).reg(); | 1223 const Register result = locs()->out(0).reg(); |
1211 switch (class_id()) { | 1224 switch (class_id()) { |
1212 case kTypedDataInt8ArrayCid: | 1225 case kTypedDataInt8ArrayCid: |
1213 ASSERT(index_scale() == 1); | 1226 ASSERT(index_scale() == 1); |
1214 __ lb(result, element_address); | 1227 __ lb(result, element_address); |
1215 __ SmiTag(result); | 1228 __ SmiTag(result); |
1216 break; | 1229 break; |
1217 case kTypedDataUint8ArrayCid: | 1230 case kTypedDataUint8ArrayCid: |
1218 case kTypedDataUint8ClampedArrayCid: | 1231 case kTypedDataUint8ClampedArrayCid: |
1219 case kExternalTypedDataUint8ArrayCid: | 1232 case kExternalTypedDataUint8ArrayCid: |
1220 case kExternalTypedDataUint8ClampedArrayCid: | 1233 case kExternalTypedDataUint8ClampedArrayCid: |
1221 case kOneByteStringCid: | 1234 case kOneByteStringCid: |
1222 ASSERT(index_scale() == 1); | 1235 ASSERT(index_scale() == 1); |
1223 __ lbu(result, element_address); | 1236 __ lbu(result, element_address); |
1224 __ SmiTag(result); | 1237 __ SmiTag(result); |
1225 break; | 1238 break; |
1226 case kTypedDataInt16ArrayCid: | 1239 case kTypedDataInt16ArrayCid: |
1227 __ lh(result, element_address); | 1240 __ lh(result, element_address); |
1228 __ SmiTag(result); | 1241 __ SmiTag(result); |
1229 break; | 1242 break; |
1230 case kTypedDataUint16ArrayCid: | 1243 case kTypedDataUint16ArrayCid: |
1231 case kTwoByteStringCid: | 1244 case kTwoByteStringCid: |
1232 __ lhu(result, element_address); | 1245 __ lhu(result, element_address); |
1233 __ SmiTag(result); | 1246 __ SmiTag(result); |
1234 break; | 1247 break; |
1235 case kTypedDataInt32ArrayCid: { | |
1236 Label* deopt = compiler->AddDeoptStub(deopt_id(), | |
1237 ICData::kDeoptInt32Load); | |
1238 __ lw(result, element_address); | |
1239 // Verify that the signed value in 'result' can fit inside a Smi. | |
1240 __ BranchSignedLess(result, 0xC0000000, deopt); | |
1241 __ SmiTag(result); | |
1242 } | |
1243 break; | |
1244 case kTypedDataUint32ArrayCid: { | |
1245 Label* deopt = compiler->AddDeoptStub(deopt_id(), | |
1246 ICData::kDeoptUint32Load); | |
1247 __ lw(result, element_address); | |
1248 // Verify that the unsigned value in 'result' can fit inside a Smi. | |
1249 __ LoadImmediate(TMP, 0xC0000000); | |
1250 __ and_(CMPRES1, result, TMP); | |
1251 __ bne(CMPRES1, ZR, deopt); | |
1252 __ SmiTag(result); | |
1253 } | |
1254 break; | |
1255 default: | 1248 default: |
1256 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid)); | 1249 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid)); |
1257 __ lw(result, element_address); | 1250 __ lw(result, element_address); |
1258 break; | 1251 break; |
1259 } | 1252 } |
1260 } | 1253 } |
1261 | 1254 |
1262 | 1255 |
1263 Representation StoreIndexedInstr::RequiredInputRepresentation( | 1256 Representation StoreIndexedInstr::RequiredInputRepresentation( |
1264 intptr_t idx) const { | 1257 intptr_t idx) const { |
(...skipping 3666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4931 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); | 4924 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); |
4932 #if defined(DEBUG) | 4925 #if defined(DEBUG) |
4933 __ LoadImmediate(S4, kInvalidObjectPointer); | 4926 __ LoadImmediate(S4, kInvalidObjectPointer); |
4934 __ LoadImmediate(S5, kInvalidObjectPointer); | 4927 __ LoadImmediate(S5, kInvalidObjectPointer); |
4935 #endif | 4928 #endif |
4936 } | 4929 } |
4937 | 4930 |
4938 } // namespace dart | 4931 } // namespace dart |
4939 | 4932 |
4940 #endif // defined TARGET_ARCH_MIPS | 4933 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |