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" |
11 | 11 |
12 #include "src/arm64/assembler-arm64-inl.h" | 12 #include "src/arm64/assembler-arm64-inl.h" |
13 #include "src/arm64/assembler-arm64.h" | 13 #include "src/arm64/assembler-arm64.h" |
14 #include "src/arm64/instrument-arm64.h" | 14 #include "src/arm64/instrument-arm64.h" |
15 #include "src/arm64/macro-assembler-arm64.h" | 15 #include "src/arm64/macro-assembler-arm64.h" |
| 16 #include "src/base/bits.h" |
16 | 17 |
17 | 18 |
18 namespace v8 { | 19 namespace v8 { |
19 namespace internal { | 20 namespace internal { |
20 | 21 |
21 | 22 |
22 MemOperand FieldMemOperand(Register object, int offset) { | 23 MemOperand FieldMemOperand(Register object, int offset) { |
23 return MemOperand(object, offset - kHeapObjectTag); | 24 return MemOperand(object, offset - kHeapObjectTag); |
24 } | 25 } |
25 | 26 |
(...skipping 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1513 } else { | 1514 } else { |
1514 BumpSystemStackPointer(size); | 1515 BumpSystemStackPointer(size); |
1515 } | 1516 } |
1516 | 1517 |
1517 Sub(StackPointer(), StackPointer(), size); | 1518 Sub(StackPointer(), StackPointer(), size); |
1518 } | 1519 } |
1519 | 1520 |
1520 | 1521 |
1521 void MacroAssembler::Claim(const Register& count, uint64_t unit_size) { | 1522 void MacroAssembler::Claim(const Register& count, uint64_t unit_size) { |
1522 if (unit_size == 0) return; | 1523 if (unit_size == 0) return; |
1523 DCHECK(IsPowerOf2(unit_size)); | 1524 DCHECK(base::bits::IsPowerOfTwo64(unit_size)); |
1524 | 1525 |
1525 const int shift = CountTrailingZeros(unit_size, kXRegSizeInBits); | 1526 const int shift = CountTrailingZeros(unit_size, kXRegSizeInBits); |
1526 const Operand size(count, LSL, shift); | 1527 const Operand size(count, LSL, shift); |
1527 | 1528 |
1528 if (size.IsZero()) { | 1529 if (size.IsZero()) { |
1529 return; | 1530 return; |
1530 } | 1531 } |
1531 | 1532 |
1532 if (!csp.Is(StackPointer())) { | 1533 if (!csp.Is(StackPointer())) { |
1533 BumpSystemStackPointer(size); | 1534 BumpSystemStackPointer(size); |
1534 } | 1535 } |
1535 | 1536 |
1536 Sub(StackPointer(), StackPointer(), size); | 1537 Sub(StackPointer(), StackPointer(), size); |
1537 } | 1538 } |
1538 | 1539 |
1539 | 1540 |
1540 void MacroAssembler::ClaimBySMI(const Register& count_smi, uint64_t unit_size) { | 1541 void MacroAssembler::ClaimBySMI(const Register& count_smi, uint64_t unit_size) { |
1541 DCHECK(unit_size == 0 || IsPowerOf2(unit_size)); | 1542 DCHECK(unit_size == 0 || base::bits::IsPowerOfTwo64(unit_size)); |
1542 const int shift = CountTrailingZeros(unit_size, kXRegSizeInBits) - kSmiShift; | 1543 const int shift = CountTrailingZeros(unit_size, kXRegSizeInBits) - kSmiShift; |
1543 const Operand size(count_smi, | 1544 const Operand size(count_smi, |
1544 (shift >= 0) ? (LSL) : (LSR), | 1545 (shift >= 0) ? (LSL) : (LSR), |
1545 (shift >= 0) ? (shift) : (-shift)); | 1546 (shift >= 0) ? (shift) : (-shift)); |
1546 | 1547 |
1547 if (size.IsZero()) { | 1548 if (size.IsZero()) { |
1548 return; | 1549 return; |
1549 } | 1550 } |
1550 | 1551 |
1551 if (!csp.Is(StackPointer())) { | 1552 if (!csp.Is(StackPointer())) { |
(...skipping 19 matching lines...) Expand all Loading... |
1571 // It is safe to leave csp where it is when unwinding the JavaScript stack, | 1572 // It is safe to leave csp where it is when unwinding the JavaScript stack, |
1572 // but if we keep it matching StackPointer, the simulator can detect memory | 1573 // but if we keep it matching StackPointer, the simulator can detect memory |
1573 // accesses in the now-free part of the stack. | 1574 // accesses in the now-free part of the stack. |
1574 SyncSystemStackPointer(); | 1575 SyncSystemStackPointer(); |
1575 } | 1576 } |
1576 } | 1577 } |
1577 | 1578 |
1578 | 1579 |
1579 void MacroAssembler::Drop(const Register& count, uint64_t unit_size) { | 1580 void MacroAssembler::Drop(const Register& count, uint64_t unit_size) { |
1580 if (unit_size == 0) return; | 1581 if (unit_size == 0) return; |
1581 DCHECK(IsPowerOf2(unit_size)); | 1582 DCHECK(base::bits::IsPowerOfTwo64(unit_size)); |
1582 | 1583 |
1583 const int shift = CountTrailingZeros(unit_size, kXRegSizeInBits); | 1584 const int shift = CountTrailingZeros(unit_size, kXRegSizeInBits); |
1584 const Operand size(count, LSL, shift); | 1585 const Operand size(count, LSL, shift); |
1585 | 1586 |
1586 if (size.IsZero()) { | 1587 if (size.IsZero()) { |
1587 return; | 1588 return; |
1588 } | 1589 } |
1589 | 1590 |
1590 Add(StackPointer(), StackPointer(), size); | 1591 Add(StackPointer(), StackPointer(), size); |
1591 | 1592 |
1592 if (!csp.Is(StackPointer()) && emit_debug_code()) { | 1593 if (!csp.Is(StackPointer()) && emit_debug_code()) { |
1593 // It is safe to leave csp where it is when unwinding the JavaScript stack, | 1594 // It is safe to leave csp where it is when unwinding the JavaScript stack, |
1594 // but if we keep it matching StackPointer, the simulator can detect memory | 1595 // but if we keep it matching StackPointer, the simulator can detect memory |
1595 // accesses in the now-free part of the stack. | 1596 // accesses in the now-free part of the stack. |
1596 SyncSystemStackPointer(); | 1597 SyncSystemStackPointer(); |
1597 } | 1598 } |
1598 } | 1599 } |
1599 | 1600 |
1600 | 1601 |
1601 void MacroAssembler::DropBySMI(const Register& count_smi, uint64_t unit_size) { | 1602 void MacroAssembler::DropBySMI(const Register& count_smi, uint64_t unit_size) { |
1602 DCHECK(unit_size == 0 || IsPowerOf2(unit_size)); | 1603 DCHECK(unit_size == 0 || base::bits::IsPowerOfTwo64(unit_size)); |
1603 const int shift = CountTrailingZeros(unit_size, kXRegSizeInBits) - kSmiShift; | 1604 const int shift = CountTrailingZeros(unit_size, kXRegSizeInBits) - kSmiShift; |
1604 const Operand size(count_smi, | 1605 const Operand size(count_smi, |
1605 (shift >= 0) ? (LSL) : (LSR), | 1606 (shift >= 0) ? (LSL) : (LSR), |
1606 (shift >= 0) ? (shift) : (-shift)); | 1607 (shift >= 0) ? (shift) : (-shift)); |
1607 | 1608 |
1608 if (size.IsZero()) { | 1609 if (size.IsZero()) { |
1609 return; | 1610 return; |
1610 } | 1611 } |
1611 | 1612 |
1612 Add(StackPointer(), StackPointer(), size); | 1613 Add(StackPointer(), StackPointer(), size); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1692 // characters are reserved for controlling features of the instrumentation. | 1693 // characters are reserved for controlling features of the instrumentation. |
1693 DCHECK(isprint(marker_name[0]) && isprint(marker_name[1])); | 1694 DCHECK(isprint(marker_name[0]) && isprint(marker_name[1])); |
1694 | 1695 |
1695 InstructionAccurateScope scope(this, 1); | 1696 InstructionAccurateScope scope(this, 1); |
1696 movn(xzr, (marker_name[1] << 8) | marker_name[0]); | 1697 movn(xzr, (marker_name[1] << 8) | marker_name[0]); |
1697 } | 1698 } |
1698 | 1699 |
1699 } } // namespace v8::internal | 1700 } } // namespace v8::internal |
1700 | 1701 |
1701 #endif // V8_ARM64_MACRO_ASSEMBLER_ARM64_INL_H_ | 1702 #endif // V8_ARM64_MACRO_ASSEMBLER_ARM64_INL_H_ |
OLD | NEW |