OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef V8_ARM64_MACRO_ASSEMBLER_ARM64_INL_H_ | 5 #ifndef V8_ARM64_MACRO_ASSEMBLER_ARM64_INL_H_ |
6 #define V8_ARM64_MACRO_ASSEMBLER_ARM64_INL_H_ | 6 #define V8_ARM64_MACRO_ASSEMBLER_ARM64_INL_H_ |
7 | 7 |
8 #include <ctype.h> | 8 #include <ctype.h> |
9 | 9 |
10 #include "src/globals.h" | 10 #include "src/globals.h" |
(...skipping 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1455 | 1455 |
1456 | 1456 |
1457 void MacroAssembler::Push(Handle<Object> handle) { | 1457 void MacroAssembler::Push(Handle<Object> handle) { |
1458 UseScratchRegisterScope temps(this); | 1458 UseScratchRegisterScope temps(this); |
1459 Register tmp = temps.AcquireX(); | 1459 Register tmp = temps.AcquireX(); |
1460 Mov(tmp, Operand(handle)); | 1460 Mov(tmp, Operand(handle)); |
1461 Push(tmp); | 1461 Push(tmp); |
1462 } | 1462 } |
1463 | 1463 |
1464 | 1464 |
1465 void MacroAssembler::Claim(uint64_t count, uint64_t unit_size) { | 1465 void MacroAssembler::Claim(int64_t count, uint64_t unit_size) { |
| 1466 DCHECK(count >= 0); |
1466 uint64_t size = count * unit_size; | 1467 uint64_t size = count * unit_size; |
1467 | 1468 |
1468 if (size == 0) { | 1469 if (size == 0) { |
1469 return; | 1470 return; |
1470 } | 1471 } |
1471 | 1472 |
1472 if (csp.Is(StackPointer())) { | 1473 if (csp.Is(StackPointer())) { |
1473 DCHECK(size % 16 == 0); | 1474 DCHECK(size % 16 == 0); |
1474 } else { | 1475 } else { |
1475 BumpSystemStackPointer(size); | 1476 BumpSystemStackPointer(size); |
1476 } | 1477 } |
1477 | 1478 |
1478 Sub(StackPointer(), StackPointer(), size); | 1479 Sub(StackPointer(), StackPointer(), size); |
1479 } | 1480 } |
1480 | 1481 |
1481 | 1482 |
1482 void MacroAssembler::Claim(const Register& count, uint64_t unit_size) { | 1483 void MacroAssembler::Claim(const Register& count, uint64_t unit_size) { |
1483 if (unit_size == 0) return; | 1484 if (unit_size == 0) return; |
1484 DCHECK(base::bits::IsPowerOfTwo64(unit_size)); | 1485 DCHECK(base::bits::IsPowerOfTwo64(unit_size)); |
1485 | 1486 |
1486 const int shift = CountTrailingZeros(unit_size, kXRegSizeInBits); | 1487 const int shift = CountTrailingZeros(unit_size, kXRegSizeInBits); |
1487 const Operand size(count, LSL, shift); | 1488 const Operand size(count, LSL, shift); |
1488 | 1489 |
1489 if (size.IsZero()) { | 1490 if (size.IsZero()) { |
1490 return; | 1491 return; |
1491 } | 1492 } |
1492 | 1493 |
| 1494 AssertPositiveOrZero(count); |
1493 if (!csp.Is(StackPointer())) { | 1495 if (!csp.Is(StackPointer())) { |
1494 BumpSystemStackPointer(size); | 1496 BumpSystemStackPointer(size); |
1495 } | 1497 } |
1496 | 1498 |
1497 Sub(StackPointer(), StackPointer(), size); | 1499 Sub(StackPointer(), StackPointer(), size); |
1498 } | 1500 } |
1499 | 1501 |
1500 | 1502 |
1501 void MacroAssembler::ClaimBySMI(const Register& count_smi, uint64_t unit_size) { | 1503 void MacroAssembler::ClaimBySMI(const Register& count_smi, uint64_t unit_size) { |
1502 DCHECK(unit_size == 0 || base::bits::IsPowerOfTwo64(unit_size)); | 1504 DCHECK(unit_size == 0 || base::bits::IsPowerOfTwo64(unit_size)); |
1503 const int shift = CountTrailingZeros(unit_size, kXRegSizeInBits) - kSmiShift; | 1505 const int shift = CountTrailingZeros(unit_size, kXRegSizeInBits) - kSmiShift; |
1504 const Operand size(count_smi, | 1506 const Operand size(count_smi, |
1505 (shift >= 0) ? (LSL) : (LSR), | 1507 (shift >= 0) ? (LSL) : (LSR), |
1506 (shift >= 0) ? (shift) : (-shift)); | 1508 (shift >= 0) ? (shift) : (-shift)); |
1507 | 1509 |
1508 if (size.IsZero()) { | 1510 if (size.IsZero()) { |
1509 return; | 1511 return; |
1510 } | 1512 } |
1511 | 1513 |
1512 if (!csp.Is(StackPointer())) { | 1514 if (!csp.Is(StackPointer())) { |
1513 BumpSystemStackPointer(size); | 1515 BumpSystemStackPointer(size); |
1514 } | 1516 } |
1515 | 1517 |
1516 Sub(StackPointer(), StackPointer(), size); | 1518 Sub(StackPointer(), StackPointer(), size); |
1517 } | 1519 } |
1518 | 1520 |
1519 | 1521 |
1520 void MacroAssembler::Drop(uint64_t count, uint64_t unit_size) { | 1522 void MacroAssembler::Drop(int64_t count, uint64_t unit_size) { |
| 1523 DCHECK(count >= 0); |
1521 uint64_t size = count * unit_size; | 1524 uint64_t size = count * unit_size; |
1522 | 1525 |
1523 if (size == 0) { | 1526 if (size == 0) { |
1524 return; | 1527 return; |
1525 } | 1528 } |
1526 | 1529 |
1527 Add(StackPointer(), StackPointer(), size); | 1530 Add(StackPointer(), StackPointer(), size); |
1528 | 1531 |
1529 if (csp.Is(StackPointer())) { | 1532 if (csp.Is(StackPointer())) { |
1530 DCHECK(size % 16 == 0); | 1533 DCHECK(size % 16 == 0); |
(...skipping 10 matching lines...) Expand all Loading... |
1541 if (unit_size == 0) return; | 1544 if (unit_size == 0) return; |
1542 DCHECK(base::bits::IsPowerOfTwo64(unit_size)); | 1545 DCHECK(base::bits::IsPowerOfTwo64(unit_size)); |
1543 | 1546 |
1544 const int shift = CountTrailingZeros(unit_size, kXRegSizeInBits); | 1547 const int shift = CountTrailingZeros(unit_size, kXRegSizeInBits); |
1545 const Operand size(count, LSL, shift); | 1548 const Operand size(count, LSL, shift); |
1546 | 1549 |
1547 if (size.IsZero()) { | 1550 if (size.IsZero()) { |
1548 return; | 1551 return; |
1549 } | 1552 } |
1550 | 1553 |
| 1554 AssertPositiveOrZero(count); |
1551 Add(StackPointer(), StackPointer(), size); | 1555 Add(StackPointer(), StackPointer(), size); |
1552 | 1556 |
1553 if (!csp.Is(StackPointer()) && emit_debug_code()) { | 1557 if (!csp.Is(StackPointer()) && emit_debug_code()) { |
1554 // It is safe to leave csp where it is when unwinding the JavaScript stack, | 1558 // It is safe to leave csp where it is when unwinding the JavaScript stack, |
1555 // but if we keep it matching StackPointer, the simulator can detect memory | 1559 // but if we keep it matching StackPointer, the simulator can detect memory |
1556 // accesses in the now-free part of the stack. | 1560 // accesses in the now-free part of the stack. |
1557 SyncSystemStackPointer(); | 1561 SyncSystemStackPointer(); |
1558 } | 1562 } |
1559 } | 1563 } |
1560 | 1564 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1654 DCHECK(isprint(marker_name[0]) && isprint(marker_name[1])); | 1658 DCHECK(isprint(marker_name[0]) && isprint(marker_name[1])); |
1655 | 1659 |
1656 InstructionAccurateScope scope(this, 1); | 1660 InstructionAccurateScope scope(this, 1); |
1657 movn(xzr, (marker_name[1] << 8) | marker_name[0]); | 1661 movn(xzr, (marker_name[1] << 8) | marker_name[0]); |
1658 } | 1662 } |
1659 | 1663 |
1660 } // namespace internal | 1664 } // namespace internal |
1661 } // namespace v8 | 1665 } // namespace v8 |
1662 | 1666 |
1663 #endif // V8_ARM64_MACRO_ASSEMBLER_ARM64_INL_H_ | 1667 #endif // V8_ARM64_MACRO_ASSEMBLER_ARM64_INL_H_ |
OLD | NEW |