5#ifndef V8_CODEGEN_ARM64_ASSEMBLER_ARM64_INL_H_
6#define V8_CODEGEN_ARM64_ASSEMBLER_ARM64_INL_H_
31 intptr_t internal_ref = ReadUnalignedValue<intptr_t>(
pc_);
32 internal_ref += delta;
35 Instruction*
instr =
reinterpret_cast<Instruction*
>(
pc_);
36 if (
instr->IsBranchAndLink() ||
instr->IsUnconditionalBranch()) {
67 if (other.type() ==
type_) {
68 list_ &= ~other.list_;
203 static_assert(
sizeof(
T) <= 8);
204 static_assert(std::is_integral<T>::value || std::is_enum<T>::value);
215 return static_cast<int64_t
>(t.ptr());
225 return static_cast<int64_t
>(t.raw());
231 :
value_(static_cast<intptr_t>(
handle.address())), rmode_(mode) {
243 static_assert(std::is_integral<T>::value);
258 shift_amount_(shift_amount) {
269 shift_amount_(shift_amount) {
369MemOperand::MemOperand()
390 unsigned shift_amount)
392 regoffset_(regoffset),
397 shift_amount_(shift_amount) {
407 unsigned shift_amount)
409 regoffset_(regoffset),
414 shift_amount_(shift_amount) {
424 if (
offset.IsImmediate()) {
426 }
else if (
offset.IsShiftedRegister()) {
457bool MemOperand::IsImmediateOffset()
const {
461bool MemOperand::IsRegisterOffset()
const {
474 return reinterpret_cast<Address>(
instr->ImmPCOffsetTarget());
480 if (
instr->IsLdrLiteralX()) {
484 return reinterpret_cast<Address>(
instr->ImmPCOffsetTarget());
497 if (
instr->IsLdrLiteralX()) {
511 if (
instr->IsLdrLiteralX()) {
523 if (
instr->IsLdrLiteralX()) {
529 static_cast<uint32_t
>(data));
544 return static_cast<Builtin>(builtin_id);
549 if (
instr->IsBranchAndLink() ||
instr->IsUnconditionalBranch()) {
565 WritableJitAllocation* jit_allocation,
567 Instruction*
instr =
reinterpret_cast<Instruction*
>(
pc);
568 if (
instr->IsLdrLiteralX()) {
569 if (jit_allocation) {
588 reinterpret_cast<Instruction*
>(
target), jit_allocation);
600 if (jit_allocation) {
611 Instruction*
instr =
reinterpret_cast<Instruction*
>(
pc_);
625 Instruction*
instr =
reinterpret_cast<Instruction*
>(
pc_);
639 if (
instr->IsLdrLiteralX()) {
669 return origin->target_object_handle_at(
pc_);
672 return origin->code_target_object_handle_at(
pc_);
724 return ReadUnalignedValue<Address>(
pc_);
748 Instruction*
instr =
reinterpret_cast<Instruction*
>(
pc);
754 uint32_t new_constant,
755 WritableJitAllocation* jit_allocation,
757 Instruction*
instr =
reinterpret_cast<Instruction*
>(
pc);
759 if (jit_allocation) {
770 if (
rt.IsRegister()) {
771 return rt.Is64Bits() ? LDR_x : LDR_w;
774 switch (
rt.SizeInBits()) {
792 if (
rt.IsRegister()) {
793 return rt.Is64Bits() ? STR_x : STR_w;
796 switch (
rt.SizeInBits()) {
823 if (
rt.IsRegister()) {
824 return rt.Is64Bits() ? STP_x : STP_w;
827 switch (
rt.SizeInBits()) {
840 if (
rt.IsRegister()) {
877 int immediate,
Instr op) {
897 return 1 << FlagsUpdate_offset;
899 return 0 << FlagsUpdate_offset;
907 Instr imm =
static_cast<Instr>(checked_truncate_to_int21(imm21));
908 Instr immhi = (imm >> ImmPCRelLo_width) << ImmPCRelHi_offset;
909 Instr immlo = imm << ImmPCRelLo_offset;
910 return (immhi & ImmPCRelHi_mask) | (immlo & ImmPCRelLo_mask);
914 return checked_truncate_to_int26(imm26) << ImmUncondBranch_offset;
918 return checked_truncate_to_int19(imm19) << ImmCondBranch_offset;
922 return checked_truncate_to_int19(imm19) << ImmCmpBranch_offset;
926 return checked_truncate_to_int14(imm14) << ImmTestBranch_offset;
930 DCHECK(is_uint6(bit_pos));
932 unsigned b5 = bit_pos << (ImmTestBranchBit5_offset - 5);
933 unsigned b40 = bit_pos << ImmTestBranchBit40_offset;
934 b5 &= ImmTestBranchBit5_mask;
935 b40 &= ImmTestBranchBit40_mask;
945 if (is_uint12(imm)) {
946 imm <<= ImmAddSub_offset;
948 imm = ((imm >> 12) << ImmAddSub_offset) | (1 << ShiftAddSub_offset);
957 return imms << ImmS_offset;
965 return immr << ImmR_offset;
973 return imms << ImmSetBits_offset;
981 return immr << ImmRotate_offset;
985 return checked_truncate_to_int19(imm19) << ImmLLiteral_offset;
992 return bitn << BitN_offset;
997 return shift << ShiftDP_offset;
1001 DCHECK(is_uint6(amount));
1002 return amount << ImmDPShift_offset;
1006 return extend << ExtendMode_offset;
1011 return left_shift << ImmExtendShift_offset;
1016 return imm << ImmCondCmp_offset;
1020 return ((nzcv >> Flags_offset) & 0xf) << Nzcv_offset;
1024 DCHECK(is_uint12(imm12));
1025 return imm12 << ImmLSUnsigned_offset;
1029 return checked_truncate_to_int9(imm9) << ImmLS_offset;
1034 static_cast<int>(
static_cast<uint32_t
>(imm7 >> size) << size));
1035 int scaled_imm7 = imm7 >>
size;
1036 return checked_truncate_to_int7(scaled_imm7) << ImmLSPair_offset;
1040 DCHECK(is_uint1(shift_amount));
1041 return shift_amount << ImmShiftLS_offset;
1045 DCHECK(is_uint16(imm16));
1046 return imm16 << ImmException_offset;
1050 DCHECK(is_uint15(imm15));
1051 return imm15 << ImmSystemRegister_offset;
1056 return imm7 << ImmHint_offset;
1061 return imm2 << ImmBarrierDomain_offset;
1066 return imm2 << ImmBarrierType_offset;
1071 unsigned size_log2 =
static_cast<Instr>(op >> LSSize_offset);
1072 if ((op & LSVector_mask) != 0) {
1075 if (size_log2 == 0 && ((op & LSOpc_mask) >> LSOpc_offset) >= 2) {
1084 return imm << ImmMoveWide_offset;
1089 return shift << ShiftMoveWide_offset;
1096 return scale << FPScale_offset;
1100 return reg.Is64Bits() ? xzr : wzr;
1104 assembler->CheckBufferSpace();
interpreter::OperandScale scale
union v8::internal::@341::BuiltinMetadata::KindSpecificData data
size_t EmbeddedObjectIndex
IndirectHandle< HeapObject > GetEmbeddedObject(EmbeddedObjectIndex index) const
static Instr Flags(FlagsUpdate S)
static Instr SF(Register rd)
static Instr RnSP(Register rn)
static Instr ImmR(unsigned immr, unsigned reg_size)
static Instr ImmTestBranch(int imm14)
static Instr RdSP(Register rd)
static constexpr int kSpecialTargetSize
static void deserialization_set_target_internal_reference_at(Address pc, Address target, WritableJitAllocation &jit_allocation, RelocInfo::Mode mode=RelocInfo::INTERNAL_REFERENCE)
static Instr ImmCondCmp(unsigned imm)
void LoadStoreWRegOffset(Instr memop, const Register ®offset)
static Instr ImmCmpBranch(int imm19)
static Instr Nzcv(StatusFlags nzcv)
void LoadStoreScaledImmOffset(Instr memop, int offset, unsigned size)
static Tagged_t target_compressed_address_at(Address pc, Address constant_pool)
static Instr ImmPCRelAddress(int imm21)
static Instr ImmException(int imm16)
absl::flat_hash_map< int, int > branch_link_chain_back_edge_
static LoadStoreOp StoreOpFor(const CPURegister &rt)
static Instr ImmAddSub(int imm)
static Instr ImmLSPair(int imm7, unsigned size)
static Instr Cond(Condition cond)
static Instr Rm(CPURegister rm)
static Instr Rd(CPURegister rd)
static Instr FPType(VRegister fd)
static void set_target_compressed_address_at(Address pc, Address constant_pool, Tagged_t target, WritableJitAllocation *jit_allocation, ICacheFlushMode icache_flush_mode=FLUSH_ICACHE_IF_NEEDED)
static Instr ImmExtendShift(unsigned left_shift)
EmbeddedObjectIndex embedded_object_index_referenced_from(Address pc)
static void set_uint32_constant_at(Address pc, Address constant_pool, uint32_t new_constant, WritableJitAllocation *jit_allocation, ICacheFlushMode icache_flush_mode=FLUSH_ICACHE_IF_NEEDED)
static LoadLiteralOp LoadLiteralOpFor(const CPURegister &rt)
static Instr ImmLLiteral(int imm19)
static LoadStorePairOp LoadPairOpFor(const CPURegister &rt, const CPURegister &rt2)
static Instr ImmShiftLS(unsigned shift_amount)
static Instr ImmSystemRegister(int imm15)
static Instr ImmLS(int imm9)
static constexpr bool IsImmAddSub(int64_t immediate)
static Instr ImmSetBits(unsigned imms, unsigned reg_size)
static Instr ImmDPShift(unsigned amount)
static Instr ImmBarrierType(int imm2)
static Instr ImmMoveWide(int imm)
void shift(Operand dst, Immediate shift_amount, int subcode, int size)
void Emit(Instr instruction)
static Instr ExtendMode(Extend extend)
int LinkAndGetBranchInstructionOffsetTo(Label *label)
int LinkAndGetByteOffsetTo(Label *label)
static Instr ImmS(unsigned imms, unsigned reg_size)
static Instr ImmRotate(unsigned immr, unsigned reg_size)
static Instr ShiftDP(Shift shift)
static unsigned CalcLSDataSizeLog2(LoadStoreOp op)
static V8_INLINE void set_target_address_at(Address pc, Address constant_pool, Address target, WritableJitAllocation *jit_allocation, ICacheFlushMode icache_flush_mode=FLUSH_ICACHE_IF_NEEDED)
static Address target_pointer_address_at(Address pc)
static Instr ShiftMoveWide(int shift)
static constexpr int kStartOfLabelLinkChain
static Instr ImmCondBranch(int imm19)
static Instr BitN(unsigned bitn, unsigned reg_size)
static Builtin target_builtin_at(Address pc)
void DataProcImmediate(const Register &rd, const Register &rn, int immediate, Instr op)
static Instr ImmHint(int imm7)
static LoadStorePairOp StorePairOpFor(const CPURegister &rt, const CPURegister &rt2)
Handle< HeapObject > target_object_handle_at(Address pc)
static Instr Rn(CPURegister rn)
void CmpPlainRegister(const Register &rn, const Register &rm)
void LoadStoreUnscaledImmOffset(Instr memop, int offset)
static LoadStoreOp LoadOpFor(const CPURegister &rt)
void DataProcPlainRegister(const Register &rd, const Register &rn, const Register &rm, Instr op)
static int deserialization_special_target_size(Address location)
static Instr FPScale(unsigned scale)
static Instr ImmUncondBranch(int imm26)
void set_embedded_object_index_referenced_from(Address p, EmbeddedObjectIndex index)
static Instr ImmLSUnsigned(int imm12)
static V8_INLINE Address target_address_at(Address pc, Address constant_pool)
Handle< Code > code_target_object_handle_at(Address pc)
static uint32_t uint32_constant_at(Address pc, Address constant_pool)
static Instr ImmTestBranchBit(unsigned bit_pos)
static Instr ImmBarrierDomain(int imm2)
const Register & AppropriateZeroRegFor(const CPURegister ®) const
static constexpr bool IsBuiltinId(Builtin builtin)
void Remove(const CPURegList &other)
CPURegister::RegisterType type_
void Combine(const CPURegList &other)
RegisterType type() const
static constexpr CPURegister Create(int code, int size, RegisterType type)
bool IsSameSizeAndType(const CPURegister &other) const
static bool SupportsOptimizer()
V8_INLINE EnsureSpace(Assembler *assembler)
static V8_INLINE bool InTrustedSpace(Tagged< HeapObject > object)
static V8_INLINE bool InCodeSpace(Tagged< HeapObject > object)
const Register & base() const
AddrMode addrmode() const
const Register & regoffset() const
bool IsExtendedRegister() const
std::optional< HeapNumberRequest > heap_number_request_
int64_t ImmediateValue() const
RelocInfo::Mode ImmediateRMode() const
unsigned shift_amount() const
HeapNumberRequest heap_number_request() const
Immediate immediate_for_heap_number_request() const
bool IsHeapNumberRequest() const
Operand ToExtendedRegister() const
V8_INLINE Operand(int32_t immediate, RelocInfo::Mode rmode=RelocInfo::NO_INFO)
bool IsShiftedRegister() const
int32_t immediate() const
constexpr bool is_valid() const
constexpr int8_t code() const
static Register WRegFromCode(unsigned code)
static Register XRegFromCode(unsigned code)
static constexpr Register Create(int code, int size)
V8_INLINE Address target_internal_reference()
static constexpr bool IsInternalReference(Mode mode)
static constexpr bool IsOffHeapTarget(Mode mode)
static constexpr bool IsCompressedEmbeddedObject(Mode mode)
V8_INLINE Address target_address()
static constexpr bool IsNearBuiltinEntry(Mode mode)
V8_INLINE Address target_internal_reference_address()
static constexpr bool IsCodeTarget(Mode mode)
static constexpr bool IsWasmCall(Mode mode)
V8_INLINE int target_address_size()
V8_INLINE Builtin target_builtin_at(Assembler *origin)
V8_INLINE WasmCodePointer wasm_code_pointer_table_entry() const
V8_INLINE Address target_off_heap_target()
static constexpr bool IsWasmStubCall(Mode mode)
static constexpr bool IsEmbeddedObjectMode(Mode mode)
V8_INLINE Address target_external_reference()
V8_INLINE Tagged< HeapObject > target_object(PtrComprCageBase cage_base)
V8_INLINE Address constant_pool_entry_address()
V8_INLINE JSDispatchHandle js_dispatch_handle()
V8_INLINE DirectHandle< HeapObject > target_object_handle(Assembler *origin)
static constexpr bool IsFullEmbeddedObject(Mode mode)
@ WASM_CODE_POINTER_TABLE_ENTRY
bool HasTargetAddressAddress() const
V8_INLINE Address target_address_address()
static V8_INLINE Tagged_t CompressObject(Address tagged)
static V8_INLINE Address DecompressTagged(TOnHeapAddress on_heap_addr, Tagged_t raw_value)
static VRegister HRegFromCode(unsigned code)
static constexpr VRegister Create(int code, int size, int lane_count=1)
static VRegister VRegFromCode(unsigned code)
static VRegister BRegFromCode(unsigned code)
static VRegister QRegFromCode(unsigned code)
static VRegister DRegFromCode(unsigned code)
static VRegister SRegFromCode(unsigned code)
V8_INLINE void WriteUnalignedValue(Address address, T value)
V8_INLINE void WriteValue(Address address, T value)
V8_INLINE void set_target_object(Tagged< InstructionStream > host, Tagged< HeapObject > target, WriteBarrierMode write_barrier_mode=UPDATE_WRITE_BARRIER, ICacheFlushMode icache_flush_mode=FLUSH_ICACHE_IF_NEEDED)
WritableJitAllocation & jit_allocation_
V8_INLINE void set_wasm_code_pointer_table_entry(WasmCodePointer, ICacheFlushMode icache_flush_mode=FLUSH_ICACHE_IF_NEEDED)
V8_INLINE void apply(intptr_t delta)
V8_INLINE void set_target_external_reference(Address, ICacheFlushMode icache_flush_mode=FLUSH_ICACHE_IF_NEEDED)
#define V8_EXTERNAL_CODE_SPACE_BOOL
#define COMPRESS_POINTERS_BOOL
#define HAS_SMI_TAG(value)
#define V8_ENABLE_SANDBOX_BOOL
DirectHandle< Object > new_target
V8_INLINE IndirectHandle< T > handle(Tagged< T > object, Isolate *isolate)
constexpr GenericInstrField SixtyFourBits
V8_EXPORT_PRIVATE base::Vector< Flag > Flags()
constexpr AddrMode PreIndex
constexpr int kTaggedSize
constexpr int kVRegSizeInBits
constexpr GenericInstrField FP64
constexpr AddrMode Offset
constexpr int kWRegSizeInBits
constexpr int kZeroRegCode
constexpr int kNumberOfRegisters
void FlushInstructionCache(void *start, size_t size)
kInterpreterTrampolineOffset Tagged< HeapObject >
constexpr LoadStoreUnscaledOffsetOp LoadStoreUnscaledOffsetFixed
constexpr LoadStorePairOp LoadStorePairLBit
base::StrongAlias< JSDispatchHandleAliasTag, uint32_t > JSDispatchHandle
constexpr uint8_t kInstrSizeLog2
constexpr int kSystemPointerSize
constexpr int kQRegSizeLog2
constexpr AddSubShiftedOp AddSubShiftedFixed
constexpr LoadLiteralOp LDR_d_lit
constexpr int kBRegSizeInBits
constexpr LoadStoreUnsignedOffset LoadStoreUnsignedOffsetFixed
constexpr LoadLiteralOp LDR_w_lit
constexpr AddSubImmediateOp AddSubImmediateFixed
constexpr AddrMode PostIndex
constexpr LoadStoreRegisterOffset LoadStoreRegisterOffsetFixed
constexpr int kXRegSizeInBits
constexpr int kNumberOfVRegisters
constexpr GenericInstrField FP32
constexpr uint8_t kInstrSize
constexpr int kSPRegInternalCode
constexpr int kSRegSizeInBits
constexpr LoadLiteralOp LDR_s_lit
constexpr int kQRegSizeInBits
constexpr LoadLiteralOp LDR_x_lit
V8_EXPORT_PRIVATE bool AreSameSizeAndType(const CPURegister ®1, const CPURegister ®2=NoCPUReg, const CPURegister ®3=NoCPUReg, const CPURegister ®4=NoCPUReg, const CPURegister ®5=NoCPUReg, const CPURegister ®6=NoCPUReg, const CPURegister ®7=NoCPUReg, const CPURegister ®8=NoCPUReg)
constexpr GenericInstrField ThirtyTwoBits
constexpr int kHRegSizeInBits
constexpr int kDRegSizeInBits
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
#define DCHECK_LE(v1, v2)
#define DCHECK_IMPLIES(v1, v2)
#define DCHECK(condition)
#define DCHECK_LT(v1, v2)
#define DCHECK_EQ(v1, v2)
constexpr bool IsAligned(T value, U alignment)