37#ifndef V8_CODEGEN_PPC_ASSEMBLER_PPC_INL_H_
38#define V8_CODEGEN_PPC_ASSEMBLER_PPC_INL_H_
72 return Memory<Address>(
pc_);
126 WritableJitAllocation* jit_allocation,
ICacheFlushMode icache_flush_mode) {
128 static_cast<Address>(target), jit_allocation,
246void Assembler::UntrackBranch() {
247 DCHECK(!trampoline_emitted_);
249 int count = --tracked_branch_count_;
252 next_trampoline_check_ =
kMaxInt;
254 next_trampoline_check_ += kTrampolineSlotsSize;
259Address Assembler::target_address_at(Address
pc, Address constant_pool) {
262 if (IsConstantPoolLoadStart(
pc, &access))
263 return Memory<Address>(target_constant_pool_address_at(
264 pc, constant_pool, access, ConstantPoolEntry::INTPTR));
267 Instr instr1 = instr_at(
pc);
268 Instr instr2 = instr_at(
pc + kInstrSize);
270 if (IsLis(instr1) && IsOri(instr2)) {
271 Instr instr4 = instr_at(
pc + (3 * kInstrSize));
272 Instr instr5 = instr_at(
pc + (4 * kInstrSize));
274 uint64_t hi = (
static_cast<uint32_t
>((instr1 & kImm16Mask) << 16) |
275 static_cast<uint32_t
>(instr2 & kImm16Mask));
276 uint64_t lo = (
static_cast<uint32_t
>((instr4 & kImm16Mask) << 16) |
277 static_cast<uint32_t
>(instr5 & kImm16Mask));
278 return static_cast<Address
>((hi << 32) | lo);
293bool Assembler::IsConstantPoolLoadStart(Address
pc,
298 bool overflowed = (opcode == ADDIS);
306 *access = (overflowed ? ConstantPoolEntry::OVERFLOWED
307 : ConstantPoolEntry::REGULAR);
312bool Assembler::IsConstantPoolLoadEnd(Address
pc,
316 bool overflowed =
false;
327 *access = (overflowed ? ConstantPoolEntry::OVERFLOWED
328 : ConstantPoolEntry::REGULAR);
333int Assembler::GetConstantPoolOffset(Address
pc,
336 bool overflowed = (access == ConstantPoolEntry::OVERFLOWED);
340 DCHECK(IsConstantPoolLoadStart(
pc, &access_check));
341 DCHECK(access_check == access);
354void Assembler::PatchConstantPoolAccessInstruction(
357 Address
pc =
reinterpret_cast<Address
>(buffer_start_) +
pc_offset;
358 bool overflowed = (access == ConstantPoolEntry::OVERFLOWED);
363 DCHECK(IsConstantPoolLoadStart(
pc, &access_check));
364 DCHECK(access_check == access);
367 int hi_word =
static_cast<int>(
offset >> 16);
368 int lo_word =
static_cast<int>(
offset & 0xffff);
369 if (lo_word & 0x8000) hi_word++;
373 instr1 &= ~kImm16Mask;
375 instr2 &= ~kImm16Mask;
377 instr_at_put(
pc, instr1);
381 instr &= ~kImm16Mask;
387Address Assembler::target_constant_pool_address_at(
392 addr += GetConstantPoolOffset(
pc, access, type);
396int Assembler::deserialization_special_target_size(
397 Address instruction_payload) {
398 return kSpecialTargetSize;
401void Assembler::deserialization_set_target_internal_reference_at(
402 Address
pc, Address target, WritableJitAllocation& jit_allocation,
403 RelocInfo::Mode mode) {
404 if (RelocInfo::IsInternalReferenceEncoded(mode)) {
405 set_target_address_at(
pc, kNullAddress, target, &jit_allocation,
408 jit_allocation.WriteUnalignedValue<Address>(
pc,
target);
413void Assembler::set_target_address_at(Address
pc, Address constant_pool,
415 WritableJitAllocation* jit_allocation,
416 ICacheFlushMode icache_flush_mode) {
418 ConstantPoolEntry::Access access;
419 if (IsConstantPoolLoadStart(
pc, &access)) {
420 if (jit_allocation) {
421 jit_allocation->WriteUnalignedValue<
Address>(
422 target_constant_pool_address_at(
pc, constant_pool, access,
423 ConstantPoolEntry::INTPTR),
426 Memory<Address>(target_constant_pool_address_at(
427 pc, constant_pool, access, ConstantPoolEntry::INTPTR)) =
target;
434 Instr instr2 = instr_at(
pc + kInstrSize);
436 if (IsLis(instr1) && IsOri(instr2)) {
437 Instr instr4 = instr_at(
pc + (3 * kInstrSize));
438 Instr instr5 = instr_at(
pc + (4 * kInstrSize));
440 uint32_t* p =
reinterpret_cast<uint32_t*
>(
pc);
441 uintptr_t itarget =
static_cast<uintptr_t
>(
target);
443 instr5 &= ~kImm16Mask;
445 itarget = itarget >> 16;
447 instr4 &= ~kImm16Mask;
449 itarget = itarget >> 16;
451 instr2 &= ~kImm16Mask;
453 itarget = itarget >> 16;
455 instr1 &= ~kImm16Mask;
457 itarget = itarget >> 16;
459 if (jit_allocation) {
460 jit_allocation->WriteUnalignedValue(
reinterpret_cast<Address>(&p[0]),
462 jit_allocation->WriteUnalignedValue(
reinterpret_cast<Address>(&p[1]),
464 jit_allocation->WriteUnalignedValue(
reinterpret_cast<Address>(&p[3]),
466 jit_allocation->WriteUnalignedValue(
reinterpret_cast<Address>(&p[4]),
474 if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
482uint32_t Assembler::uint32_constant_at(Address
pc, Address constant_pool) {
483 return static_cast<uint32_t
>(Assembler::target_address_at(
pc, constant_pool));
486void Assembler::set_uint32_constant_at(Address
pc, Address constant_pool,
487 uint32_t new_constant,
488 WritableJitAllocation* jit_allocation,
489 ICacheFlushMode icache_flush_mode) {
490 Assembler::set_target_address_at(
pc, constant_pool,
491 static_cast<Address>(new_constant),
492 jit_allocation, icache_flush_mode);
IndirectHandle< Code > GetCodeTarget(intptr_t code_target_index) const
IndirectHandle< HeapObject > GetEmbeddedObject(EmbeddedObjectIndex index) const
static constexpr int kSpecialTargetSize
static V8_INLINE Address target_constant_pool_address_at(Address pc, Address constant_pool, ConstantPoolEntry::Access access, ConstantPoolEntry::Type type)
static Tagged_t target_compressed_address_at(Address pc, Address constant_pool)
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 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 V8_INLINE bool IsConstantPoolLoadStart(Address pc, ConstantPoolEntry::Access *access=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 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 bool SupportsOptimizer()
static V8_INLINE DirectHandle FromSlot(Address *slot)
static V8_INLINE bool InTrustedSpace(Tagged< HeapObject > object)
static V8_INLINE bool InCodeSpace(Tagged< HeapObject > object)
V8_INLINE Operand(int32_t immediate, RelocInfo::Mode rmode=RelocInfo::NO_INFO)
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 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)
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 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_EMBEDDED_CONSTANT_POOL_BOOL
#define V8_ENABLE_SANDBOX_BOOL
#define SIGN_EXT_IMM16(imm)
constexpr BarrierOption LD
void FlushInstructionCache(void *start, size_t size)
kInterpreterTrampolineOffset Tagged< HeapObject >
base::StrongAlias< JSDispatchHandleAliasTag, uint32_t > JSDispatchHandle
const uint32_t kLoadIntptrOpcode
constexpr Register kConstantPoolRegister
constexpr int kSystemPointerSize
constexpr uint8_t kInstrSize
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_GT(v1, v2)