[assembler] Make {RelocInfo} independent of the Isolate.
Now that instruction cache flushing is process-wide and no longer bound to a specific {Isolate}, we can also make setters on the {RelocInfo} structure equally independent of the {Isolate} and remove the respective parameter everywhere. R=ahaas@chromium.org Change-Id: I7b21f6f79d0d6cf73424019b9e808c3ec76de08e Reviewed-on: https://chromium-review.googlesource.com/915922 Reviewed-by: Andreas Haas <ahaas@chromium.org> Commit-Queue: Michael Starzinger <mstarzinger@chromium.org> Cr-Commit-Position: refs/heads/master@{#51269}
This commit is contained in:
parent
1e89fed0b7
commit
a740255899
@ -109,7 +109,7 @@ void RelocInfo::set_target_object(HeapObject* target,
|
||||
WriteBarrierMode write_barrier_mode,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
|
||||
Assembler::set_target_address_at(target->GetIsolate(), pc_, constant_pool_,
|
||||
Assembler::set_target_address_at(pc_, constant_pool_,
|
||||
reinterpret_cast<Address>(target),
|
||||
icache_flush_mode);
|
||||
if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != nullptr) {
|
||||
@ -143,22 +143,22 @@ Address RelocInfo::target_runtime_entry(Assembler* origin) {
|
||||
return target_address();
|
||||
}
|
||||
|
||||
void RelocInfo::set_target_runtime_entry(Isolate* isolate, Address target,
|
||||
void RelocInfo::set_target_runtime_entry(Address target,
|
||||
WriteBarrierMode write_barrier_mode,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(IsRuntimeEntry(rmode_));
|
||||
if (target_address() != target)
|
||||
set_target_address(isolate, target, write_barrier_mode, icache_flush_mode);
|
||||
set_target_address(target, write_barrier_mode, icache_flush_mode);
|
||||
}
|
||||
|
||||
void RelocInfo::WipeOut(Isolate* isolate) {
|
||||
void RelocInfo::WipeOut() {
|
||||
DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) ||
|
||||
IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) ||
|
||||
IsInternalReference(rmode_));
|
||||
if (IsInternalReference(rmode_)) {
|
||||
Memory::Address_at(pc_) = nullptr;
|
||||
} else {
|
||||
Assembler::set_target_address_at(isolate, pc_, constant_pool_, nullptr);
|
||||
Assembler::set_target_address_at(pc_, constant_pool_, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -273,15 +273,13 @@ Address Assembler::return_address_from_call_start(Address pc) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Assembler::deserialization_set_special_target_at(
|
||||
Isolate* isolate, Address constant_pool_entry, Code* code, Address target) {
|
||||
Address constant_pool_entry, Code* code, Address target) {
|
||||
Memory::Address_at(constant_pool_entry) = target;
|
||||
}
|
||||
|
||||
|
||||
void Assembler::deserialization_set_target_internal_reference_at(
|
||||
Isolate* isolate, Address pc, Address target, RelocInfo::Mode mode) {
|
||||
Address pc, Address target, RelocInfo::Mode mode) {
|
||||
Memory::Address_at(pc) = target;
|
||||
}
|
||||
|
||||
@ -329,11 +327,9 @@ Address Assembler::target_address_at(Address pc, Address constant_pool) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Assembler::set_target_address_at(Isolate* isolate, Address pc,
|
||||
Address constant_pool, Address target,
|
||||
void Assembler::set_target_address_at(Address pc, Address constant_pool,
|
||||
Address target,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK_IMPLIES(isolate == nullptr, icache_flush_mode == SKIP_ICACHE_FLUSH);
|
||||
if (is_constant_pool_load(pc)) {
|
||||
// This is a constant pool lookup. Update the entry in the constant pool.
|
||||
Memory::Address_at(constant_pool_entry_address(pc, constant_pool)) = target;
|
||||
|
@ -347,22 +347,20 @@ uint32_t RelocInfo::embedded_size() const {
|
||||
Assembler::target_address_at(pc_, constant_pool_));
|
||||
}
|
||||
|
||||
void RelocInfo::set_embedded_address(Isolate* isolate, Address address,
|
||||
void RelocInfo::set_embedded_address(Address address,
|
||||
ICacheFlushMode flush_mode) {
|
||||
Assembler::set_target_address_at(isolate, pc_, constant_pool_, address,
|
||||
flush_mode);
|
||||
Assembler::set_target_address_at(pc_, constant_pool_, address, flush_mode);
|
||||
}
|
||||
|
||||
void RelocInfo::set_embedded_size(Isolate* isolate, uint32_t size,
|
||||
ICacheFlushMode flush_mode) {
|
||||
Assembler::set_target_address_at(isolate, pc_, constant_pool_,
|
||||
void RelocInfo::set_embedded_size(uint32_t size, ICacheFlushMode flush_mode) {
|
||||
Assembler::set_target_address_at(pc_, constant_pool_,
|
||||
reinterpret_cast<Address>(size), flush_mode);
|
||||
}
|
||||
|
||||
void RelocInfo::set_js_to_wasm_address(Isolate* isolate, Address address,
|
||||
void RelocInfo::set_js_to_wasm_address(Address address,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK_EQ(rmode_, JS_TO_WASM_CALL);
|
||||
set_embedded_address(isolate, address, icache_flush_mode);
|
||||
set_embedded_address(address, icache_flush_mode);
|
||||
}
|
||||
|
||||
Address RelocInfo::js_to_wasm_address() const {
|
||||
|
@ -673,7 +673,7 @@ class Assembler : public AssemblerBase {
|
||||
// The isolate argument is unused (and may be nullptr) when skipping flushing.
|
||||
INLINE(static Address target_address_at(Address pc, Address constant_pool));
|
||||
INLINE(static void set_target_address_at(
|
||||
Isolate* isolate, Address pc, Address constant_pool, Address target,
|
||||
Address pc, Address constant_pool, Address target,
|
||||
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED));
|
||||
|
||||
// Return the code target address at a call site from the return address
|
||||
@ -687,12 +687,11 @@ class Assembler : public AssemblerBase {
|
||||
// This sets the branch destination (which is in the constant pool on ARM).
|
||||
// This is for calls and branches within generated code.
|
||||
inline static void deserialization_set_special_target_at(
|
||||
Isolate* isolate, Address constant_pool_entry, Code* code,
|
||||
Address target);
|
||||
Address constant_pool_entry, Code* code, Address target);
|
||||
|
||||
// This sets the internal reference at the pc.
|
||||
inline static void deserialization_set_target_internal_reference_at(
|
||||
Isolate* isolate, Address pc, Address target,
|
||||
Address pc, Address target,
|
||||
RelocInfo::Mode mode = RelocInfo::INTERNAL_REFERENCE);
|
||||
|
||||
// Here we are patching the address in the constant pool, not the actual call
|
||||
|
@ -576,21 +576,18 @@ Address Assembler::return_address_from_call_start(Address pc) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Assembler::deserialization_set_special_target_at(
|
||||
Isolate* isolate, Address constant_pool_entry, Code* code, Address target) {
|
||||
Address constant_pool_entry, Code* code, Address target) {
|
||||
Memory::Address_at(constant_pool_entry) = target;
|
||||
}
|
||||
|
||||
|
||||
void Assembler::deserialization_set_target_internal_reference_at(
|
||||
Isolate* isolate, Address pc, Address target, RelocInfo::Mode mode) {
|
||||
Address pc, Address target, RelocInfo::Mode mode) {
|
||||
Memory::Address_at(pc) = target;
|
||||
}
|
||||
|
||||
|
||||
void Assembler::set_target_address_at(Isolate* isolate, Address pc,
|
||||
Address constant_pool, Address target,
|
||||
void Assembler::set_target_address_at(Address pc, Address constant_pool,
|
||||
Address target,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
Memory::Address_at(target_pointer_address_at(pc)) = target;
|
||||
// Intuitively, we would think it is necessary to always flush the
|
||||
@ -642,7 +639,7 @@ void RelocInfo::set_target_object(HeapObject* target,
|
||||
WriteBarrierMode write_barrier_mode,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
|
||||
Assembler::set_target_address_at(target->GetIsolate(), pc_, constant_pool_,
|
||||
Assembler::set_target_address_at(pc_, constant_pool_,
|
||||
reinterpret_cast<Address>(target),
|
||||
icache_flush_mode);
|
||||
if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != nullptr) {
|
||||
@ -676,23 +673,23 @@ Address RelocInfo::target_runtime_entry(Assembler* origin) {
|
||||
return target_address();
|
||||
}
|
||||
|
||||
void RelocInfo::set_target_runtime_entry(Isolate* isolate, Address target,
|
||||
void RelocInfo::set_target_runtime_entry(Address target,
|
||||
WriteBarrierMode write_barrier_mode,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(IsRuntimeEntry(rmode_));
|
||||
if (target_address() != target) {
|
||||
set_target_address(isolate, target, write_barrier_mode, icache_flush_mode);
|
||||
set_target_address(target, write_barrier_mode, icache_flush_mode);
|
||||
}
|
||||
}
|
||||
|
||||
void RelocInfo::WipeOut(Isolate* isolate) {
|
||||
void RelocInfo::WipeOut() {
|
||||
DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) ||
|
||||
IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) ||
|
||||
IsInternalReference(rmode_));
|
||||
if (IsInternalReference(rmode_)) {
|
||||
Memory::Address_at(pc_) = nullptr;
|
||||
} else {
|
||||
Assembler::set_target_address_at(isolate, pc_, constant_pool_, nullptr);
|
||||
Assembler::set_target_address_at(pc_, constant_pool_, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -181,22 +181,20 @@ uint32_t RelocInfo::embedded_size() const {
|
||||
return Memory::uint32_at(Assembler::target_pointer_address_at(pc_));
|
||||
}
|
||||
|
||||
void RelocInfo::set_embedded_address(Isolate* isolate, Address address,
|
||||
void RelocInfo::set_embedded_address(Address address,
|
||||
ICacheFlushMode flush_mode) {
|
||||
Assembler::set_target_address_at(isolate, pc_, constant_pool_, address,
|
||||
flush_mode);
|
||||
Assembler::set_target_address_at(pc_, constant_pool_, address, flush_mode);
|
||||
}
|
||||
|
||||
void RelocInfo::set_embedded_size(Isolate* isolate, uint32_t size,
|
||||
ICacheFlushMode flush_mode) {
|
||||
void RelocInfo::set_embedded_size(uint32_t size, ICacheFlushMode flush_mode) {
|
||||
Memory::uint32_at(Assembler::target_pointer_address_at(pc_)) = size;
|
||||
// No icache flushing needed, see comment in set_target_address_at.
|
||||
}
|
||||
|
||||
void RelocInfo::set_js_to_wasm_address(Isolate* isolate, Address address,
|
||||
void RelocInfo::set_js_to_wasm_address(Address address,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK_EQ(rmode_, JS_TO_WASM_CALL);
|
||||
set_embedded_address(isolate, address, icache_flush_mode);
|
||||
set_embedded_address(address, icache_flush_mode);
|
||||
}
|
||||
|
||||
Address RelocInfo::js_to_wasm_address() const {
|
||||
|
@ -993,7 +993,7 @@ class Assembler : public AssemblerBase {
|
||||
// The isolate argument is unused (and may be nullptr) when skipping flushing.
|
||||
inline static Address target_address_at(Address pc, Address constant_pool);
|
||||
inline static void set_target_address_at(
|
||||
Isolate* isolate, Address pc, Address constant_pool, Address target,
|
||||
Address pc, Address constant_pool, Address target,
|
||||
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED);
|
||||
|
||||
// Return the code target address at a call site from the return address of
|
||||
@ -1007,12 +1007,11 @@ class Assembler : public AssemblerBase {
|
||||
// This sets the branch destination (which is in the constant pool on ARM).
|
||||
// This is for calls and branches within generated code.
|
||||
inline static void deserialization_set_special_target_at(
|
||||
Isolate* isolate, Address constant_pool_entry, Code* code,
|
||||
Address target);
|
||||
Address constant_pool_entry, Code* code, Address target);
|
||||
|
||||
// This sets the internal reference at the pc.
|
||||
inline static void deserialization_set_target_internal_reference_at(
|
||||
Isolate* isolate, Address pc, Address target,
|
||||
Address pc, Address target,
|
||||
RelocInfo::Mode mode = RelocInfo::INTERNAL_REFERENCE);
|
||||
|
||||
// All addresses in the constant pool are the same size as pointers.
|
||||
|
@ -301,16 +301,16 @@ const int kLastChunkTagBits = 1;
|
||||
const int kLastChunkTagMask = 1;
|
||||
const int kLastChunkTag = 1;
|
||||
|
||||
void RelocInfo::set_wasm_context_reference(Isolate* isolate, Address address,
|
||||
void RelocInfo::set_wasm_context_reference(Address address,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(IsWasmContextReference(rmode_));
|
||||
set_embedded_address(isolate, address, icache_flush_mode);
|
||||
set_embedded_address(address, icache_flush_mode);
|
||||
}
|
||||
|
||||
void RelocInfo::set_global_handle(Isolate* isolate, Address address,
|
||||
void RelocInfo::set_global_handle(Address address,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK_EQ(rmode_, WASM_GLOBAL_HANDLE);
|
||||
set_embedded_address(isolate, address, icache_flush_mode);
|
||||
set_embedded_address(address, icache_flush_mode);
|
||||
}
|
||||
|
||||
Address RelocInfo::wasm_call_address() const {
|
||||
@ -318,10 +318,10 @@ Address RelocInfo::wasm_call_address() const {
|
||||
return Assembler::target_address_at(pc_, constant_pool_);
|
||||
}
|
||||
|
||||
void RelocInfo::set_wasm_call_address(Isolate* isolate, Address address,
|
||||
void RelocInfo::set_wasm_call_address(Address address,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK_EQ(rmode_, WASM_CALL);
|
||||
Assembler::set_target_address_at(isolate, pc_, constant_pool_, address,
|
||||
Assembler::set_target_address_at(pc_, constant_pool_, address,
|
||||
icache_flush_mode);
|
||||
}
|
||||
|
||||
@ -341,17 +341,16 @@ Address RelocInfo::wasm_context_reference() const {
|
||||
}
|
||||
|
||||
void RelocInfo::update_wasm_function_table_size_reference(
|
||||
Isolate* isolate, uint32_t old_size, uint32_t new_size,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
uint32_t old_size, uint32_t new_size, ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(IsWasmFunctionTableSizeReference(rmode_));
|
||||
set_embedded_size(isolate, new_size, icache_flush_mode);
|
||||
set_embedded_size(new_size, icache_flush_mode);
|
||||
}
|
||||
|
||||
void RelocInfo::set_target_address(Isolate* isolate, Address target,
|
||||
void RelocInfo::set_target_address(Address target,
|
||||
WriteBarrierMode write_barrier_mode,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) || IsWasmCall(rmode_));
|
||||
Assembler::set_target_address_at(isolate, pc_, constant_pool_, target,
|
||||
Assembler::set_target_address_at(pc_, constant_pool_, target,
|
||||
icache_flush_mode);
|
||||
if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != nullptr &&
|
||||
IsCodeTarget(rmode_)) {
|
||||
@ -601,7 +600,7 @@ RelocIterator::RelocIterator(Vector<byte> instructions,
|
||||
// Implementation of RelocInfo
|
||||
|
||||
#ifdef DEBUG
|
||||
bool RelocInfo::RequiresRelocation(Isolate* isolate, const CodeDesc& desc) {
|
||||
bool RelocInfo::RequiresRelocation(const CodeDesc& desc) {
|
||||
// Ensure there are no code targets or embedded objects present in the
|
||||
// deoptimization entries, they would require relocation after code
|
||||
// generation.
|
||||
|
@ -512,25 +512,22 @@ class RelocInfo {
|
||||
Address wasm_call_address() const;
|
||||
|
||||
void set_wasm_context_reference(
|
||||
Isolate* isolate, Address address,
|
||||
Address address,
|
||||
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED);
|
||||
void update_wasm_function_table_size_reference(
|
||||
Isolate* isolate, uint32_t old_base, uint32_t new_base,
|
||||
uint32_t old_base, uint32_t new_base,
|
||||
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED);
|
||||
void set_target_address(
|
||||
Isolate* isolate, Address target,
|
||||
Address target,
|
||||
WriteBarrierMode write_barrier_mode = UPDATE_WRITE_BARRIER,
|
||||
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED);
|
||||
|
||||
void set_global_handle(
|
||||
Isolate* isolate, Address address,
|
||||
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED);
|
||||
void set_global_handle(Address address, ICacheFlushMode icache_flush_mode =
|
||||
FLUSH_ICACHE_IF_NEEDED);
|
||||
void set_wasm_call_address(
|
||||
Isolate*, Address,
|
||||
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED);
|
||||
Address, ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED);
|
||||
void set_js_to_wasm_address(
|
||||
Isolate*, Address,
|
||||
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED);
|
||||
Address, ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED);
|
||||
|
||||
// this relocation applies to;
|
||||
// can only be called if IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)
|
||||
@ -543,7 +540,7 @@ class RelocInfo {
|
||||
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED));
|
||||
INLINE(Address target_runtime_entry(Assembler* origin));
|
||||
INLINE(void set_target_runtime_entry(
|
||||
Isolate* isolate, Address target,
|
||||
Address target,
|
||||
WriteBarrierMode write_barrier_mode = UPDATE_WRITE_BARRIER,
|
||||
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED));
|
||||
INLINE(Cell* target_cell());
|
||||
@ -589,7 +586,7 @@ class RelocInfo {
|
||||
|
||||
// Wipe out a relocation to a fixed value, used for making snapshots
|
||||
// reproducible.
|
||||
INLINE(void WipeOut(Isolate* isolate));
|
||||
INLINE(void WipeOut());
|
||||
|
||||
template <typename ObjectVisitor>
|
||||
inline void Visit(ObjectVisitor* v);
|
||||
@ -597,7 +594,7 @@ class RelocInfo {
|
||||
#ifdef DEBUG
|
||||
// Check whether the given code contains relocation information that
|
||||
// either is position-relative or movable by the garbage collector.
|
||||
static bool RequiresRelocation(Isolate* isolate, const CodeDesc& desc);
|
||||
static bool RequiresRelocation(const CodeDesc& desc);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_DISASSEMBLER
|
||||
@ -613,10 +610,8 @@ class RelocInfo {
|
||||
static const int kApplyMask; // Modes affected by apply. Depends on arch.
|
||||
|
||||
private:
|
||||
void set_embedded_address(Isolate* isolate, Address address,
|
||||
ICacheFlushMode flush_mode);
|
||||
void set_embedded_size(Isolate* isolate, uint32_t size,
|
||||
ICacheFlushMode flush_mode);
|
||||
void set_embedded_address(Address address, ICacheFlushMode flush_mode);
|
||||
void set_embedded_size(uint32_t size, ICacheFlushMode flush_mode);
|
||||
|
||||
uint32_t embedded_size() const;
|
||||
Address embedded_address() const;
|
||||
|
@ -186,7 +186,7 @@ void SetupIsolateDelegate::ReplacePlaceholders(Isolate* isolate) {
|
||||
if (!target->is_builtin()) continue;
|
||||
Code* new_target =
|
||||
Code::cast(builtins->builtins_[target->builtin_index()]);
|
||||
rinfo->set_target_address(isolate, new_target->instruction_start(),
|
||||
rinfo->set_target_address(new_target->instruction_start(),
|
||||
UPDATE_WRITE_BARRIER, SKIP_ICACHE_FLUSH);
|
||||
} else {
|
||||
DCHECK(RelocInfo::IsEmbeddedObject(rinfo->rmode()));
|
||||
|
@ -1832,7 +1832,7 @@ void Deoptimizer::EnsureCodeForDeoptimizationEntry(Isolate* isolate,
|
||||
GenerateDeoptimizationEntries(&masm, kMaxNumberOfEntries, type);
|
||||
CodeDesc desc;
|
||||
masm.GetCode(isolate, &desc);
|
||||
DCHECK(!RelocInfo::RequiresRelocation(isolate, desc));
|
||||
DCHECK(!RelocInfo::RequiresRelocation(desc));
|
||||
|
||||
// Allocate the code as immovable since the entry addresses will be used
|
||||
// directly and there is no support for relocating them.
|
||||
|
@ -298,8 +298,7 @@ class UpdateTypedSlotHelper {
|
||||
Object* new_target = old_target;
|
||||
SlotCallbackResult result = callback(&new_target);
|
||||
if (new_target != old_target) {
|
||||
rinfo->set_target_address(old_target->GetIsolate(),
|
||||
Code::cast(new_target)->instruction_start());
|
||||
rinfo->set_target_address(Code::cast(new_target)->instruction_start());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -135,22 +135,22 @@ Address RelocInfo::target_runtime_entry(Assembler* origin) {
|
||||
return reinterpret_cast<Address>(*reinterpret_cast<int32_t*>(pc_));
|
||||
}
|
||||
|
||||
void RelocInfo::set_target_runtime_entry(Isolate* isolate, Address target,
|
||||
void RelocInfo::set_target_runtime_entry(Address target,
|
||||
WriteBarrierMode write_barrier_mode,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(IsRuntimeEntry(rmode_));
|
||||
if (target_address() != target) {
|
||||
set_target_address(isolate, target, write_barrier_mode, icache_flush_mode);
|
||||
set_target_address(target, write_barrier_mode, icache_flush_mode);
|
||||
}
|
||||
}
|
||||
|
||||
void RelocInfo::WipeOut(Isolate* isolate) {
|
||||
void RelocInfo::WipeOut() {
|
||||
if (IsEmbeddedObject(rmode_) || IsExternalReference(rmode_) ||
|
||||
IsInternalReference(rmode_)) {
|
||||
Memory::Address_at(pc_) = nullptr;
|
||||
} else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) {
|
||||
// Effectively write zero into the relocation.
|
||||
Assembler::set_target_address_at(isolate, pc_, constant_pool_,
|
||||
Assembler::set_target_address_at(pc_, constant_pool_,
|
||||
pc_ + sizeof(int32_t));
|
||||
} else {
|
||||
UNREACHABLE();
|
||||
@ -246,11 +246,9 @@ Address Assembler::target_address_at(Address pc, Address constant_pool) {
|
||||
return pc + sizeof(int32_t) + *reinterpret_cast<int32_t*>(pc);
|
||||
}
|
||||
|
||||
|
||||
void Assembler::set_target_address_at(Isolate* isolate, Address pc,
|
||||
Address constant_pool, Address target,
|
||||
void Assembler::set_target_address_at(Address pc, Address constant_pool,
|
||||
Address target,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK_IMPLIES(isolate == nullptr, icache_flush_mode == SKIP_ICACHE_FLUSH);
|
||||
int32_t* p = reinterpret_cast<int32_t*>(pc);
|
||||
*p = target - (pc + sizeof(int32_t));
|
||||
if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
|
||||
@ -263,8 +261,8 @@ Address Assembler::target_address_from_return_address(Address pc) {
|
||||
}
|
||||
|
||||
void Assembler::deserialization_set_special_target_at(
|
||||
Isolate* isolate, Address instruction_payload, Code* code, Address target) {
|
||||
set_target_address_at(isolate, instruction_payload,
|
||||
Address instruction_payload, Code* code, Address target) {
|
||||
set_target_address_at(instruction_payload,
|
||||
code ? code->constant_pool() : nullptr, target);
|
||||
}
|
||||
|
||||
@ -296,9 +294,8 @@ void Assembler::emit_near_disp(Label* L) {
|
||||
*pc_++ = disp;
|
||||
}
|
||||
|
||||
|
||||
void Assembler::deserialization_set_target_internal_reference_at(
|
||||
Isolate* isolate, Address pc, Address target, RelocInfo::Mode mode) {
|
||||
Address pc, Address target, RelocInfo::Mode mode) {
|
||||
Memory::Address_at(pc) = target;
|
||||
}
|
||||
|
||||
|
@ -207,7 +207,7 @@ Address RelocInfo::embedded_address() const { return Memory::Address_at(pc_); }
|
||||
|
||||
uint32_t RelocInfo::embedded_size() const { return Memory::uint32_at(pc_); }
|
||||
|
||||
void RelocInfo::set_embedded_address(Isolate* isolate, Address address,
|
||||
void RelocInfo::set_embedded_address(Address address,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
Memory::Address_at(pc_) = address;
|
||||
if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
|
||||
@ -215,7 +215,7 @@ void RelocInfo::set_embedded_address(Isolate* isolate, Address address,
|
||||
}
|
||||
}
|
||||
|
||||
void RelocInfo::set_embedded_size(Isolate* isolate, uint32_t size,
|
||||
void RelocInfo::set_embedded_size(uint32_t size,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
Memory::uint32_at(pc_) = size;
|
||||
if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
|
||||
@ -223,10 +223,10 @@ void RelocInfo::set_embedded_size(Isolate* isolate, uint32_t size,
|
||||
}
|
||||
}
|
||||
|
||||
void RelocInfo::set_js_to_wasm_address(Isolate* isolate, Address address,
|
||||
void RelocInfo::set_js_to_wasm_address(Address address,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK_EQ(rmode_, JS_TO_WASM_CALL);
|
||||
Assembler::set_target_address_at(isolate, pc_, constant_pool_, address,
|
||||
Assembler::set_target_address_at(pc_, constant_pool_, address,
|
||||
icache_flush_mode);
|
||||
}
|
||||
|
||||
|
@ -513,7 +513,7 @@ class Assembler : public AssemblerBase {
|
||||
// The isolate argument is unused (and may be nullptr) when skipping flushing.
|
||||
inline static Address target_address_at(Address pc, Address constant_pool);
|
||||
inline static void set_target_address_at(
|
||||
Isolate* isolate, Address pc, Address constant_pool, Address target,
|
||||
Address pc, Address constant_pool, Address target,
|
||||
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED);
|
||||
|
||||
// Return the code target address at a call site from the return address
|
||||
@ -523,12 +523,11 @@ class Assembler : public AssemblerBase {
|
||||
// This sets the branch destination (which is in the instruction on x86).
|
||||
// This is for calls and branches within generated code.
|
||||
inline static void deserialization_set_special_target_at(
|
||||
Isolate* isolate, Address instruction_payload, Code* code,
|
||||
Address target);
|
||||
Address instruction_payload, Code* code, Address target);
|
||||
|
||||
// This sets the internal reference at the pc.
|
||||
inline static void deserialization_set_target_internal_reference_at(
|
||||
Isolate* isolate, Address pc, Address target,
|
||||
Address pc, Address target,
|
||||
RelocInfo::Mode mode = RelocInfo::INTERNAL_REFERENCE);
|
||||
|
||||
static constexpr int kSpecialTargetSize = kPointerSize;
|
||||
|
@ -35,7 +35,7 @@ UnaryMathFunctionWithIsolate CreateSqrtFunction(Isolate* isolate) {
|
||||
|
||||
CodeDesc desc;
|
||||
masm.GetCode(isolate, &desc);
|
||||
DCHECK(!RelocInfo::RequiresRelocation(isolate, desc));
|
||||
DCHECK(!RelocInfo::RequiresRelocation(desc));
|
||||
|
||||
Assembler::FlushICache(buffer, allocated);
|
||||
CHECK(SetPermissions(buffer, allocated, PageAllocator::kReadExecute));
|
||||
@ -447,7 +447,7 @@ MemMoveFunction CreateMemMoveFunction(Isolate* isolate) {
|
||||
|
||||
CodeDesc desc;
|
||||
masm.GetCode(isolate, &desc);
|
||||
DCHECK(!RelocInfo::RequiresRelocation(isolate, desc));
|
||||
DCHECK(!RelocInfo::RequiresRelocation(desc));
|
||||
Assembler::FlushICache(buffer, allocated);
|
||||
CHECK(SetPermissions(buffer, allocated, PageAllocator::kReadExecute));
|
||||
// TODO(jkummerow): It would be nice to register this code creation event
|
||||
|
@ -125,16 +125,14 @@ Address Assembler::target_address_from_return_address(Address pc) {
|
||||
}
|
||||
|
||||
void Assembler::deserialization_set_special_target_at(
|
||||
Isolate* isolate, Address instruction_payload, Code* code, Address target) {
|
||||
Address instruction_payload, Code* code, Address target) {
|
||||
if (IsMipsArchVariant(kMips32r6)) {
|
||||
// On R6 the address location is shifted by one instruction
|
||||
set_target_address_at(
|
||||
isolate,
|
||||
instruction_payload - (kInstructionsFor32BitConstant - 1) * kInstrSize,
|
||||
code ? code->constant_pool() : nullptr, target);
|
||||
} else {
|
||||
set_target_address_at(
|
||||
isolate,
|
||||
instruction_payload - kInstructionsFor32BitConstant * kInstrSize,
|
||||
code ? code->constant_pool() : nullptr, target);
|
||||
}
|
||||
@ -171,9 +169,8 @@ void Assembler::set_target_internal_reference_encoded_at(Address pc,
|
||||
// after complete deserialization, no need to flush on each reference.
|
||||
}
|
||||
|
||||
|
||||
void Assembler::deserialization_set_target_internal_reference_at(
|
||||
Isolate* isolate, Address pc, Address target, RelocInfo::Mode mode) {
|
||||
Address pc, Address target, RelocInfo::Mode mode) {
|
||||
if (mode == RelocInfo::INTERNAL_REFERENCE_ENCODED) {
|
||||
DCHECK(IsLui(instr_at(pc)));
|
||||
set_target_internal_reference_encoded_at(pc, target);
|
||||
@ -199,7 +196,7 @@ void RelocInfo::set_target_object(HeapObject* target,
|
||||
WriteBarrierMode write_barrier_mode,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
|
||||
Assembler::set_target_address_at(target->GetIsolate(), pc_, constant_pool_,
|
||||
Assembler::set_target_address_at(pc_, constant_pool_,
|
||||
reinterpret_cast<Address>(target),
|
||||
icache_flush_mode);
|
||||
if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != nullptr) {
|
||||
@ -249,15 +246,15 @@ Address RelocInfo::target_runtime_entry(Assembler* origin) {
|
||||
return target_address();
|
||||
}
|
||||
|
||||
void RelocInfo::set_target_runtime_entry(Isolate* isolate, Address target,
|
||||
void RelocInfo::set_target_runtime_entry(Address target,
|
||||
WriteBarrierMode write_barrier_mode,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(IsRuntimeEntry(rmode_));
|
||||
if (target_address() != target)
|
||||
set_target_address(isolate, target, write_barrier_mode, icache_flush_mode);
|
||||
set_target_address(target, write_barrier_mode, icache_flush_mode);
|
||||
}
|
||||
|
||||
void RelocInfo::WipeOut(Isolate* isolate) {
|
||||
void RelocInfo::WipeOut() {
|
||||
DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) ||
|
||||
IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) ||
|
||||
IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_));
|
||||
@ -266,7 +263,7 @@ void RelocInfo::WipeOut(Isolate* isolate) {
|
||||
} else if (IsInternalReferenceEncoded(rmode_)) {
|
||||
Assembler::set_target_internal_reference_encoded_at(pc_, nullptr);
|
||||
} else {
|
||||
Assembler::set_target_address_at(isolate, pc_, constant_pool_, nullptr);
|
||||
Assembler::set_target_address_at(pc_, constant_pool_, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -209,22 +209,20 @@ uint32_t RelocInfo::embedded_size() const {
|
||||
Assembler::target_address_at(pc_, constant_pool_));
|
||||
}
|
||||
|
||||
void RelocInfo::set_embedded_address(Isolate* isolate, Address address,
|
||||
void RelocInfo::set_embedded_address(Address address,
|
||||
ICacheFlushMode flush_mode) {
|
||||
Assembler::set_target_address_at(isolate, pc_, constant_pool_, address,
|
||||
flush_mode);
|
||||
Assembler::set_target_address_at(pc_, constant_pool_, address, flush_mode);
|
||||
}
|
||||
|
||||
void RelocInfo::set_embedded_size(Isolate* isolate, uint32_t size,
|
||||
ICacheFlushMode flush_mode) {
|
||||
Assembler::set_target_address_at(isolate, pc_, constant_pool_,
|
||||
void RelocInfo::set_embedded_size(uint32_t size, ICacheFlushMode flush_mode) {
|
||||
Assembler::set_target_address_at(pc_, constant_pool_,
|
||||
reinterpret_cast<Address>(size), flush_mode);
|
||||
}
|
||||
|
||||
void RelocInfo::set_js_to_wasm_address(Isolate* isolate, Address address,
|
||||
void RelocInfo::set_js_to_wasm_address(Address address,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK_EQ(rmode_, JS_TO_WASM_CALL);
|
||||
set_embedded_address(isolate, address, icache_flush_mode);
|
||||
set_embedded_address(address, icache_flush_mode);
|
||||
}
|
||||
|
||||
Address RelocInfo::js_to_wasm_address() const {
|
||||
@ -281,8 +279,7 @@ void Assembler::AllocateAndInstallRequestedHeapObjects(Isolate* isolate) {
|
||||
break;
|
||||
}
|
||||
Address pc = buffer_ + request.offset();
|
||||
set_target_value_at(isolate, pc,
|
||||
reinterpret_cast<uint32_t>(object.location()));
|
||||
set_target_value_at(pc, reinterpret_cast<uint32_t>(object.location()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -3898,11 +3895,8 @@ void Assembler::QuietNaN(HeapObject* object) {
|
||||
// There is an optimization below, which emits a nop when the address
|
||||
// fits in just 16 bits. This is unlikely to help, and should be benchmarked,
|
||||
// and possibly removed.
|
||||
void Assembler::set_target_value_at(Isolate* isolate, Address pc,
|
||||
uint32_t target,
|
||||
void Assembler::set_target_value_at(Address pc, uint32_t target,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK_IMPLIES(isolate == nullptr, icache_flush_mode == SKIP_ICACHE_FLUSH);
|
||||
|
||||
Instr instr2 = instr_at(pc + kInstrSize);
|
||||
uint32_t rt_code = GetRtField(instr2);
|
||||
uint32_t* p = reinterpret_cast<uint32_t*>(pc);
|
||||
|
@ -567,9 +567,9 @@ class Assembler : public AssemblerBase {
|
||||
// The isolate argument is unused (and may be nullptr) when skipping flushing.
|
||||
static Address target_address_at(Address pc);
|
||||
INLINE(static void set_target_address_at)
|
||||
(Isolate* isolate, Address pc, Address target,
|
||||
(Address pc, Address target,
|
||||
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED) {
|
||||
set_target_value_at(isolate, pc, reinterpret_cast<uint32_t>(target),
|
||||
set_target_value_at(pc, reinterpret_cast<uint32_t>(target),
|
||||
icache_flush_mode);
|
||||
}
|
||||
// On MIPS there is no Constant Pool so we skip that parameter.
|
||||
@ -577,13 +577,13 @@ class Assembler : public AssemblerBase {
|
||||
return target_address_at(pc);
|
||||
}
|
||||
INLINE(static void set_target_address_at(
|
||||
Isolate* isolate, Address pc, Address constant_pool, Address target,
|
||||
Address pc, Address constant_pool, Address target,
|
||||
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED)) {
|
||||
set_target_address_at(isolate, pc, target, icache_flush_mode);
|
||||
set_target_address_at(pc, target, icache_flush_mode);
|
||||
}
|
||||
|
||||
static void set_target_value_at(
|
||||
Isolate* isolate, Address pc, uint32_t target,
|
||||
Address pc, uint32_t target,
|
||||
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED);
|
||||
|
||||
// Return the code target address at a call site from the return address
|
||||
@ -596,12 +596,11 @@ class Assembler : public AssemblerBase {
|
||||
// This is for calls and branches within generated code. The serializer
|
||||
// has already deserialized the lui/ori instructions etc.
|
||||
inline static void deserialization_set_special_target_at(
|
||||
Isolate* isolate, Address instruction_payload, Code* code,
|
||||
Address target);
|
||||
Address instruction_payload, Code* code, Address target);
|
||||
|
||||
// This sets the internal reference at the pc.
|
||||
inline static void deserialization_set_target_internal_reference_at(
|
||||
Isolate* isolate, Address pc, Address target,
|
||||
Address pc, Address target,
|
||||
RelocInfo::Mode mode = RelocInfo::INTERNAL_REFERENCE);
|
||||
|
||||
// Size of an instruction.
|
||||
|
@ -119,9 +119,9 @@ Address Assembler::target_address_from_return_address(Address pc) {
|
||||
}
|
||||
|
||||
void Assembler::deserialization_set_special_target_at(
|
||||
Isolate* isolate, Address instruction_payload, Code* code, Address target) {
|
||||
Address instruction_payload, Code* code, Address target) {
|
||||
set_target_address_at(
|
||||
isolate, instruction_payload - kInstructionsFor64BitConstant * kInstrSize,
|
||||
instruction_payload - kInstructionsFor64BitConstant * kInstrSize,
|
||||
code ? code->constant_pool() : nullptr, target);
|
||||
}
|
||||
|
||||
@ -142,9 +142,8 @@ void Assembler::set_target_internal_reference_encoded_at(Address pc,
|
||||
// after complete deserialization, no need to flush on each reference.
|
||||
}
|
||||
|
||||
|
||||
void Assembler::deserialization_set_target_internal_reference_at(
|
||||
Isolate* isolate, Address pc, Address target, RelocInfo::Mode mode) {
|
||||
Address pc, Address target, RelocInfo::Mode mode) {
|
||||
if (mode == RelocInfo::INTERNAL_REFERENCE_ENCODED) {
|
||||
DCHECK(IsJ(instr_at(pc)));
|
||||
set_target_internal_reference_encoded_at(pc, target);
|
||||
@ -170,7 +169,7 @@ void RelocInfo::set_target_object(HeapObject* target,
|
||||
WriteBarrierMode write_barrier_mode,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
|
||||
Assembler::set_target_address_at(target->GetIsolate(), pc_, constant_pool_,
|
||||
Assembler::set_target_address_at(pc_, constant_pool_,
|
||||
reinterpret_cast<Address>(target),
|
||||
icache_flush_mode);
|
||||
if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != nullptr &&
|
||||
@ -215,15 +214,15 @@ Address RelocInfo::target_runtime_entry(Assembler* origin) {
|
||||
return target_address();
|
||||
}
|
||||
|
||||
void RelocInfo::set_target_runtime_entry(Isolate* isolate, Address target,
|
||||
void RelocInfo::set_target_runtime_entry(Address target,
|
||||
WriteBarrierMode write_barrier_mode,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(IsRuntimeEntry(rmode_));
|
||||
if (target_address() != target)
|
||||
set_target_address(isolate, target, write_barrier_mode, icache_flush_mode);
|
||||
set_target_address(target, write_barrier_mode, icache_flush_mode);
|
||||
}
|
||||
|
||||
void RelocInfo::WipeOut(Isolate* isolate) {
|
||||
void RelocInfo::WipeOut() {
|
||||
DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) ||
|
||||
IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) ||
|
||||
IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_));
|
||||
@ -232,7 +231,7 @@ void RelocInfo::WipeOut(Isolate* isolate) {
|
||||
} else if (IsInternalReferenceEncoded(rmode_)) {
|
||||
Assembler::set_target_internal_reference_encoded_at(pc_, nullptr);
|
||||
} else {
|
||||
Assembler::set_target_address_at(isolate, pc_, constant_pool_, nullptr);
|
||||
Assembler::set_target_address_at(pc_, constant_pool_, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -187,22 +187,20 @@ uint32_t RelocInfo::embedded_size() const {
|
||||
(Assembler::target_address_at(pc_, constant_pool_))));
|
||||
}
|
||||
|
||||
void RelocInfo::set_embedded_address(Isolate* isolate, Address address,
|
||||
void RelocInfo::set_embedded_address(Address address,
|
||||
ICacheFlushMode flush_mode) {
|
||||
Assembler::set_target_address_at(isolate, pc_, constant_pool_, address,
|
||||
flush_mode);
|
||||
Assembler::set_target_address_at(pc_, constant_pool_, address, flush_mode);
|
||||
}
|
||||
|
||||
void RelocInfo::set_embedded_size(Isolate* isolate, uint32_t size,
|
||||
ICacheFlushMode flush_mode) {
|
||||
Assembler::set_target_address_at(isolate, pc_, constant_pool_,
|
||||
void RelocInfo::set_embedded_size(uint32_t size, ICacheFlushMode flush_mode) {
|
||||
Assembler::set_target_address_at(pc_, constant_pool_,
|
||||
reinterpret_cast<Address>(size), flush_mode);
|
||||
}
|
||||
|
||||
void RelocInfo::set_js_to_wasm_address(Isolate* isolate, Address address,
|
||||
void RelocInfo::set_js_to_wasm_address(Address address,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK_EQ(rmode_, JS_TO_WASM_CALL);
|
||||
set_embedded_address(isolate, address, icache_flush_mode);
|
||||
set_embedded_address(address, icache_flush_mode);
|
||||
}
|
||||
|
||||
Address RelocInfo::js_to_wasm_address() const {
|
||||
@ -260,8 +258,7 @@ void Assembler::AllocateAndInstallRequestedHeapObjects(Isolate* isolate) {
|
||||
break;
|
||||
}
|
||||
Address pc = buffer_ + request.offset();
|
||||
set_target_value_at(isolate, pc,
|
||||
reinterpret_cast<uint64_t>(object.location()));
|
||||
set_target_value_at(pc, reinterpret_cast<uint64_t>(object.location()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -4226,8 +4223,7 @@ void Assembler::QuietNaN(HeapObject* object) {
|
||||
// There is an optimization below, which emits a nop when the address
|
||||
// fits in just 16 bits. This is unlikely to help, and should be benchmarked,
|
||||
// and possibly removed.
|
||||
void Assembler::set_target_value_at(Isolate* isolate, Address pc,
|
||||
uint64_t target,
|
||||
void Assembler::set_target_value_at(Address pc, uint64_t target,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
// There is an optimization where only 4 instructions are used to load address
|
||||
// in code on MIP64 because only 48-bits of address is effectively used.
|
||||
|
@ -575,9 +575,9 @@ class Assembler : public AssemblerBase {
|
||||
// The isolate argument is unused (and may be nullptr) when skipping flushing.
|
||||
static Address target_address_at(Address pc);
|
||||
INLINE(static void set_target_address_at(
|
||||
Isolate* isolate, Address pc, Address target,
|
||||
Address pc, Address target,
|
||||
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED)) {
|
||||
set_target_value_at(isolate, pc, reinterpret_cast<uint64_t>(target),
|
||||
set_target_value_at(pc, reinterpret_cast<uint64_t>(target),
|
||||
icache_flush_mode);
|
||||
}
|
||||
// On MIPS there is no Constant Pool so we skip that parameter.
|
||||
@ -585,13 +585,13 @@ class Assembler : public AssemblerBase {
|
||||
return target_address_at(pc);
|
||||
}
|
||||
INLINE(static void set_target_address_at(
|
||||
Isolate* isolate, Address pc, Address constant_pool, Address target,
|
||||
Address pc, Address constant_pool, Address target,
|
||||
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED)) {
|
||||
set_target_address_at(isolate, pc, target, icache_flush_mode);
|
||||
set_target_address_at(pc, target, icache_flush_mode);
|
||||
}
|
||||
|
||||
static void set_target_value_at(
|
||||
Isolate* isolate, Address pc, uint64_t target,
|
||||
Address pc, uint64_t target,
|
||||
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED);
|
||||
|
||||
// Return the code target address at a call site from the return address
|
||||
@ -606,12 +606,11 @@ class Assembler : public AssemblerBase {
|
||||
// This is for calls and branches within generated code. The serializer
|
||||
// has already deserialized the lui/ori instructions etc.
|
||||
inline static void deserialization_set_special_target_at(
|
||||
Isolate* isolate, Address instruction_payload, Code* code,
|
||||
Address target);
|
||||
Address instruction_payload, Code* code, Address target);
|
||||
|
||||
// This sets the internal reference at the pc.
|
||||
inline static void deserialization_set_target_internal_reference_at(
|
||||
Isolate* isolate, Address pc, Address target,
|
||||
Address pc, Address target,
|
||||
RelocInfo::Mode mode = RelocInfo::INTERNAL_REFERENCE);
|
||||
|
||||
// Size of an instruction.
|
||||
|
@ -14066,12 +14066,12 @@ void Code::CopyFrom(const CodeDesc& desc) {
|
||||
// code object
|
||||
Handle<Object> p = it.rinfo()->target_object_handle(origin);
|
||||
Code* code = Code::cast(*p);
|
||||
it.rinfo()->set_target_address(GetIsolate(), code->instruction_start(),
|
||||
it.rinfo()->set_target_address(code->instruction_start(),
|
||||
UPDATE_WRITE_BARRIER, SKIP_ICACHE_FLUSH);
|
||||
} else if (RelocInfo::IsRuntimeEntry(mode)) {
|
||||
Address p = it.rinfo()->target_runtime_entry(origin);
|
||||
it.rinfo()->set_target_runtime_entry(
|
||||
GetIsolate(), p, UPDATE_WRITE_BARRIER, SKIP_ICACHE_FLUSH);
|
||||
it.rinfo()->set_target_runtime_entry(p, UPDATE_WRITE_BARRIER,
|
||||
SKIP_ICACHE_FLUSH);
|
||||
} else {
|
||||
intptr_t delta = instruction_start() - desc.buffer;
|
||||
it.rinfo()->apply(delta);
|
||||
|
@ -60,8 +60,8 @@ void RelocInfo::apply(intptr_t delta) {
|
||||
// mov sequence
|
||||
DCHECK(IsInternalReferenceEncoded(rmode_));
|
||||
Address target = Assembler::target_address_at(pc_, constant_pool_);
|
||||
Assembler::set_target_address_at(nullptr, pc_, constant_pool_,
|
||||
target + delta, SKIP_ICACHE_FLUSH);
|
||||
Assembler::set_target_address_at(pc_, constant_pool_, target + delta,
|
||||
SKIP_ICACHE_FLUSH);
|
||||
}
|
||||
}
|
||||
|
||||
@ -176,7 +176,7 @@ void RelocInfo::set_target_object(HeapObject* target,
|
||||
WriteBarrierMode write_barrier_mode,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
|
||||
Assembler::set_target_address_at(target->GetIsolate(), pc_, constant_pool_,
|
||||
Assembler::set_target_address_at(pc_, constant_pool_,
|
||||
reinterpret_cast<Address>(target),
|
||||
icache_flush_mode);
|
||||
if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != nullptr) {
|
||||
@ -198,15 +198,15 @@ Address RelocInfo::target_runtime_entry(Assembler* origin) {
|
||||
return target_address();
|
||||
}
|
||||
|
||||
void RelocInfo::set_target_runtime_entry(Isolate* isolate, Address target,
|
||||
void RelocInfo::set_target_runtime_entry(Address target,
|
||||
WriteBarrierMode write_barrier_mode,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(IsRuntimeEntry(rmode_));
|
||||
if (target_address() != target)
|
||||
set_target_address(isolate, target, write_barrier_mode, icache_flush_mode);
|
||||
set_target_address(target, write_barrier_mode, icache_flush_mode);
|
||||
}
|
||||
|
||||
void RelocInfo::WipeOut(Isolate* isolate) {
|
||||
void RelocInfo::WipeOut() {
|
||||
DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) ||
|
||||
IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) ||
|
||||
IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_));
|
||||
@ -216,10 +216,10 @@ void RelocInfo::WipeOut(Isolate* isolate) {
|
||||
} else if (IsInternalReferenceEncoded(rmode_)) {
|
||||
// mov sequence
|
||||
// Currently used only by deserializer, no need to flush.
|
||||
Assembler::set_target_address_at(isolate, pc_, constant_pool_, nullptr,
|
||||
Assembler::set_target_address_at(pc_, constant_pool_, nullptr,
|
||||
SKIP_ICACHE_FLUSH);
|
||||
} else {
|
||||
Assembler::set_target_address_at(isolate, pc_, constant_pool_, nullptr);
|
||||
Assembler::set_target_address_at(pc_, constant_pool_, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -413,16 +413,15 @@ Address Assembler::target_constant_pool_address_at(
|
||||
// has already deserialized the mov instructions etc.
|
||||
// There is a FIXED_SEQUENCE assumption here
|
||||
void Assembler::deserialization_set_special_target_at(
|
||||
Isolate* isolate, Address instruction_payload, Code* code, Address target) {
|
||||
set_target_address_at(isolate, instruction_payload,
|
||||
Address instruction_payload, Code* code, Address target) {
|
||||
set_target_address_at(instruction_payload,
|
||||
code ? code->constant_pool() : nullptr, target);
|
||||
}
|
||||
|
||||
|
||||
void Assembler::deserialization_set_target_internal_reference_at(
|
||||
Isolate* isolate, Address pc, Address target, RelocInfo::Mode mode) {
|
||||
Address pc, Address target, RelocInfo::Mode mode) {
|
||||
if (RelocInfo::IsInternalReferenceEncoded(mode)) {
|
||||
set_target_address_at(isolate, pc, nullptr, target, SKIP_ICACHE_FLUSH);
|
||||
set_target_address_at(pc, nullptr, target, SKIP_ICACHE_FLUSH);
|
||||
} else {
|
||||
Memory::Address_at(pc) = target;
|
||||
}
|
||||
@ -430,11 +429,9 @@ void Assembler::deserialization_set_target_internal_reference_at(
|
||||
|
||||
|
||||
// This code assumes the FIXED_SEQUENCE of lis/ori
|
||||
void Assembler::set_target_address_at(Isolate* isolate, Address pc,
|
||||
Address constant_pool, Address target,
|
||||
void Assembler::set_target_address_at(Address pc, Address constant_pool,
|
||||
Address target,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK_IMPLIES(isolate == nullptr, icache_flush_mode == SKIP_ICACHE_FLUSH);
|
||||
|
||||
if (FLAG_enable_embedded_constant_pool && constant_pool) {
|
||||
ConstantPoolEntry::Access access;
|
||||
if (IsConstantPoolLoadStart(pc, &access)) {
|
||||
|
@ -170,22 +170,20 @@ uint32_t RelocInfo::embedded_size() const {
|
||||
Assembler::target_address_at(pc_, constant_pool_)));
|
||||
}
|
||||
|
||||
void RelocInfo::set_embedded_address(Isolate* isolate, Address address,
|
||||
void RelocInfo::set_embedded_address(Address address,
|
||||
ICacheFlushMode flush_mode) {
|
||||
Assembler::set_target_address_at(isolate, pc_, constant_pool_, address,
|
||||
flush_mode);
|
||||
Assembler::set_target_address_at(pc_, constant_pool_, address, flush_mode);
|
||||
}
|
||||
|
||||
void RelocInfo::set_embedded_size(Isolate* isolate, uint32_t size,
|
||||
ICacheFlushMode flush_mode) {
|
||||
Assembler::set_target_address_at(isolate, pc_, constant_pool_,
|
||||
void RelocInfo::set_embedded_size(uint32_t size, ICacheFlushMode flush_mode) {
|
||||
Assembler::set_target_address_at(pc_, constant_pool_,
|
||||
reinterpret_cast<Address>(size), flush_mode);
|
||||
}
|
||||
|
||||
void RelocInfo::set_js_to_wasm_address(Isolate* isolate, Address address,
|
||||
void RelocInfo::set_js_to_wasm_address(Address address,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK_EQ(rmode_, JS_TO_WASM_CALL);
|
||||
set_embedded_address(isolate, address, icache_flush_mode);
|
||||
set_embedded_address(address, icache_flush_mode);
|
||||
}
|
||||
|
||||
Address RelocInfo::js_to_wasm_address() const {
|
||||
@ -240,7 +238,7 @@ void Assembler::AllocateAndInstallRequestedHeapObjects(Isolate* isolate) {
|
||||
}
|
||||
Address pc = buffer_ + request.offset();
|
||||
Address constant_pool = nullptr;
|
||||
set_target_address_at(nullptr, pc, constant_pool,
|
||||
set_target_address_at(pc, constant_pool,
|
||||
reinterpret_cast<Address>(object.location()),
|
||||
SKIP_ICACHE_FLUSH);
|
||||
}
|
||||
@ -2093,8 +2091,7 @@ void Assembler::EmitRelocations() {
|
||||
} else if (RelocInfo::IsInternalReferenceEncoded(rmode)) {
|
||||
// mov sequence
|
||||
intptr_t pos = reinterpret_cast<intptr_t>(target_address_at(pc, nullptr));
|
||||
set_target_address_at(nullptr, pc, nullptr, buffer_ + pos,
|
||||
SKIP_ICACHE_FLUSH);
|
||||
set_target_address_at(pc, nullptr, buffer_ + pos, SKIP_ICACHE_FLUSH);
|
||||
}
|
||||
|
||||
reloc_info_writer.Write(&rinfo);
|
||||
|
@ -575,7 +575,7 @@ class Assembler : public AssemblerBase {
|
||||
// The isolate argument is unused (and may be nullptr) when skipping flushing.
|
||||
INLINE(static Address target_address_at(Address pc, Address constant_pool));
|
||||
INLINE(static void set_target_address_at(
|
||||
Isolate* isolate, Address pc, Address constant_pool, Address target,
|
||||
Address pc, Address constant_pool, Address target,
|
||||
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED));
|
||||
|
||||
// Return the code target address at a call site from the return address
|
||||
@ -589,12 +589,11 @@ class Assembler : public AssemblerBase {
|
||||
// This sets the branch destination.
|
||||
// This is for calls and branches within generated code.
|
||||
inline static void deserialization_set_special_target_at(
|
||||
Isolate* isolate, Address instruction_payload, Code* code,
|
||||
Address target);
|
||||
Address instruction_payload, Code* code, Address target);
|
||||
|
||||
// This sets the internal reference at the pc.
|
||||
inline static void deserialization_set_target_internal_reference_at(
|
||||
Isolate* isolate, Address pc, Address target,
|
||||
Address pc, Address target,
|
||||
RelocInfo::Mode mode = RelocInfo::INTERNAL_REFERENCE);
|
||||
|
||||
// Size of an instruction.
|
||||
|
@ -70,8 +70,8 @@ void RelocInfo::apply(intptr_t delta) {
|
||||
// mov sequence
|
||||
DCHECK(IsInternalReferenceEncoded(rmode_));
|
||||
Address target = Assembler::target_address_at(pc_, constant_pool_);
|
||||
Assembler::set_target_address_at(nullptr, pc_, constant_pool_,
|
||||
target + delta, SKIP_ICACHE_FLUSH);
|
||||
Assembler::set_target_address_at(pc_, constant_pool_, target + delta,
|
||||
SKIP_ICACHE_FLUSH);
|
||||
}
|
||||
}
|
||||
|
||||
@ -159,7 +159,7 @@ void RelocInfo::set_target_object(HeapObject* target,
|
||||
WriteBarrierMode write_barrier_mode,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
|
||||
Assembler::set_target_address_at(target->GetIsolate(), pc_, constant_pool_,
|
||||
Assembler::set_target_address_at(pc_, constant_pool_,
|
||||
reinterpret_cast<Address>(target),
|
||||
icache_flush_mode);
|
||||
if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != nullptr) {
|
||||
@ -179,15 +179,15 @@ Address RelocInfo::target_runtime_entry(Assembler* origin) {
|
||||
return target_address();
|
||||
}
|
||||
|
||||
void RelocInfo::set_target_runtime_entry(Isolate* isolate, Address target,
|
||||
void RelocInfo::set_target_runtime_entry(Address target,
|
||||
WriteBarrierMode write_barrier_mode,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(IsRuntimeEntry(rmode_));
|
||||
if (target_address() != target)
|
||||
set_target_address(isolate, target, write_barrier_mode, icache_flush_mode);
|
||||
set_target_address(target, write_barrier_mode, icache_flush_mode);
|
||||
}
|
||||
|
||||
void RelocInfo::WipeOut(Isolate* isolate) {
|
||||
void RelocInfo::WipeOut() {
|
||||
DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) ||
|
||||
IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) ||
|
||||
IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_));
|
||||
@ -197,10 +197,10 @@ void RelocInfo::WipeOut(Isolate* isolate) {
|
||||
} else if (IsInternalReferenceEncoded(rmode_)) {
|
||||
// mov sequence
|
||||
// Currently used only by deserializer, no need to flush.
|
||||
Assembler::set_target_address_at(isolate, pc_, constant_pool_, nullptr,
|
||||
Assembler::set_target_address_at(pc_, constant_pool_, nullptr,
|
||||
SKIP_ICACHE_FLUSH);
|
||||
} else {
|
||||
Assembler::set_target_address_at(isolate, pc_, constant_pool_, nullptr);
|
||||
Assembler::set_target_address_at(pc_, constant_pool_, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -281,26 +281,24 @@ Address Assembler::target_address_at(Address pc, Address constant_pool) {
|
||||
// has already deserialized the mov instructions etc.
|
||||
// There is a FIXED_SEQUENCE assumption here
|
||||
void Assembler::deserialization_set_special_target_at(
|
||||
Isolate* isolate, Address instruction_payload, Code* code, Address target) {
|
||||
set_target_address_at(isolate, instruction_payload,
|
||||
Address instruction_payload, Code* code, Address target) {
|
||||
set_target_address_at(instruction_payload,
|
||||
code ? code->constant_pool() : nullptr, target);
|
||||
}
|
||||
|
||||
void Assembler::deserialization_set_target_internal_reference_at(
|
||||
Isolate* isolate, Address pc, Address target, RelocInfo::Mode mode) {
|
||||
Address pc, Address target, RelocInfo::Mode mode) {
|
||||
if (RelocInfo::IsInternalReferenceEncoded(mode)) {
|
||||
set_target_address_at(isolate, pc, nullptr, target, SKIP_ICACHE_FLUSH);
|
||||
set_target_address_at(pc, nullptr, target, SKIP_ICACHE_FLUSH);
|
||||
} else {
|
||||
Memory::Address_at(pc) = target;
|
||||
}
|
||||
}
|
||||
|
||||
// This code assumes the FIXED_SEQUENCE of IIHF/IILF
|
||||
void Assembler::set_target_address_at(Isolate* isolate, Address pc,
|
||||
Address constant_pool, Address target,
|
||||
void Assembler::set_target_address_at(Address pc, Address constant_pool,
|
||||
Address target,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK_IMPLIES(isolate == nullptr, icache_flush_mode == SKIP_ICACHE_FLUSH);
|
||||
|
||||
// Check for instructions generated by Asm::mov()
|
||||
Opcode op1 = Instruction::S390OpcodeValue(reinterpret_cast<const byte*>(pc));
|
||||
SixByteInstr instr_1 =
|
||||
|
@ -279,22 +279,20 @@ uint32_t RelocInfo::embedded_size() const {
|
||||
Assembler::target_address_at(pc_, constant_pool_)));
|
||||
}
|
||||
|
||||
void RelocInfo::set_embedded_address(Isolate* isolate, Address address,
|
||||
void RelocInfo::set_embedded_address(Address address,
|
||||
ICacheFlushMode flush_mode) {
|
||||
Assembler::set_target_address_at(isolate, pc_, constant_pool_, address,
|
||||
flush_mode);
|
||||
Assembler::set_target_address_at(pc_, constant_pool_, address, flush_mode);
|
||||
}
|
||||
|
||||
void RelocInfo::set_embedded_size(Isolate* isolate, uint32_t size,
|
||||
ICacheFlushMode flush_mode) {
|
||||
Assembler::set_target_address_at(isolate, pc_, constant_pool_,
|
||||
void RelocInfo::set_embedded_size(uint32_t size, ICacheFlushMode flush_mode) {
|
||||
Assembler::set_target_address_at(pc_, constant_pool_,
|
||||
reinterpret_cast<Address>(size), flush_mode);
|
||||
}
|
||||
|
||||
void RelocInfo::set_js_to_wasm_address(Isolate* isolate, Address address,
|
||||
void RelocInfo::set_js_to_wasm_address(Address address,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK_EQ(rmode_, JS_TO_WASM_CALL);
|
||||
set_embedded_address(isolate, address, icache_flush_mode);
|
||||
set_embedded_address(address, icache_flush_mode);
|
||||
}
|
||||
|
||||
Address RelocInfo::js_to_wasm_address() const {
|
||||
@ -336,7 +334,7 @@ void Assembler::AllocateAndInstallRequestedHeapObjects(Isolate* isolate) {
|
||||
case HeapObjectRequest::kHeapNumber:
|
||||
object = isolate->factory()->NewHeapNumber(request.heap_number(),
|
||||
IMMUTABLE, TENURED);
|
||||
set_target_address_at(nullptr, pc, static_cast<Address>(nullptr),
|
||||
set_target_address_at(pc, static_cast<Address>(nullptr),
|
||||
reinterpret_cast<Address>(object.location()),
|
||||
SKIP_ICACHE_FLUSH);
|
||||
break;
|
||||
@ -2224,8 +2222,7 @@ void Assembler::EmitRelocations() {
|
||||
} else if (RelocInfo::IsInternalReferenceEncoded(rmode)) {
|
||||
// mov sequence
|
||||
intptr_t pos = reinterpret_cast<intptr_t>(target_address_at(pc, nullptr));
|
||||
set_target_address_at(nullptr, pc, nullptr, buffer_ + pos,
|
||||
SKIP_ICACHE_FLUSH);
|
||||
set_target_address_at(pc, nullptr, buffer_ + pos, SKIP_ICACHE_FLUSH);
|
||||
}
|
||||
|
||||
reloc_info_writer.Write(&rinfo);
|
||||
|
@ -549,7 +549,7 @@ class Assembler : public AssemblerBase {
|
||||
// The isolate argument is unused (and may be nullptr) when skipping flushing.
|
||||
INLINE(static Address target_address_at(Address pc, Address constant_pool));
|
||||
INLINE(static void set_target_address_at(
|
||||
Isolate* isolate, Address pc, Address constant_pool, Address target,
|
||||
Address pc, Address constant_pool, Address target,
|
||||
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED));
|
||||
|
||||
// Return the code target address at a call site from the return address
|
||||
@ -564,12 +564,11 @@ class Assembler : public AssemblerBase {
|
||||
// This sets the branch destination.
|
||||
// This is for calls and branches within generated code.
|
||||
inline static void deserialization_set_special_target_at(
|
||||
Isolate* isolate, Address instruction_payload, Code* code,
|
||||
Address target);
|
||||
Address instruction_payload, Code* code, Address target);
|
||||
|
||||
// This sets the internal reference at the pc.
|
||||
inline static void deserialization_set_target_internal_reference_at(
|
||||
Isolate* isolate, Address pc, Address target,
|
||||
Address pc, Address target,
|
||||
RelocInfo::Mode mode = RelocInfo::INTERNAL_REFERENCE);
|
||||
|
||||
// Here we are patching the address in the IIHF/IILF instruction pair.
|
||||
|
@ -480,9 +480,9 @@ bool Deserializer<AllocatorT>::ReadData(Object** current, Object** limit,
|
||||
Address pc = code->entry() + pc_offset;
|
||||
Address target = code->entry() + target_offset;
|
||||
Assembler::deserialization_set_target_internal_reference_at(
|
||||
isolate, pc, target, data == kInternalReference
|
||||
? RelocInfo::INTERNAL_REFERENCE
|
||||
: RelocInfo::INTERNAL_REFERENCE_ENCODED);
|
||||
pc, target,
|
||||
data == kInternalReference ? RelocInfo::INTERNAL_REFERENCE
|
||||
: RelocInfo::INTERNAL_REFERENCE_ENCODED);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -746,7 +746,7 @@ Object** Deserializer<AllocatorT>::ReadDataCase(Isolate* isolate,
|
||||
if (how == kFromCode) {
|
||||
Address location_of_branch_data = reinterpret_cast<Address>(current);
|
||||
Assembler::deserialization_set_special_target_at(
|
||||
isolate, location_of_branch_data,
|
||||
location_of_branch_data,
|
||||
Code::cast(HeapObject::FromAddress(current_object_address)),
|
||||
reinterpret_cast<Address>(new_object));
|
||||
location_of_branch_data += Assembler::kSpecialTargetSize;
|
||||
|
@ -885,7 +885,7 @@ void Serializer<AllocatorT>::ObjectSerializer::OutputCode(int size) {
|
||||
RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE_ENCODED);
|
||||
for (RelocIterator it(code, mode_mask); !it.done(); it.next()) {
|
||||
RelocInfo* rinfo = it.rinfo();
|
||||
rinfo->WipeOut(serializer_->isolate());
|
||||
rinfo->WipeOut();
|
||||
}
|
||||
// We need to wipe out the header fields *after* wiping out the
|
||||
// relocations, because some of these fields are needed for the latter.
|
||||
|
@ -262,7 +262,7 @@ class JSToWasmWrapperCache {
|
||||
target->builtin_index() == Builtins::kIllegal ||
|
||||
target->builtin_index() == Builtins::kWasmCompileLazy) {
|
||||
it.rinfo()->set_target_address(
|
||||
isolate, wasm_code.GetCode()->instruction_start());
|
||||
wasm_code.GetCode()->instruction_start());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -271,9 +271,9 @@ class JSToWasmWrapperCache {
|
||||
RelocInfo::ModeMask(RelocInfo::JS_TO_WASM_CALL));
|
||||
DCHECK(!it.done());
|
||||
it.rinfo()->set_js_to_wasm_address(
|
||||
isolate, wasm_code.is_null()
|
||||
? nullptr
|
||||
: wasm_code.GetWasmCode()->instructions().start());
|
||||
wasm_code.is_null()
|
||||
? nullptr
|
||||
: wasm_code.GetWasmCode()->instructions().start());
|
||||
}
|
||||
return code;
|
||||
}
|
||||
@ -862,8 +862,7 @@ const WasmCode* WasmExtractWasmToWasmCallee(const WasmCodeManager* code_manager,
|
||||
->code_manager() \
|
||||
->GetCodeFromStartAddress(it.rinfo()->js_to_wasm_address()) \
|
||||
->kind()); \
|
||||
it.rinfo()->set_js_to_wasm_address(isolate, \
|
||||
new_target->instructions().start()); \
|
||||
it.rinfo()->set_js_to_wasm_address(new_target->instructions().start()); \
|
||||
it.next(); \
|
||||
DCHECK(it.done()); \
|
||||
} while (0)
|
||||
@ -877,7 +876,7 @@ void PatchWasmToWasmWrapper(Isolate* isolate, Code* wasm_to_wasm,
|
||||
DCHECK_EQ(Builtins::kWasmCompileLazy,
|
||||
Code::GetCodeFromTargetAddress(it.rinfo()->target_address())
|
||||
->builtin_index());
|
||||
it.rinfo()->set_target_address(isolate, new_target->instruction_start());
|
||||
it.rinfo()->set_target_address(new_target->instruction_start());
|
||||
#ifdef DEBUG
|
||||
it.next();
|
||||
DCHECK(it.done());
|
||||
@ -1022,8 +1021,7 @@ Handle<Code> LazyCompilationOrchestrator::CompileLazyOnGCHeap(
|
||||
continue;
|
||||
}
|
||||
DCHECK_EQ(Code::WASM_FUNCTION, callee_compiled->kind());
|
||||
it.rinfo()->set_target_address(isolate,
|
||||
callee_compiled->instruction_start());
|
||||
it.rinfo()->set_target_address(callee_compiled->instruction_start());
|
||||
++patched;
|
||||
}
|
||||
DCHECK_EQ(non_compiled_functions.size(), idx);
|
||||
@ -1070,7 +1068,7 @@ const wasm::WasmCode* LazyCompilationOrchestrator::CompileFromJsToWasm(
|
||||
->GetCodeFromStartAddress(it.rinfo()->js_to_wasm_address())
|
||||
->kind());
|
||||
it.rinfo()->set_js_to_wasm_address(
|
||||
isolate, callee_compiled->instructions().start());
|
||||
callee_compiled->instructions().start());
|
||||
++patched;
|
||||
}
|
||||
DCHECK_LT(0, patched);
|
||||
@ -1212,7 +1210,7 @@ const wasm::WasmCode* LazyCompilationOrchestrator::CompileDirectCall(
|
||||
->GetCodeFromStartAddress(it.rinfo()->wasm_call_address())
|
||||
->kind());
|
||||
it.rinfo()->set_wasm_call_address(
|
||||
isolate, callee_compiled->instructions().start());
|
||||
callee_compiled->instructions().start());
|
||||
++patched;
|
||||
}
|
||||
DCHECK_EQ(non_compiled_functions.size(), idx);
|
||||
|
@ -70,7 +70,7 @@ void PatchTrampolineAndStubCalls(
|
||||
#else
|
||||
Address new_target = old_target;
|
||||
#endif
|
||||
it.rinfo()->set_target_address(nullptr, new_target, SKIP_WRITE_BARRIER,
|
||||
it.rinfo()->set_target_address(new_target, SKIP_WRITE_BARRIER,
|
||||
SKIP_ICACHE_FLUSH);
|
||||
}
|
||||
}
|
||||
@ -415,8 +415,7 @@ WasmCode* NativeModule::AddAnonymousCode(Handle<Code> code,
|
||||
if (RelocInfo::IsCodeTarget(it.rinfo()->rmode())) {
|
||||
Code* call_target =
|
||||
Code::GetCodeFromTargetAddress(orig_it.rinfo()->target_address());
|
||||
it.rinfo()->set_target_address(nullptr,
|
||||
GetLocalAddressFor(handle(call_target)),
|
||||
it.rinfo()->set_target_address(GetLocalAddressFor(handle(call_target)),
|
||||
SKIP_WRITE_BARRIER, SKIP_ICACHE_FLUSH);
|
||||
} else {
|
||||
if (RelocInfo::IsEmbeddedObject(it.rinfo()->rmode())) {
|
||||
@ -471,12 +470,12 @@ WasmCode* NativeModule::AddCode(
|
||||
// code object
|
||||
Handle<Object> p = it.rinfo()->target_object_handle(origin);
|
||||
Code* code = Code::cast(*p);
|
||||
it.rinfo()->set_target_address(nullptr, GetLocalAddressFor(handle(code)),
|
||||
it.rinfo()->set_target_address(GetLocalAddressFor(handle(code)),
|
||||
SKIP_WRITE_BARRIER, SKIP_ICACHE_FLUSH);
|
||||
} else if (RelocInfo::IsRuntimeEntry(mode)) {
|
||||
Address p = it.rinfo()->target_runtime_entry(origin);
|
||||
it.rinfo()->set_target_runtime_entry(
|
||||
origin->isolate(), p, SKIP_WRITE_BARRIER, SKIP_ICACHE_FLUSH);
|
||||
it.rinfo()->set_target_runtime_entry(p, SKIP_WRITE_BARRIER,
|
||||
SKIP_ICACHE_FLUSH);
|
||||
} else {
|
||||
intptr_t delta = ret->instructions().start() - desc.buffer;
|
||||
it.rinfo()->apply(delta);
|
||||
@ -564,7 +563,7 @@ void NativeModule::Link(uint32_t index) {
|
||||
if (target == nullptr) continue;
|
||||
Address target_addr = target->instructions().start();
|
||||
DCHECK_NOT_NULL(target);
|
||||
it.rinfo()->set_wasm_call_address(nullptr, target_addr,
|
||||
it.rinfo()->set_wasm_call_address(target_addr,
|
||||
ICacheFlushMode::SKIP_ICACHE_FLUSH);
|
||||
}
|
||||
}
|
||||
@ -1036,8 +1035,8 @@ void SetWasmCalleeTag(RelocInfo* rinfo, uint32_t tag) {
|
||||
#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32
|
||||
*(reinterpret_cast<uint32_t*>(rinfo->target_address_address())) = tag;
|
||||
#else
|
||||
rinfo->set_target_address(nullptr, reinterpret_cast<Address>(tag),
|
||||
SKIP_WRITE_BARRIER, SKIP_ICACHE_FLUSH);
|
||||
rinfo->set_target_address(reinterpret_cast<Address>(tag), SKIP_WRITE_BARRIER,
|
||||
SKIP_ICACHE_FLUSH);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -83,8 +83,7 @@ bool IsAtWasmDirectCallTarget(RelocIterator& it) {
|
||||
|
||||
} // namespace
|
||||
|
||||
CodeSpecialization::CodeSpecialization(Isolate* isolate, Zone* zone)
|
||||
: isolate_(isolate) {}
|
||||
CodeSpecialization::CodeSpecialization(Isolate* isolate, Zone* zone) {}
|
||||
|
||||
CodeSpecialization::~CodeSpecialization() {}
|
||||
|
||||
@ -172,24 +171,23 @@ bool CodeSpecialization::ApplyToWholeInstance(
|
||||
RelocInfo::Mode mode = it.rinfo()->rmode();
|
||||
switch (mode) {
|
||||
case RelocInfo::WASM_CONTEXT_REFERENCE:
|
||||
it.rinfo()->set_wasm_context_reference(export_wrapper->GetIsolate(),
|
||||
new_wasm_context_address_,
|
||||
it.rinfo()->set_wasm_context_reference(new_wasm_context_address_,
|
||||
icache_flush_mode);
|
||||
break;
|
||||
case RelocInfo::JS_TO_WASM_CALL: {
|
||||
DCHECK(FLAG_wasm_jit_to_native);
|
||||
const WasmCode* new_code = native_module->GetCode(exp.index);
|
||||
it.rinfo()->set_js_to_wasm_address(
|
||||
nullptr, new_code->instructions().start(), SKIP_ICACHE_FLUSH);
|
||||
it.rinfo()->set_js_to_wasm_address(new_code->instructions().start(),
|
||||
SKIP_ICACHE_FLUSH);
|
||||
} break;
|
||||
case RelocInfo::CODE_TARGET: {
|
||||
DCHECK(!FLAG_wasm_jit_to_native);
|
||||
// Ignore calls to other builtins like ToNumber.
|
||||
if (!IsAtWasmDirectCallTarget(it)) continue;
|
||||
Code* new_code = Code::cast(code_table->get(exp.index));
|
||||
it.rinfo()->set_target_address(
|
||||
new_code->GetIsolate(), new_code->instruction_start(),
|
||||
UPDATE_WRITE_BARRIER, SKIP_ICACHE_FLUSH);
|
||||
it.rinfo()->set_target_address(new_code->instruction_start(),
|
||||
UPDATE_WRITE_BARRIER,
|
||||
SKIP_ICACHE_FLUSH);
|
||||
} break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -266,8 +264,7 @@ bool CodeSpecialization::ApplyToWasmCode(WasmCodeWrapper code,
|
||||
FixedArray* code_table =
|
||||
relocate_direct_calls_instance_->compiled_module()->code_table();
|
||||
Code* new_code = Code::cast(code_table->get(called_func_index));
|
||||
it.rinfo()->set_target_address(new_code->GetIsolate(),
|
||||
new_code->instruction_start(),
|
||||
it.rinfo()->set_target_address(new_code->instruction_start(),
|
||||
UPDATE_WRITE_BARRIER, icache_flush_mode);
|
||||
changed = true;
|
||||
} break;
|
||||
@ -291,8 +288,8 @@ bool CodeSpecialization::ApplyToWasmCode(WasmCodeWrapper code,
|
||||
patch_direct_calls_helper->decoder,
|
||||
patch_direct_calls_helper->func_bytes + byte_pos);
|
||||
const WasmCode* new_code = native_module->GetCode(called_func_index);
|
||||
it.rinfo()->set_wasm_call_address(
|
||||
isolate_, new_code->instructions().start(), icache_flush_mode);
|
||||
it.rinfo()->set_wasm_call_address(new_code->instructions().start(),
|
||||
icache_flush_mode);
|
||||
changed = true;
|
||||
} break;
|
||||
case RelocInfo::WASM_GLOBAL_HANDLE: {
|
||||
@ -301,14 +298,14 @@ bool CodeSpecialization::ApplyToWasmCode(WasmCodeWrapper code,
|
||||
auto entry = pointers_to_relocate_.find(old_ptr);
|
||||
if (entry != pointers_to_relocate_.end()) {
|
||||
Address new_ptr = entry->second;
|
||||
it.rinfo()->set_global_handle(isolate_, new_ptr, icache_flush_mode);
|
||||
it.rinfo()->set_global_handle(new_ptr, icache_flush_mode);
|
||||
changed = true;
|
||||
}
|
||||
} break;
|
||||
case RelocInfo::WASM_FUNCTION_TABLE_SIZE_REFERENCE:
|
||||
DCHECK(patch_table_size);
|
||||
it.rinfo()->update_wasm_function_table_size_reference(
|
||||
isolate_, old_function_table_size_, new_function_table_size_,
|
||||
old_function_table_size_, new_function_table_size_,
|
||||
icache_flush_mode);
|
||||
changed = true;
|
||||
break;
|
||||
|
@ -47,7 +47,6 @@ class CodeSpecialization {
|
||||
ICacheFlushMode = FLUSH_ICACHE_IF_NEEDED);
|
||||
|
||||
private:
|
||||
Isolate* isolate_;
|
||||
Address new_wasm_context_address_ = 0;
|
||||
|
||||
uint32_t old_function_table_size_ = 0;
|
||||
|
@ -588,8 +588,7 @@ void RedirectCallsitesInCodeGC(Code* code, CodeRelocationMapGC& map) {
|
||||
Code* target = Code::GetCodeFromTargetAddress(it.rinfo()->target_address());
|
||||
Handle<Code>* new_target = map.Find(target);
|
||||
if (!new_target) continue;
|
||||
it.rinfo()->set_target_address(code->GetIsolate(),
|
||||
(*new_target)->instruction_start());
|
||||
it.rinfo()->set_target_address((*new_target)->instruction_start());
|
||||
}
|
||||
}
|
||||
|
||||
@ -603,7 +602,7 @@ void RedirectCallsitesInCode(Isolate* isolate, const wasm::WasmCode* code,
|
||||
Address target = it.rinfo()->target_address();
|
||||
auto new_target = map->find(target);
|
||||
if (new_target == map->end()) continue;
|
||||
it.rinfo()->set_wasm_call_address(isolate, new_target->second);
|
||||
it.rinfo()->set_wasm_call_address(new_target->second);
|
||||
}
|
||||
}
|
||||
|
||||
@ -615,7 +614,7 @@ void RedirectCallsitesInJSWrapperCode(Isolate* isolate, Code* code,
|
||||
Address target = it.rinfo()->js_to_wasm_address();
|
||||
auto new_target = map->find(target);
|
||||
if (new_target == map->end()) continue;
|
||||
it.rinfo()->set_js_to_wasm_address(isolate, new_target->second);
|
||||
it.rinfo()->set_js_to_wasm_address(new_target->second);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -633,7 +633,7 @@ bool NativeModuleDeserializer::ReadCode() {
|
||||
case RelocInfo::CODE_TARGET: {
|
||||
uint32_t tag = GetWasmCalleeTag(iter.rinfo());
|
||||
Address target = GetTrampolineOrStubFromTag(tag);
|
||||
iter.rinfo()->set_target_address(nullptr, target, SKIP_WRITE_BARRIER,
|
||||
iter.rinfo()->set_target_address(target, SKIP_WRITE_BARRIER,
|
||||
SKIP_ICACHE_FLUSH);
|
||||
break;
|
||||
}
|
||||
@ -642,8 +642,8 @@ bool NativeModuleDeserializer::ReadCode() {
|
||||
reinterpret_cast<intptr_t>(iter.rinfo()->target_address()));
|
||||
Address address =
|
||||
ExternalReferenceTable::instance(isolate_)->address(orig_target);
|
||||
iter.rinfo()->set_target_runtime_entry(
|
||||
nullptr, address, SKIP_WRITE_BARRIER, SKIP_ICACHE_FLUSH);
|
||||
iter.rinfo()->set_target_runtime_entry(address, SKIP_WRITE_BARRIER,
|
||||
SKIP_ICACHE_FLUSH);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -265,11 +265,9 @@ Address Assembler::target_address_at(Address pc, Address constant_pool) {
|
||||
return Memory::int32_at(pc) + pc + 4;
|
||||
}
|
||||
|
||||
|
||||
void Assembler::set_target_address_at(Isolate* isolate, Address pc,
|
||||
Address constant_pool, Address target,
|
||||
void Assembler::set_target_address_at(Address pc, Address constant_pool,
|
||||
Address target,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK_IMPLIES(isolate == nullptr, icache_flush_mode == SKIP_ICACHE_FLUSH);
|
||||
Memory::int32_at(pc) = static_cast<int32_t>(target - pc - 4);
|
||||
if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
|
||||
Assembler::FlushICache(pc, sizeof(int32_t));
|
||||
@ -277,7 +275,7 @@ void Assembler::set_target_address_at(Isolate* isolate, Address pc,
|
||||
}
|
||||
|
||||
void Assembler::deserialization_set_target_internal_reference_at(
|
||||
Isolate* isolate, Address pc, Address target, RelocInfo::Mode mode) {
|
||||
Address pc, Address target, RelocInfo::Mode mode) {
|
||||
Memory::Address_at(pc) = target;
|
||||
}
|
||||
|
||||
@ -287,8 +285,8 @@ Address Assembler::target_address_from_return_address(Address pc) {
|
||||
}
|
||||
|
||||
void Assembler::deserialization_set_special_target_at(
|
||||
Isolate* isolate, Address instruction_payload, Code* code, Address target) {
|
||||
set_target_address_at(isolate, instruction_payload,
|
||||
Address instruction_payload, Code* code, Address target) {
|
||||
set_target_address_at(instruction_payload,
|
||||
code ? code->constant_pool() : nullptr, target);
|
||||
}
|
||||
|
||||
@ -392,22 +390,22 @@ Address RelocInfo::target_runtime_entry(Assembler* origin) {
|
||||
return origin->runtime_entry_at(pc_);
|
||||
}
|
||||
|
||||
void RelocInfo::set_target_runtime_entry(Isolate* isolate, Address target,
|
||||
void RelocInfo::set_target_runtime_entry(Address target,
|
||||
WriteBarrierMode write_barrier_mode,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(IsRuntimeEntry(rmode_));
|
||||
if (target_address() != target) {
|
||||
set_target_address(isolate, target, write_barrier_mode, icache_flush_mode);
|
||||
set_target_address(target, write_barrier_mode, icache_flush_mode);
|
||||
}
|
||||
}
|
||||
|
||||
void RelocInfo::WipeOut(Isolate* isolate) {
|
||||
void RelocInfo::WipeOut() {
|
||||
if (IsEmbeddedObject(rmode_) || IsExternalReference(rmode_) ||
|
||||
IsInternalReference(rmode_)) {
|
||||
Memory::Address_at(pc_) = nullptr;
|
||||
} else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) {
|
||||
// Effectively write zero into the relocation.
|
||||
Assembler::set_target_address_at(isolate, pc_, constant_pool_,
|
||||
Assembler::set_target_address_at(pc_, constant_pool_,
|
||||
pc_ + sizeof(int32_t));
|
||||
} else {
|
||||
UNREACHABLE();
|
||||
|
@ -127,7 +127,7 @@ Address RelocInfo::embedded_address() const { return Memory::Address_at(pc_); }
|
||||
|
||||
uint32_t RelocInfo::embedded_size() const { return Memory::uint32_at(pc_); }
|
||||
|
||||
void RelocInfo::set_embedded_address(Isolate* isolate, Address address,
|
||||
void RelocInfo::set_embedded_address(Address address,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
Memory::Address_at(pc_) = address;
|
||||
if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
|
||||
@ -135,7 +135,7 @@ void RelocInfo::set_embedded_address(Isolate* isolate, Address address,
|
||||
}
|
||||
}
|
||||
|
||||
void RelocInfo::set_embedded_size(Isolate* isolate, uint32_t size,
|
||||
void RelocInfo::set_embedded_size(uint32_t size,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
Memory::uint32_at(pc_) = size;
|
||||
if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
|
||||
@ -143,10 +143,10 @@ void RelocInfo::set_embedded_size(Isolate* isolate, uint32_t size,
|
||||
}
|
||||
}
|
||||
|
||||
void RelocInfo::set_js_to_wasm_address(Isolate* isolate, Address address,
|
||||
void RelocInfo::set_js_to_wasm_address(Address address,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK_EQ(rmode_, JS_TO_WASM_CALL);
|
||||
set_embedded_address(isolate, address, icache_flush_mode);
|
||||
set_embedded_address(address, icache_flush_mode);
|
||||
}
|
||||
|
||||
Address RelocInfo::js_to_wasm_address() const {
|
||||
|
@ -475,7 +475,7 @@ class Assembler : public AssemblerBase {
|
||||
// The isolate argument is unused (and may be nullptr) when skipping flushing.
|
||||
static inline Address target_address_at(Address pc, Address constant_pool);
|
||||
static inline void set_target_address_at(
|
||||
Isolate* isolate, Address pc, Address constant_pool, Address target,
|
||||
Address pc, Address constant_pool, Address target,
|
||||
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED);
|
||||
|
||||
// Return the code target address at a call site from the return address
|
||||
@ -485,12 +485,11 @@ class Assembler : public AssemblerBase {
|
||||
// This sets the branch destination (which is in the instruction on x64).
|
||||
// This is for calls and branches within generated code.
|
||||
inline static void deserialization_set_special_target_at(
|
||||
Isolate* isolate, Address instruction_payload, Code* code,
|
||||
Address target);
|
||||
Address instruction_payload, Code* code, Address target);
|
||||
|
||||
// This sets the internal reference at the pc.
|
||||
inline static void deserialization_set_target_internal_reference_at(
|
||||
Isolate* isolate, Address pc, Address target,
|
||||
Address pc, Address target,
|
||||
RelocInfo::Mode mode = RelocInfo::INTERNAL_REFERENCE);
|
||||
|
||||
inline Handle<Code> code_target_object_handle_at(Address pc);
|
||||
|
@ -28,7 +28,7 @@ UnaryMathFunctionWithIsolate CreateSqrtFunction(Isolate* isolate) {
|
||||
|
||||
CodeDesc desc;
|
||||
masm.GetCode(isolate, &desc);
|
||||
DCHECK(!RelocInfo::RequiresRelocation(isolate, desc));
|
||||
DCHECK(!RelocInfo::RequiresRelocation(desc));
|
||||
|
||||
Assembler::FlushICache(buffer, allocated);
|
||||
CHECK(SetPermissions(buffer, allocated, PageAllocator::kReadExecute));
|
||||
|
@ -6916,7 +6916,7 @@ TEST(Regression6640) {
|
||||
// TODO(6792): No longer needed once WebAssembly code is off heap.
|
||||
CodeSpaceMemoryModificationScope modification_scope(code->GetHeap());
|
||||
it.rinfo()->update_wasm_function_table_size_reference(
|
||||
code->GetIsolate(), old_value, new_value, FLUSH_ICACHE_IF_NEEDED);
|
||||
old_value, new_value, FLUSH_ICACHE_IF_NEEDED);
|
||||
}
|
||||
|
||||
CHECK(m.Call());
|
||||
|
@ -32,8 +32,7 @@ static void UpdateFunctionTableSizeReferences(Handle<Code> code,
|
||||
for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) {
|
||||
RelocInfo::Mode mode = it.rinfo()->rmode();
|
||||
if (RelocInfo::IsWasmFunctionTableSizeReference(mode)) {
|
||||
it.rinfo()->update_wasm_function_table_size_reference(isolate, old_size,
|
||||
new_size);
|
||||
it.rinfo()->update_wasm_function_table_size_reference(old_size, new_size);
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
|
@ -59,8 +59,7 @@ TEST(WasmRelocationArmContextReference) {
|
||||
CodeSpaceMemoryModificationScope modification_scope(isolate->heap());
|
||||
DCHECK(RelocInfo::IsWasmContextReference(it.rinfo()->rmode()));
|
||||
it.rinfo()->set_wasm_context_reference(
|
||||
isolate, it.rinfo()->wasm_context_reference() + offset,
|
||||
SKIP_ICACHE_FLUSH);
|
||||
it.rinfo()->wasm_context_reference() + offset, SKIP_ICACHE_FLUSH);
|
||||
}
|
||||
|
||||
// Call into relocated code object
|
||||
|
@ -64,8 +64,7 @@ TEST(WasmRelocationArm64ContextReference) {
|
||||
CodeSpaceMemoryModificationScope modification_scope(isolate->heap());
|
||||
DCHECK(RelocInfo::IsWasmContextReference(it.rinfo()->rmode()));
|
||||
it.rinfo()->set_wasm_context_reference(
|
||||
isolate, it.rinfo()->wasm_context_reference() + offset,
|
||||
SKIP_ICACHE_FLUSH);
|
||||
it.rinfo()->wasm_context_reference() + offset, SKIP_ICACHE_FLUSH);
|
||||
}
|
||||
|
||||
// Call into relocated code object
|
||||
|
@ -68,8 +68,7 @@ TEST(WasmRelocationIa32ContextReference) {
|
||||
CodeSpaceMemoryModificationScope modification_scope(isolate->heap());
|
||||
DCHECK(RelocInfo::IsWasmContextReference(it.rinfo()->rmode()));
|
||||
it.rinfo()->set_wasm_context_reference(
|
||||
isolate, it.rinfo()->wasm_context_reference() + offset,
|
||||
SKIP_ICACHE_FLUSH);
|
||||
it.rinfo()->wasm_context_reference() + offset, SKIP_ICACHE_FLUSH);
|
||||
}
|
||||
|
||||
// Check if immediate is updated correctly
|
||||
|
@ -64,8 +64,7 @@ TEST(WasmRelocationX64ContextReference) {
|
||||
CodeSpaceMemoryModificationScope modification_scope(isolate->heap());
|
||||
DCHECK(RelocInfo::IsWasmContextReference(it.rinfo()->rmode()));
|
||||
it.rinfo()->set_wasm_context_reference(
|
||||
isolate, it.rinfo()->wasm_context_reference() + offset,
|
||||
SKIP_ICACHE_FLUSH);
|
||||
it.rinfo()->wasm_context_reference() + offset, SKIP_ICACHE_FLUSH);
|
||||
}
|
||||
|
||||
// Check if immediate is updated correctly
|
||||
|
@ -50,7 +50,7 @@ WASM_COMPILED_EXEC_TEST(RunPatchWasmContext) {
|
||||
for (RelocIterator it(*code, filter); !it.done(); it.next()) {
|
||||
CHECK_EQ(old_wasm_context_address, it.rinfo()->wasm_context_reference());
|
||||
it.rinfo()->set_wasm_context_reference(
|
||||
isolate, reinterpret_cast<Address>(&new_wasm_context));
|
||||
reinterpret_cast<Address>(&new_wasm_context));
|
||||
patched = true;
|
||||
}
|
||||
CHECK(patched);
|
||||
|
Loading…
Reference in New Issue
Block a user