35#ifndef V8_CODEGEN_RISCV_ASSEMBLER_RISCV_INL_H_
36#define V8_CODEGEN_RISCV_ASSEMBLER_RISCV_INL_H_
97#ifdef V8_TARGET_ARCH_RISCV64
99#elif defined(V8_TARGET_ARCH_RISCV32)
116 WritableJitAllocation* jit_allocation,
ICacheFlushMode icache_flush_mode) {
129 base::EmbeddedVector<char, 128> disasm_buffer;
131 disasm.InstructionDecode(disasm_buffer,
reinterpret_cast<uint8_t*
>(
pc));
133 disasm.InstructionDecode(disasm_buffer,
163 DEBUG_PRINTF(
"\tcompressed_embedded_object_handle_at: pc: 0x%" PRIxPTR
" \t ",
169 DEBUG_PRINTF(
"\tembedded_object_handle_at: pc: 0x%" PRIxPTR
" \n",
pc);
174 disasm.InstructionDecode(disasm_buffer,
reinterpret_cast<uint8_t*
>(
pc));
176 disasm.InstructionDecode(disasm_buffer,
179#if V8_TARGET_ARCH_RISCV64
185 DEBUG_PRINTF(
"\tembedded_target_offset %d\n", embedded_target_offset);
188 Memory<EmbeddedObjectIndex>(
pc + embedded_target_offset));
190 Memory<EmbeddedObjectIndex>(
pc + embedded_target_offset));
200#if V8_TARGET_ARCH_RISCV64
208 Memory<EmbeddedObjectIndex>(
pc + embedded_target_offset) =
data;
226#ifdef V8_TARGET_ARCH_RISCV64
228#elif defined(V8_TARGET_ARCH_RISCV32)
259 return origin->embedded_object_handle_at(
pc_);
262 return origin->relative_code_target_object_handle_at(
pc_);
302 return Memory<Address>(
pc_);
339 return static_cast<Builtin>(builtin_id);
360 if (
IsLui(*
reinterpret_cast<Instr*
>(instr0)) &&
381 int32_t high_20 = (((int32_t)target + 0x800) >> 12);
382 int32_t low_12 = (int32_t)target << 20 >> 20;
402 uint32_t new_constant,
403 WritableJitAllocation* jit_allocation,
405 Instruction* instr1 =
reinterpret_cast<Instruction*
>(
pc);
406 Instruction* instr2 =
reinterpret_cast<Instruction*
>(
pc + 1 *
kInstrSize);
422 instr &= ~kImm12Mask;
#define DEBUG_PRINTF(...)
union v8::internal::@341::BuiltinMetadata::KindSpecificData data
constexpr T * begin() const
IndirectHandle< Code > GetCodeTarget(intptr_t code_target_index) const
size_t EmbeddedObjectIndex
IndirectHandle< HeapObject > GetEmbeddedObject(EmbeddedObjectIndex index) const
static bool IsAddi(Instr instr)
static bool IsAuipc(Instr instr)
static void set_target_value_at(Address pc, uint64_t target, WritableJitAllocation *jit_allocation=nullptr, ICacheFlushMode icache_flush_mode=FLUSH_ICACHE_IF_NEEDED)
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)
V8_INLINE Handle< Code > relative_code_target_object_handle_at(Address pc_) const
static Tagged_t target_compressed_address_at(Address pc, Address constant_pool)
static int32_t target_constant32_at(Address pc)
static void RelocateRelativeReference(RelocInfo::Mode rmode, Address pc, intptr_t pc_delta, WritableJitAllocation *jit_allocation=nullptr)
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 Address target_constant_address_at(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 bool IsJalr(Instr instr)
void instr_at_put(int pos, Instr instr)
static bool IsLui(Instr instr)
static void set_target_internal_reference_encoded_at(Address pc, Address target)
static constexpr int kGap
static int RelocateInternalReference(RelocInfo::Mode rmode, Address pc, intptr_t pc_delta, WritableJitAllocation *jit_allocation=nullptr)
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)
Handle< HeapObject > compressed_embedded_object_handle_at(Address pc, Address constant_pool)
static constexpr int kInstructionsFor32BitConstant
static Builtin target_builtin_at(Address pc)
static constexpr int kInstructionsFor64BitConstant
static void deserialization_set_special_target_at(Address location, Tagged< Code > code, Address target)
static int deserialization_special_target_size(Address location)
V8_INLINE void CheckBuffer()
static void set_target_constant32_at(Address pc, uint32_t target, WritableJitAllocation *jit_allocation, ICacheFlushMode icache_flush_mode)
void set_embedded_object_index_referenced_from(Address p, EmbeddedObjectIndex index)
Handle< HeapObject > embedded_object_handle_at(Address pc, Address constant_pool)
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 int BrachlongOffset(Instr auipc, Instr jalr)
static constexpr bool IsBuiltinId(Builtin builtin)
static bool IsSupported(CpuFeature f)
static bool SupportsOptimizer()
V8_INLINE EnsureSpace(Assembler *assembler)
static V8_INLINE bool InTrustedSpace(Tagged< HeapObject > object)
static V8_INLINE bool InCodeSpace(Tagged< HeapObject > object)
int32_t Imm12Value() const
Instr InstructionBits() const
static Instruction * At(Address pc)
V8_INLINE Address target_internal_reference()
static constexpr bool IsInternalReference(Mode mode)
static constexpr bool IsOffHeapTarget(Mode mode)
static constexpr bool IsRelativeCodeTarget(Mode mode)
static constexpr bool IsCodeTargetMode(Mode mode)
static constexpr bool IsCompressedEmbeddedObject(Mode mode)
V8_INLINE Address target_address()
static constexpr bool IsNearBuiltinEntry(Mode mode)
static constexpr bool IsInternalReferenceEncoded(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)
static constexpr bool IsExternalReference(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)
V8_INLINE void WriteUnalignedValue(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 V8_ENABLE_SANDBOX_BOOL
void FlushInstructionCache(void *start, size_t size)
kInterpreterTrampolineOffset Tagged< HeapObject >
base::StrongAlias< JSDispatchHandleAliasTag, uint32_t > JSDispatchHandle
static Instr SetHi20Offset(int32_t hi20, Instr instr)
constexpr int kSystemPointerSize
const uint32_t kImm19_0Mask
constexpr uint8_t kInstrSize
static constexpr Address kNullAddress
static Instr SetLo12Offset(int32_t lo12, Instr instr)
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
#define DCHECK_IMPLIES(v1, v2)
#define DCHECK(condition)
#define DCHECK_EQ(v1, v2)