OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <limits.h> // For LONG_MIN, LONG_MAX. | 5 #include <limits.h> // For LONG_MIN, LONG_MAX. |
6 | 6 |
7 #if V8_TARGET_ARCH_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
8 | 8 |
9 #include "src/base/division-by-constant.h" | 9 #include "src/base/division-by-constant.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 : Assembler(arg_isolate, buffer, size), | 22 : Assembler(arg_isolate, buffer, size), |
23 generating_stub_(false), | 23 generating_stub_(false), |
24 has_frame_(false), | 24 has_frame_(false), |
25 has_double_zero_reg_set_(false) { | 25 has_double_zero_reg_set_(false) { |
26 if (create_code_object == CodeObjectRequired::kYes) { | 26 if (create_code_object == CodeObjectRequired::kYes) { |
27 code_object_ = | 27 code_object_ = |
28 Handle<Object>::New(isolate()->heap()->undefined_value(), isolate()); | 28 Handle<Object>::New(isolate()->heap()->undefined_value(), isolate()); |
29 } | 29 } |
30 } | 30 } |
31 | 31 |
32 | |
33 void MacroAssembler::Load(Register dst, | 32 void MacroAssembler::Load(Register dst, |
34 const MemOperand& src, | 33 const MemOperand& src, |
35 Representation r) { | 34 Representation r) { |
36 DCHECK(!r.IsDouble()); | 35 DCHECK(!r.IsDouble()); |
37 if (r.IsInteger8()) { | 36 if (r.IsInteger8()) { |
38 lb(dst, src); | 37 lb(dst, src); |
39 } else if (r.IsUInteger8()) { | 38 } else if (r.IsUInteger8()) { |
40 lbu(dst, src); | 39 lbu(dst, src); |
41 } else if (r.IsInteger16()) { | 40 } else if (r.IsInteger16()) { |
42 lh(dst, src); | 41 lh(dst, src); |
(...skipping 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1317 Register tmp = rd.is(rt) ? scratch : rd; | 1316 Register tmp = rd.is(rt) ? scratch : rd; |
1318 DCHECK(!tmp.is(rt)); | 1317 DCHECK(!tmp.is(rt)); |
1319 dsll(tmp, rs, sa); | 1318 dsll(tmp, rs, sa); |
1320 Daddu(rd, rt, tmp); | 1319 Daddu(rd, rt, tmp); |
1321 } | 1320 } |
1322 } | 1321 } |
1323 | 1322 |
1324 | 1323 |
1325 // ------------Pseudo-instructions------------- | 1324 // ------------Pseudo-instructions------------- |
1326 | 1325 |
| 1326 // Change endianness |
| 1327 void MacroAssembler::ByteSwapSigned(Register reg, int operand_size) { |
| 1328 DCHECK(operand_size == 1 || operand_size == 2 || operand_size == 4 || |
| 1329 operand_size == 8); |
| 1330 DCHECK(kArchVariant == kMips64r6 || kArchVariant == kMips64r2); |
| 1331 if (operand_size == 1) { |
| 1332 seb(reg, reg); |
| 1333 sll(reg, reg, 0); |
| 1334 dsbh(reg, reg); |
| 1335 dshd(reg, reg); |
| 1336 } else if (operand_size == 2) { |
| 1337 seh(reg, reg); |
| 1338 sll(reg, reg, 0); |
| 1339 dsbh(reg, reg); |
| 1340 dshd(reg, reg); |
| 1341 } else if (operand_size == 4) { |
| 1342 sll(reg, reg, 0); |
| 1343 dsbh(reg, reg); |
| 1344 dshd(reg, reg); |
| 1345 } else { |
| 1346 dsbh(reg, reg); |
| 1347 dshd(reg, reg); |
| 1348 } |
| 1349 } |
| 1350 |
| 1351 void MacroAssembler::ByteSwapUnsigned(Register reg, int operand_size) { |
| 1352 DCHECK(operand_size == 1 || operand_size == 2 || operand_size == 4); |
| 1353 if (operand_size == 1) { |
| 1354 andi(reg, reg, 0xFF); |
| 1355 dsbh(reg, reg); |
| 1356 dshd(reg, reg); |
| 1357 } else if (operand_size == 2) { |
| 1358 andi(reg, reg, 0xFFFF); |
| 1359 dsbh(reg, reg); |
| 1360 dshd(reg, reg); |
| 1361 } else { |
| 1362 dsll32(reg, reg, 0); |
| 1363 dsrl32(reg, reg, 0); |
| 1364 dsbh(reg, reg); |
| 1365 dshd(reg, reg); |
| 1366 } |
| 1367 } |
| 1368 |
1327 void MacroAssembler::Ulw(Register rd, const MemOperand& rs) { | 1369 void MacroAssembler::Ulw(Register rd, const MemOperand& rs) { |
1328 DCHECK(!rd.is(at)); | 1370 DCHECK(!rd.is(at)); |
1329 DCHECK(!rs.rm().is(at)); | 1371 DCHECK(!rs.rm().is(at)); |
1330 if (kArchVariant == kMips64r6) { | 1372 if (kArchVariant == kMips64r6) { |
1331 lw(rd, rs); | 1373 lw(rd, rs); |
1332 } else { | 1374 } else { |
1333 DCHECK(kArchVariant == kMips64r2); | 1375 DCHECK(kArchVariant == kMips64r2); |
1334 if (is_int16(rs.offset() + kMipsLwrOffset) && | 1376 if (is_int16(rs.offset() + kMipsLwrOffset) && |
1335 is_int16(rs.offset() + kMipsLwlOffset)) { | 1377 is_int16(rs.offset() + kMipsLwlOffset)) { |
1336 if (!rd.is(rs.rm())) { | 1378 if (!rd.is(rs.rm())) { |
(...skipping 5806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7143 if (mag.shift > 0) sra(result, result, mag.shift); | 7185 if (mag.shift > 0) sra(result, result, mag.shift); |
7144 srl(at, dividend, 31); | 7186 srl(at, dividend, 31); |
7145 Addu(result, result, Operand(at)); | 7187 Addu(result, result, Operand(at)); |
7146 } | 7188 } |
7147 | 7189 |
7148 | 7190 |
7149 } // namespace internal | 7191 } // namespace internal |
7150 } // namespace v8 | 7192 } // namespace v8 |
7151 | 7193 |
7152 #endif // V8_TARGET_ARCH_MIPS64 | 7194 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |