| 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_ASSEMBLER_ARM64_H_ | 5 #ifndef V8_ARM64_ASSEMBLER_ARM64_H_ |
| 6 #define V8_ARM64_ASSEMBLER_ARM64_H_ | 6 #define V8_ARM64_ASSEMBLER_ARM64_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <list> | 9 #include <list> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 | 757 |
| 758 | 758 |
| 759 class ConstPool { | 759 class ConstPool { |
| 760 public: | 760 public: |
| 761 explicit ConstPool(Assembler* assm) | 761 explicit ConstPool(Assembler* assm) |
| 762 : assm_(assm), | 762 : assm_(assm), |
| 763 first_use_(-1), | 763 first_use_(-1), |
| 764 shared_entries_count(0) {} | 764 shared_entries_count(0) {} |
| 765 void RecordEntry(intptr_t data, RelocInfo::Mode mode); | 765 void RecordEntry(intptr_t data, RelocInfo::Mode mode); |
| 766 int EntryCount() const { | 766 int EntryCount() const { |
| 767 return shared_entries_count + unique_entries_.size(); | 767 return shared_entries_count + static_cast<int>(unique_entries_.size()); |
| 768 } | 768 } |
| 769 bool IsEmpty() const { | 769 bool IsEmpty() const { |
| 770 return shared_entries_.empty() && unique_entries_.empty(); | 770 return shared_entries_.empty() && unique_entries_.empty(); |
| 771 } | 771 } |
| 772 // Distance in bytes between the current pc and the first instruction | 772 // Distance in bytes between the current pc and the first instruction |
| 773 // using the pool. If there are no pending entries return kMaxInt. | 773 // using the pool. If there are no pending entries return kMaxInt. |
| 774 int DistanceToFirstUse(); | 774 int DistanceToFirstUse(); |
| 775 // Offset after which instructions using the pool will be out of range. | 775 // Offset after which instructions using the pool will be out of range. |
| 776 int MaxPcOffset(); | 776 int MaxPcOffset(); |
| 777 // Maximum size the constant pool can be with current entries. It always | 777 // Maximum size the constant pool can be with current entries. It always |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 944 // quantities, since V8 uses both. | 944 // quantities, since V8 uses both. |
| 945 // TODO(jbramley): Work out what sign to use for these things and if possible, | 945 // TODO(jbramley): Work out what sign to use for these things and if possible, |
| 946 // change things to be consistent. | 946 // change things to be consistent. |
| 947 void AssertSizeOfCodeGeneratedSince(const Label* label, ptrdiff_t size) { | 947 void AssertSizeOfCodeGeneratedSince(const Label* label, ptrdiff_t size) { |
| 948 DCHECK(size >= 0); | 948 DCHECK(size >= 0); |
| 949 DCHECK(static_cast<uint64_t>(size) == SizeOfCodeGeneratedSince(label)); | 949 DCHECK(static_cast<uint64_t>(size) == SizeOfCodeGeneratedSince(label)); |
| 950 } | 950 } |
| 951 | 951 |
| 952 // Return the number of instructions generated from label to the | 952 // Return the number of instructions generated from label to the |
| 953 // current position. | 953 // current position. |
| 954 int InstructionsGeneratedSince(const Label* label) { | 954 uint64_t InstructionsGeneratedSince(const Label* label) { |
| 955 return SizeOfCodeGeneratedSince(label) / kInstructionSize; | 955 return SizeOfCodeGeneratedSince(label) / kInstructionSize; |
| 956 } | 956 } |
| 957 | 957 |
| 958 // Number of instructions generated for the return sequence in | 958 // Number of instructions generated for the return sequence in |
| 959 // FullCodeGenerator::EmitReturnSequence. | 959 // FullCodeGenerator::EmitReturnSequence. |
| 960 static const int kJSReturnSequenceInstructions = 7; | 960 static const int kJSReturnSequenceInstructions = 7; |
| 961 static const int kJSReturnSequenceLength = | 961 static const int kJSReturnSequenceLength = |
| 962 kJSReturnSequenceInstructions * kInstructionSize; | 962 kJSReturnSequenceInstructions * kInstructionSize; |
| 963 // Distance between start of patched return sequence and the emitted address | 963 // Distance between start of patched return sequence and the emitted address |
| 964 // to jump to. | 964 // to jump to. |
| (...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1767 // Required by V8. | 1767 // Required by V8. |
| 1768 void dd(uint32_t data) { dc32(data); } | 1768 void dd(uint32_t data) { dc32(data); } |
| 1769 void db(uint8_t data) { dc8(data); } | 1769 void db(uint8_t data) { dc8(data); } |
| 1770 | 1770 |
| 1771 // Code generation helpers -------------------------------------------------- | 1771 // Code generation helpers -------------------------------------------------- |
| 1772 | 1772 |
| 1773 bool IsConstPoolEmpty() const { return constpool_.IsEmpty(); } | 1773 bool IsConstPoolEmpty() const { return constpool_.IsEmpty(); } |
| 1774 | 1774 |
| 1775 Instruction* pc() const { return Instruction::Cast(pc_); } | 1775 Instruction* pc() const { return Instruction::Cast(pc_); } |
| 1776 | 1776 |
| 1777 Instruction* InstructionAt(int offset) const { | 1777 Instruction* InstructionAt(ptrdiff_t offset) const { |
| 1778 return reinterpret_cast<Instruction*>(buffer_ + offset); | 1778 return reinterpret_cast<Instruction*>(buffer_ + offset); |
| 1779 } | 1779 } |
| 1780 | 1780 |
| 1781 ptrdiff_t InstructionOffset(Instruction* instr) const { | 1781 ptrdiff_t InstructionOffset(Instruction* instr) const { |
| 1782 return reinterpret_cast<byte*>(instr) - buffer_; | 1782 return reinterpret_cast<byte*>(instr) - buffer_; |
| 1783 } | 1783 } |
| 1784 | 1784 |
| 1785 // Register encoding. | 1785 // Register encoding. |
| 1786 static Instr Rd(CPURegister rd) { | 1786 static Instr Rd(CPURegister rd) { |
| 1787 DCHECK(rd.code() != kSPRegInternalCode); | 1787 DCHECK(rd.code() != kSPRegInternalCode); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1834 | 1834 |
| 1835 // Branch encoding. | 1835 // Branch encoding. |
| 1836 inline static Instr ImmUncondBranch(int imm26); | 1836 inline static Instr ImmUncondBranch(int imm26); |
| 1837 inline static Instr ImmCondBranch(int imm19); | 1837 inline static Instr ImmCondBranch(int imm19); |
| 1838 inline static Instr ImmCmpBranch(int imm19); | 1838 inline static Instr ImmCmpBranch(int imm19); |
| 1839 inline static Instr ImmTestBranch(int imm14); | 1839 inline static Instr ImmTestBranch(int imm14); |
| 1840 inline static Instr ImmTestBranchBit(unsigned bit_pos); | 1840 inline static Instr ImmTestBranchBit(unsigned bit_pos); |
| 1841 | 1841 |
| 1842 // Data Processing encoding. | 1842 // Data Processing encoding. |
| 1843 inline static Instr SF(Register rd); | 1843 inline static Instr SF(Register rd); |
| 1844 inline static Instr ImmAddSub(int64_t imm); | 1844 inline static Instr ImmAddSub(int imm); |
| 1845 inline static Instr ImmS(unsigned imms, unsigned reg_size); | 1845 inline static Instr ImmS(unsigned imms, unsigned reg_size); |
| 1846 inline static Instr ImmR(unsigned immr, unsigned reg_size); | 1846 inline static Instr ImmR(unsigned immr, unsigned reg_size); |
| 1847 inline static Instr ImmSetBits(unsigned imms, unsigned reg_size); | 1847 inline static Instr ImmSetBits(unsigned imms, unsigned reg_size); |
| 1848 inline static Instr ImmRotate(unsigned immr, unsigned reg_size); | 1848 inline static Instr ImmRotate(unsigned immr, unsigned reg_size); |
| 1849 inline static Instr ImmLLiteral(int imm19); | 1849 inline static Instr ImmLLiteral(int imm19); |
| 1850 inline static Instr BitN(unsigned bitn, unsigned reg_size); | 1850 inline static Instr BitN(unsigned bitn, unsigned reg_size); |
| 1851 inline static Instr ShiftDP(Shift shift); | 1851 inline static Instr ShiftDP(Shift shift); |
| 1852 inline static Instr ImmDPShift(unsigned amount); | 1852 inline static Instr ImmDPShift(unsigned amount); |
| 1853 inline static Instr ExtendMode(Extend extend); | 1853 inline static Instr ExtendMode(Extend extend); |
| 1854 inline static Instr ImmExtendShift(unsigned left_shift); | 1854 inline static Instr ImmExtendShift(unsigned left_shift); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1869 inline static Instr ImmShiftLS(unsigned shift_amount); | 1869 inline static Instr ImmShiftLS(unsigned shift_amount); |
| 1870 inline static Instr ImmException(int imm16); | 1870 inline static Instr ImmException(int imm16); |
| 1871 inline static Instr ImmSystemRegister(int imm15); | 1871 inline static Instr ImmSystemRegister(int imm15); |
| 1872 inline static Instr ImmHint(int imm7); | 1872 inline static Instr ImmHint(int imm7); |
| 1873 inline static Instr ImmBarrierDomain(int imm2); | 1873 inline static Instr ImmBarrierDomain(int imm2); |
| 1874 inline static Instr ImmBarrierType(int imm2); | 1874 inline static Instr ImmBarrierType(int imm2); |
| 1875 inline static LSDataSize CalcLSDataSize(LoadStoreOp op); | 1875 inline static LSDataSize CalcLSDataSize(LoadStoreOp op); |
| 1876 | 1876 |
| 1877 static bool IsImmLSUnscaled(int64_t offset); | 1877 static bool IsImmLSUnscaled(int64_t offset); |
| 1878 static bool IsImmLSScaled(int64_t offset, LSDataSize size); | 1878 static bool IsImmLSScaled(int64_t offset, LSDataSize size); |
| 1879 static bool IsImmLLiteral(int64_t offset); |
| 1879 | 1880 |
| 1880 // Move immediates encoding. | 1881 // Move immediates encoding. |
| 1881 inline static Instr ImmMoveWide(uint64_t imm); | 1882 inline static Instr ImmMoveWide(int imm); |
| 1882 inline static Instr ShiftMoveWide(int64_t shift); | 1883 inline static Instr ShiftMoveWide(int shift); |
| 1883 | 1884 |
| 1884 // FP Immediates. | 1885 // FP Immediates. |
| 1885 static Instr ImmFP32(float imm); | 1886 static Instr ImmFP32(float imm); |
| 1886 static Instr ImmFP64(double imm); | 1887 static Instr ImmFP64(double imm); |
| 1887 inline static Instr FPScale(unsigned scale); | 1888 inline static Instr FPScale(unsigned scale); |
| 1888 | 1889 |
| 1889 // FP register type. | 1890 // FP register type. |
| 1890 inline static Instr FPType(FPRegister fd); | 1891 inline static Instr FPType(FPRegister fd); |
| 1891 | 1892 |
| 1892 // Class for scoping postponing the constant pool generation. | 1893 // Class for scoping postponing the constant pool generation. |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2319 class EnsureSpace BASE_EMBEDDED { | 2320 class EnsureSpace BASE_EMBEDDED { |
| 2320 public: | 2321 public: |
| 2321 explicit EnsureSpace(Assembler* assembler) { | 2322 explicit EnsureSpace(Assembler* assembler) { |
| 2322 assembler->CheckBufferSpace(); | 2323 assembler->CheckBufferSpace(); |
| 2323 } | 2324 } |
| 2324 }; | 2325 }; |
| 2325 | 2326 |
| 2326 } } // namespace v8::internal | 2327 } } // namespace v8::internal |
| 2327 | 2328 |
| 2328 #endif // V8_ARM64_ASSEMBLER_ARM64_H_ | 2329 #endif // V8_ARM64_ASSEMBLER_ARM64_H_ |
| OLD | NEW |