Change RelocInfo to use constant_pool_ variable instread of host_

R=titzer@chromium.org, mstarzinger@chromium.org, joransiu@ca.ibm.com, jbarboza@ca.ibm.com

Bug: 
Change-Id: Ie7424ed26464574470ce5ae4184092cf46920da9
Reviewed-on: https://chromium-review.googlesource.com/867550
Reviewed-by: Ben Titzer <titzer@chromium.org>
Commit-Queue: Junliang Yan <jyan@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#50628}
This commit is contained in:
Junliang Yan 2018-01-16 13:33:05 -05:00 committed by Commit Bot
parent 3b64a340c7
commit 163fe17c76
24 changed files with 120 additions and 243 deletions

View File

@ -68,7 +68,7 @@ void RelocInfo::apply(intptr_t delta) {
Address RelocInfo::target_address() {
DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) || IsWasmCall(rmode_));
return Assembler::target_address_at(pc_, host_);
return Assembler::target_address_at(pc_, constant_pool_);
}
Address RelocInfo::target_address_address() {
@ -85,7 +85,7 @@ Address RelocInfo::target_address_address() {
Address RelocInfo::constant_pool_entry_address() {
DCHECK(IsInConstantPool());
return Assembler::constant_pool_entry_address(pc_, host_->constant_pool());
return Assembler::constant_pool_entry_address(pc_, constant_pool_);
}
@ -95,21 +95,21 @@ int RelocInfo::target_address_size() {
HeapObject* RelocInfo::target_object() {
DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
return HeapObject::cast(
reinterpret_cast<Object*>(Assembler::target_address_at(pc_, host_)));
return HeapObject::cast(reinterpret_cast<Object*>(
Assembler::target_address_at(pc_, constant_pool_)));
}
Handle<HeapObject> RelocInfo::target_object_handle(Assembler* origin) {
DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
return Handle<HeapObject>(
reinterpret_cast<HeapObject**>(Assembler::target_address_at(pc_, host_)));
return Handle<HeapObject>(reinterpret_cast<HeapObject**>(
Assembler::target_address_at(pc_, constant_pool_)));
}
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_, host_,
Assembler::set_target_address_at(target->GetIsolate(), pc_, constant_pool_,
reinterpret_cast<Address>(target),
icache_flush_mode);
if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != nullptr) {
@ -122,7 +122,7 @@ void RelocInfo::set_target_object(HeapObject* target,
Address RelocInfo::target_external_reference() {
DCHECK(rmode_ == EXTERNAL_REFERENCE);
return Assembler::target_address_at(pc_, host_);
return Assembler::target_address_at(pc_, constant_pool_);
}
@ -158,7 +158,7 @@ void RelocInfo::WipeOut(Isolate* isolate) {
if (IsInternalReference(rmode_)) {
Memory::Address_at(pc_) = nullptr;
} else {
Assembler::set_target_address_at(isolate, pc_, host_, nullptr);
Assembler::set_target_address_at(isolate, pc_, constant_pool_, nullptr);
}
}
@ -382,18 +382,6 @@ void Assembler::set_target_address_at(Isolate* isolate, Address pc,
}
}
Address Assembler::target_address_at(Address pc, Code* code) {
Address constant_pool = code ? code->constant_pool() : nullptr;
return target_address_at(pc, constant_pool);
}
void Assembler::set_target_address_at(Isolate* isolate, Address pc, Code* code,
Address target,
ICacheFlushMode icache_flush_mode) {
Address constant_pool = code ? code->constant_pool() : nullptr;
set_target_address_at(isolate, pc, constant_pool, target, icache_flush_mode);
}
EnsureSpace::EnsureSpace(Assembler* assembler) { assembler->CheckBuffer(); }
} // namespace internal

View File

@ -339,21 +339,23 @@ bool RelocInfo::IsInConstantPool() {
}
Address RelocInfo::embedded_address() const {
return Assembler::target_address_at(pc_, host_);
return Assembler::target_address_at(pc_, constant_pool_);
}
uint32_t RelocInfo::embedded_size() const {
return reinterpret_cast<uint32_t>(Assembler::target_address_at(pc_, host_));
return reinterpret_cast<uint32_t>(
Assembler::target_address_at(pc_, constant_pool_));
}
void RelocInfo::set_embedded_address(Isolate* isolate, Address address,
ICacheFlushMode flush_mode) {
Assembler::set_target_address_at(isolate, pc_, host_, address, flush_mode);
Assembler::set_target_address_at(isolate, 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_, host_,
Assembler::set_target_address_at(isolate, pc_, constant_pool_,
reinterpret_cast<Address>(size), flush_mode);
}

View File

@ -653,10 +653,6 @@ class Assembler : public AssemblerBase {
INLINE(static void set_target_address_at(
Isolate* isolate, Address pc, Address constant_pool, Address target,
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED));
INLINE(static Address target_address_at(Address pc, Code* code));
INLINE(static void set_target_address_at(
Isolate* isolate, Address pc, Code* code, Address target,
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED));
// Return the code target address at a call site from the return address
// of that call in the instruction stream.

View File

@ -532,12 +532,6 @@ Address Assembler::target_address_at(Address pc, Address constant_pool) {
}
Address Assembler::target_address_at(Address pc, Code* code) {
Address constant_pool = code ? code->constant_pool() : nullptr;
return target_address_at(pc, constant_pool);
}
Address Assembler::target_address_from_return_address(Address pc) {
// Returns the address of the call target from the return address that will
// be returned to after a call.
@ -615,14 +609,6 @@ void Assembler::set_target_address_at(Isolate* isolate, Address pc,
}
void Assembler::set_target_address_at(Isolate* isolate, Address pc, Code* code,
Address target,
ICacheFlushMode icache_flush_mode) {
Address constant_pool = code ? code->constant_pool() : nullptr;
set_target_address_at(isolate, pc, constant_pool, target, icache_flush_mode);
}
int RelocInfo::target_address_size() {
return kPointerSize;
}
@ -630,7 +616,7 @@ int RelocInfo::target_address_size() {
Address RelocInfo::target_address() {
DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) || IsWasmCall(rmode_));
return Assembler::target_address_at(pc_, host_);
return Assembler::target_address_at(pc_, constant_pool_);
}
Address RelocInfo::target_address_address() {
@ -647,21 +633,21 @@ Address RelocInfo::constant_pool_entry_address() {
HeapObject* RelocInfo::target_object() {
DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
return HeapObject::cast(
reinterpret_cast<Object*>(Assembler::target_address_at(pc_, host_)));
return HeapObject::cast(reinterpret_cast<Object*>(
Assembler::target_address_at(pc_, constant_pool_)));
}
Handle<HeapObject> RelocInfo::target_object_handle(Assembler* origin) {
DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
return Handle<HeapObject>(
reinterpret_cast<HeapObject**>(Assembler::target_address_at(pc_, host_)));
return Handle<HeapObject>(reinterpret_cast<HeapObject**>(
Assembler::target_address_at(pc_, constant_pool_)));
}
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_, host_,
Assembler::set_target_address_at(target->GetIsolate(), pc_, constant_pool_,
reinterpret_cast<Address>(target),
icache_flush_mode);
if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != nullptr) {
@ -674,7 +660,7 @@ void RelocInfo::set_target_object(HeapObject* target,
Address RelocInfo::target_external_reference() {
DCHECK(rmode_ == EXTERNAL_REFERENCE);
return Assembler::target_address_at(pc_, host_);
return Assembler::target_address_at(pc_, constant_pool_);
}
@ -711,7 +697,7 @@ void RelocInfo::WipeOut(Isolate* isolate) {
if (IsInternalReference(rmode_)) {
Memory::Address_at(pc_) = nullptr;
} else {
Assembler::set_target_address_at(isolate, pc_, host_, nullptr);
Assembler::set_target_address_at(isolate, pc_, constant_pool_, nullptr);
}
}

View File

@ -183,7 +183,8 @@ uint32_t RelocInfo::embedded_size() const {
void RelocInfo::set_embedded_address(Isolate* isolate, Address address,
ICacheFlushMode flush_mode) {
Assembler::set_target_address_at(isolate, pc_, host_, address, flush_mode);
Assembler::set_target_address_at(isolate, pc_, constant_pool_, address,
flush_mode);
}
void RelocInfo::set_embedded_size(Isolate* isolate, uint32_t size,

View File

@ -996,10 +996,6 @@ class Assembler : public AssemblerBase {
inline static void set_target_address_at(
Isolate* isolate, Address pc, Address constant_pool, Address target,
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED);
static inline Address target_address_at(Address pc, Code* code);
static inline void set_target_address_at(
Isolate* isolate, Address pc, Code* code, Address target,
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED);
// Return the code target address at a call site from the return address of
// that call in the instruction stream.

View File

@ -351,7 +351,7 @@ void RelocInfo::set_target_address(Isolate* isolate, Address target,
WriteBarrierMode write_barrier_mode,
ICacheFlushMode icache_flush_mode) {
DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) || IsWasmCall(rmode_));
Assembler::set_target_address_at(isolate, pc_, host_, target,
Assembler::set_target_address_at(isolate, pc_, constant_pool_, target,
icache_flush_mode);
if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != nullptr &&
IsCodeTarget(rmode_)) {

View File

@ -484,6 +484,7 @@ class RelocInfo {
Mode rmode() const { return rmode_; }
intptr_t data() const { return data_; }
Code* host() const { return host_; }
Address constant_pool() const { return constant_pool_; }
// Apply a relocation by delta bytes. When the code object is moved, PC
// relative addresses have to be updated as well as absolute addresses

View File

@ -70,7 +70,7 @@ void RelocInfo::apply(intptr_t delta) {
Address RelocInfo::target_address() {
DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) || IsWasmCall(rmode_));
return Assembler::target_address_at(pc_, host_);
return Assembler::target_address_at(pc_, constant_pool_);
}
Address RelocInfo::target_address_address() {
@ -153,7 +153,7 @@ void RelocInfo::WipeOut(Isolate* isolate) {
Memory::Address_at(pc_) = nullptr;
} else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) {
// Effectively write zero into the relocation.
Assembler::set_target_address_at(isolate, pc_, host_,
Assembler::set_target_address_at(isolate, pc_, constant_pool_,
pc_ + sizeof(int32_t));
} else {
UNREACHABLE();
@ -261,25 +261,14 @@ void Assembler::set_target_address_at(Isolate* isolate, Address pc,
}
}
Address Assembler::target_address_at(Address pc, Code* code) {
Address constant_pool = code ? code->constant_pool() : nullptr;
return target_address_at(pc, constant_pool);
}
void Assembler::set_target_address_at(Isolate* isolate, Address pc, Code* code,
Address target,
ICacheFlushMode icache_flush_mode) {
Address constant_pool = code ? code->constant_pool() : nullptr;
set_target_address_at(isolate, pc, constant_pool, target, icache_flush_mode);
}
Address Assembler::target_address_from_return_address(Address pc) {
return pc - kCallTargetAddressOffset;
}
void Assembler::deserialization_set_special_target_at(
Isolate* isolate, Address instruction_payload, Code* code, Address target) {
set_target_address_at(isolate, instruction_payload, code, target);
set_target_address_at(isolate, instruction_payload,
code ? code->constant_pool() : nullptr, target);
}
Displacement Assembler::disp_at(Label* L) {

View File

@ -531,10 +531,6 @@ class Assembler : public AssemblerBase {
inline static void set_target_address_at(
Isolate* isolate, Address pc, Address constant_pool, Address target,
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED);
static inline Address target_address_at(Address pc, Code* code);
static inline void set_target_address_at(
Isolate* isolate, Address pc, Code* code, Address target,
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED);
// Return the code target address at a call site from the return address
// of that call in the instruction stream.

View File

@ -78,7 +78,7 @@ void RelocInfo::apply(intptr_t delta) {
Address RelocInfo::target_address() {
DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) || IsWasmCall(rmode_));
return Assembler::target_address_at(pc_, host_);
return Assembler::target_address_at(pc_, constant_pool_);
}
Address RelocInfo::target_address_address() {
@ -121,18 +121,6 @@ int RelocInfo::target_address_size() {
return Assembler::kSpecialTargetSize;
}
Address Assembler::target_address_at(Address pc, Code* code) {
Address constant_pool = code ? code->constant_pool() : nullptr;
return target_address_at(pc, constant_pool);
}
void Assembler::set_target_address_at(Isolate* isolate, Address pc, Code* code,
Address target,
ICacheFlushMode icache_flush_mode) {
Address constant_pool = code ? code->constant_pool() : nullptr;
set_target_address_at(isolate, pc, constant_pool, target, icache_flush_mode);
}
Address Assembler::target_address_from_return_address(Address pc) {
return pc - kCallTargetAddressOffset;
}
@ -144,12 +132,12 @@ void Assembler::deserialization_set_special_target_at(
set_target_address_at(
isolate,
instruction_payload - (kInstructionsFor32BitConstant - 1) * kInstrSize,
code, target);
code ? code->constant_pool() : nullptr, target);
} else {
set_target_address_at(
isolate,
instruction_payload - kInstructionsFor32BitConstant * kInstrSize, code,
target);
instruction_payload - kInstructionsFor32BitConstant * kInstrSize,
code ? code->constant_pool() : nullptr, target);
}
}
@ -198,21 +186,21 @@ void Assembler::deserialization_set_target_internal_reference_at(
HeapObject* RelocInfo::target_object() {
DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
return HeapObject::cast(
reinterpret_cast<Object*>(Assembler::target_address_at(pc_, host_)));
return HeapObject::cast(reinterpret_cast<Object*>(
Assembler::target_address_at(pc_, constant_pool_)));
}
Handle<HeapObject> RelocInfo::target_object_handle(Assembler* origin) {
DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
return Handle<HeapObject>(
reinterpret_cast<HeapObject**>(Assembler::target_address_at(pc_, host_)));
return Handle<HeapObject>(reinterpret_cast<HeapObject**>(
Assembler::target_address_at(pc_, constant_pool_)));
}
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_, host_,
Assembler::set_target_address_at(target->GetIsolate(), pc_, constant_pool_,
reinterpret_cast<Address>(target),
icache_flush_mode);
if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != nullptr) {
@ -225,7 +213,7 @@ void RelocInfo::set_target_object(HeapObject* target,
Address RelocInfo::target_external_reference() {
DCHECK(rmode_ == EXTERNAL_REFERENCE);
return Assembler::target_address_at(pc_, host_);
return Assembler::target_address_at(pc_, constant_pool_);
}
@ -279,7 +267,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_, host_, nullptr);
Assembler::set_target_address_at(isolate, pc_, constant_pool_, nullptr);
}
}

View File

@ -192,21 +192,23 @@ bool RelocInfo::IsInConstantPool() {
}
Address RelocInfo::embedded_address() const {
return Assembler::target_address_at(pc_, host_);
return Assembler::target_address_at(pc_, constant_pool_);
}
uint32_t RelocInfo::embedded_size() const {
return reinterpret_cast<uint32_t>(Assembler::target_address_at(pc_, host_));
return reinterpret_cast<uint32_t>(
Assembler::target_address_at(pc_, constant_pool_));
}
void RelocInfo::set_embedded_address(Isolate* isolate, Address address,
ICacheFlushMode flush_mode) {
Assembler::set_target_address_at(isolate, pc_, host_, address, flush_mode);
Assembler::set_target_address_at(isolate, 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_, host_,
Assembler::set_target_address_at(isolate, pc_, constant_pool_,
reinterpret_cast<Address>(size), flush_mode);
}

View File

@ -582,10 +582,6 @@ class Assembler : public AssemblerBase {
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED)) {
set_target_address_at(isolate, pc, target, icache_flush_mode);
}
INLINE(static Address target_address_at(Address pc, Code* code));
INLINE(static void set_target_address_at(
Isolate* isolate, Address pc, Code* code, Address target,
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED));
static void set_target_value_at(
Isolate* isolate, Address pc, uint32_t target,

View File

@ -78,7 +78,7 @@ void RelocInfo::apply(intptr_t delta) {
Address RelocInfo::target_address() {
DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) || IsWasmCall(rmode_));
return Assembler::target_address_at(pc_, host_);
return Assembler::target_address_at(pc_, constant_pool_);
}
Address RelocInfo::target_address_address() {
@ -116,18 +116,6 @@ int RelocInfo::target_address_size() {
return Assembler::kSpecialTargetSize;
}
Address Assembler::target_address_at(Address pc, Code* code) {
Address constant_pool = code ? code->constant_pool() : nullptr;
return target_address_at(pc, constant_pool);
}
void Assembler::set_target_address_at(Isolate* isolate, Address pc, Code* code,
Address target,
ICacheFlushMode icache_flush_mode) {
Address constant_pool = code ? code->constant_pool() : nullptr;
set_target_address_at(isolate, pc, constant_pool, target, icache_flush_mode);
}
Address Assembler::target_address_from_return_address(Address pc) {
return pc - kCallTargetAddressOffset;
}
@ -136,7 +124,7 @@ void Assembler::deserialization_set_special_target_at(
Isolate* isolate, Address instruction_payload, Code* code, Address target) {
set_target_address_at(
isolate, instruction_payload - kInstructionsFor64BitConstant * kInstrSize,
code, target);
code ? code->constant_pool() : nullptr, target);
}
void Assembler::set_target_internal_reference_encoded_at(Address pc,
@ -170,21 +158,21 @@ void Assembler::deserialization_set_target_internal_reference_at(
HeapObject* RelocInfo::target_object() {
DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
return HeapObject::cast(
reinterpret_cast<Object*>(Assembler::target_address_at(pc_, host_)));
return HeapObject::cast(reinterpret_cast<Object*>(
Assembler::target_address_at(pc_, constant_pool_)));
}
Handle<HeapObject> RelocInfo::target_object_handle(Assembler* origin) {
DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
return Handle<HeapObject>(
reinterpret_cast<HeapObject**>(Assembler::target_address_at(pc_, host_)));
return Handle<HeapObject>(reinterpret_cast<HeapObject**>(
Assembler::target_address_at(pc_, constant_pool_)));
}
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_, host_,
Assembler::set_target_address_at(target->GetIsolate(), pc_, constant_pool_,
reinterpret_cast<Address>(target),
icache_flush_mode);
if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != nullptr &&
@ -198,7 +186,7 @@ void RelocInfo::set_target_object(HeapObject* target,
Address RelocInfo::target_external_reference() {
DCHECK(rmode_ == EXTERNAL_REFERENCE);
return Assembler::target_address_at(pc_, host_);
return Assembler::target_address_at(pc_, constant_pool_);
}
@ -246,7 +234,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_, host_, nullptr);
Assembler::set_target_address_at(isolate, pc_, constant_pool_, nullptr);
}
}

View File

@ -170,22 +170,23 @@ bool RelocInfo::IsInConstantPool() {
}
Address RelocInfo::embedded_address() const {
return Assembler::target_address_at(pc_, host_);
return Assembler::target_address_at(pc_, constant_pool_);
}
uint32_t RelocInfo::embedded_size() const {
return static_cast<uint32_t>(
reinterpret_cast<intptr_t>((Assembler::target_address_at(pc_, host_))));
return static_cast<uint32_t>(reinterpret_cast<intptr_t>(
(Assembler::target_address_at(pc_, constant_pool_))));
}
void RelocInfo::set_embedded_address(Isolate* isolate, Address address,
ICacheFlushMode flush_mode) {
Assembler::set_target_address_at(isolate, pc_, host_, address, flush_mode);
Assembler::set_target_address_at(isolate, 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_, host_,
Assembler::set_target_address_at(isolate, pc_, constant_pool_,
reinterpret_cast<Address>(size), flush_mode);
}

View File

@ -591,10 +591,6 @@ class Assembler : public AssemblerBase {
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED)) {
set_target_address_at(isolate, pc, target, icache_flush_mode);
}
INLINE(static Address target_address_at(Address pc, Code* code));
INLINE(static void set_target_address_at(
Isolate* isolate, Address pc, Code* code, Address target,
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED));
static void set_target_value_at(
Isolate* isolate, Address pc, uint64_t target,

View File

@ -60,9 +60,9 @@ void RelocInfo::apply(intptr_t delta) {
} else {
// mov sequence
DCHECK(IsInternalReferenceEncoded(rmode_));
Address target = Assembler::target_address_at(pc_, host_);
Assembler::set_target_address_at(nullptr, pc_, host_, target + delta,
SKIP_ICACHE_FLUSH);
Address target = Assembler::target_address_at(pc_, constant_pool_);
Assembler::set_target_address_at(nullptr, pc_, constant_pool_,
target + delta, SKIP_ICACHE_FLUSH);
}
}
@ -74,7 +74,7 @@ Address RelocInfo::target_internal_reference() {
} else {
// mov sequence
DCHECK(IsInternalReferenceEncoded(rmode_));
return Assembler::target_address_at(pc_, host_);
return Assembler::target_address_at(pc_, constant_pool_);
}
}
@ -87,7 +87,7 @@ Address RelocInfo::target_internal_reference_address() {
Address RelocInfo::target_address() {
DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) || IsWasmCall(rmode_));
return Assembler::target_address_at(pc_, host_);
return Assembler::target_address_at(pc_, constant_pool_);
}
Address RelocInfo::target_address_address() {
@ -117,12 +117,11 @@ Address RelocInfo::target_address_address() {
Address RelocInfo::constant_pool_entry_address() {
if (FLAG_enable_embedded_constant_pool) {
Address constant_pool = host_->constant_pool();
DCHECK(constant_pool);
DCHECK(constant_pool_);
ConstantPoolEntry::Access access;
if (Assembler::IsConstantPoolLoadStart(pc_, &access))
return Assembler::target_constant_pool_address_at(
pc_, constant_pool, access, ConstantPoolEntry::INTPTR);
pc_, constant_pool_, access, ConstantPoolEntry::INTPTR);
}
UNREACHABLE();
}
@ -130,18 +129,6 @@ Address RelocInfo::constant_pool_entry_address() {
int RelocInfo::target_address_size() { return Assembler::kSpecialTargetSize; }
Address Assembler::target_address_at(Address pc, Code* code) {
Address constant_pool = code ? code->constant_pool() : nullptr;
return target_address_at(pc, constant_pool);
}
void Assembler::set_target_address_at(Isolate* isolate, Address pc, Code* code,
Address target,
ICacheFlushMode icache_flush_mode) {
Address constant_pool = code ? code->constant_pool() : nullptr;
set_target_address_at(isolate, pc, constant_pool, target, icache_flush_mode);
}
Address Assembler::target_address_from_return_address(Address pc) {
// Returns the address of the call target from the return address that will
// be returned to after a call.
@ -176,21 +163,21 @@ Address Assembler::return_address_from_call_start(Address pc) {
HeapObject* RelocInfo::target_object() {
DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
return HeapObject::cast(
reinterpret_cast<Object*>(Assembler::target_address_at(pc_, host_)));
return HeapObject::cast(reinterpret_cast<Object*>(
Assembler::target_address_at(pc_, constant_pool_)));
}
Handle<HeapObject> RelocInfo::target_object_handle(Assembler* origin) {
DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
return Handle<HeapObject>(
reinterpret_cast<HeapObject**>(Assembler::target_address_at(pc_, host_)));
return Handle<HeapObject>(reinterpret_cast<HeapObject**>(
Assembler::target_address_at(pc_, constant_pool_)));
}
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_, host_,
Assembler::set_target_address_at(target->GetIsolate(), pc_, constant_pool_,
reinterpret_cast<Address>(target),
icache_flush_mode);
if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != nullptr) {
@ -203,7 +190,7 @@ void RelocInfo::set_target_object(HeapObject* target,
Address RelocInfo::target_external_reference() {
DCHECK(rmode_ == EXTERNAL_REFERENCE);
return Assembler::target_address_at(pc_, host_);
return Assembler::target_address_at(pc_, constant_pool_);
}
@ -230,10 +217,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_, host_, nullptr,
Assembler::set_target_address_at(isolate, pc_, constant_pool_, nullptr,
SKIP_ICACHE_FLUSH);
} else {
Assembler::set_target_address_at(isolate, pc_, host_, nullptr);
Assembler::set_target_address_at(isolate, pc_, constant_pool_, nullptr);
}
}
@ -428,15 +415,15 @@ Address Assembler::target_constant_pool_address_at(
// 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, code, target);
set_target_address_at(isolate, 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) {
if (RelocInfo::IsInternalReferenceEncoded(mode)) {
Code* code = nullptr;
set_target_address_at(isolate, pc, code, target, SKIP_ICACHE_FLUSH);
set_target_address_at(isolate, pc, nullptr, target, SKIP_ICACHE_FLUSH);
} else {
Memory::Address_at(pc) = target;
}

View File

@ -155,30 +155,30 @@ bool RelocInfo::IsCodedSpecially() {
bool RelocInfo::IsInConstantPool() {
if (FLAG_enable_embedded_constant_pool && host_ != nullptr) {
Address constant_pool = host_->constant_pool();
return (constant_pool && Assembler::IsConstantPoolLoadStart(pc_));
if (FLAG_enable_embedded_constant_pool && constant_pool_ != nullptr) {
return (constant_pool_ && Assembler::IsConstantPoolLoadStart(pc_));
}
return false;
}
Address RelocInfo::embedded_address() const {
return Assembler::target_address_at(pc_, host_);
return Assembler::target_address_at(pc_, constant_pool_);
}
uint32_t RelocInfo::embedded_size() const {
return static_cast<uint32_t>(
reinterpret_cast<intptr_t>(Assembler::target_address_at(pc_, host_)));
return static_cast<uint32_t>(reinterpret_cast<intptr_t>(
Assembler::target_address_at(pc_, constant_pool_)));
}
void RelocInfo::set_embedded_address(Isolate* isolate, Address address,
ICacheFlushMode flush_mode) {
Assembler::set_target_address_at(isolate, pc_, host_, address, flush_mode);
Assembler::set_target_address_at(isolate, 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_, host_,
Assembler::set_target_address_at(isolate, pc_, constant_pool_,
reinterpret_cast<Address>(size), flush_mode);
}
@ -2083,8 +2083,7 @@ void Assembler::EmitRelocations() {
it != relocations_.end(); it++) {
RelocInfo::Mode rmode = it->rmode();
Address pc = buffer_ + it->position();
Code* code = nullptr;
RelocInfo rinfo(pc, rmode, it->data(), code);
RelocInfo rinfo(pc, rmode, it->data(), nullptr);
// Fix up internal references now that they are guaranteed to be bound.
if (RelocInfo::IsInternalReference(rmode)) {
@ -2093,8 +2092,8 @@ void Assembler::EmitRelocations() {
Memory::Address_at(pc) = buffer_ + pos;
} else if (RelocInfo::IsInternalReferenceEncoded(rmode)) {
// mov sequence
intptr_t pos = reinterpret_cast<intptr_t>(target_address_at(pc, code));
set_target_address_at(nullptr, pc, code, buffer_ + pos,
intptr_t pos = reinterpret_cast<intptr_t>(target_address_at(pc, nullptr));
set_target_address_at(nullptr, pc, nullptr, buffer_ + pos,
SKIP_ICACHE_FLUSH);
}

View File

@ -583,10 +583,6 @@ class Assembler : public AssemblerBase {
INLINE(static void set_target_address_at(
Isolate* isolate, Address pc, Address constant_pool, Address target,
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED));
INLINE(static Address target_address_at(Address pc, Code* code));
INLINE(static void set_target_address_at(
Isolate* isolate, Address pc, Code* code, Address target,
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED));
// Return the code target address at a call site from the return address
// of that call in the instruction stream.

View File

@ -69,9 +69,9 @@ void RelocInfo::apply(intptr_t delta) {
} else {
// mov sequence
DCHECK(IsInternalReferenceEncoded(rmode_));
Address target = Assembler::target_address_at(pc_, host_);
Assembler::set_target_address_at(nullptr, pc_, host_, target + delta,
SKIP_ICACHE_FLUSH);
Address target = Assembler::target_address_at(pc_, constant_pool_);
Assembler::set_target_address_at(nullptr, pc_, constant_pool_,
target + delta, SKIP_ICACHE_FLUSH);
}
}
@ -82,7 +82,7 @@ Address RelocInfo::target_internal_reference() {
} else {
// mov sequence
DCHECK(IsInternalReferenceEncoded(rmode_));
return Assembler::target_address_at(pc_, host_);
return Assembler::target_address_at(pc_, constant_pool_);
}
}
@ -93,7 +93,7 @@ Address RelocInfo::target_internal_reference_address() {
Address RelocInfo::target_address() {
DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) || IsWasmCall(rmode_));
return Assembler::target_address_at(pc_, host_);
return Assembler::target_address_at(pc_, constant_pool_);
}
Address RelocInfo::target_address_address() {
@ -118,18 +118,6 @@ Address RelocInfo::constant_pool_entry_address() {
int RelocInfo::target_address_size() { return Assembler::kSpecialTargetSize; }
Address Assembler::target_address_at(Address pc, Code* code) {
Address constant_pool = code ? code->constant_pool() : nullptr;
return target_address_at(pc, constant_pool);
}
void Assembler::set_target_address_at(Isolate* isolate, Address pc, Code* code,
Address target,
ICacheFlushMode icache_flush_mode) {
Address constant_pool = code ? code->constant_pool() : nullptr;
set_target_address_at(isolate, pc, constant_pool, target, icache_flush_mode);
}
Address Assembler::target_address_from_return_address(Address pc) {
// Returns the address of the call target from the return address that will
// be returned to after a call.
@ -153,15 +141,15 @@ Handle<Object> Assembler::code_target_object_handle_at(Address pc) {
HeapObject* RelocInfo::target_object() {
DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
return HeapObject::cast(
reinterpret_cast<Object*>(Assembler::target_address_at(pc_, host_)));
return HeapObject::cast(reinterpret_cast<Object*>(
Assembler::target_address_at(pc_, constant_pool_)));
}
Handle<HeapObject> RelocInfo::target_object_handle(Assembler* origin) {
DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
if (rmode_ == EMBEDDED_OBJECT) {
return Handle<HeapObject>(reinterpret_cast<HeapObject**>(
Assembler::target_address_at(pc_, host_)));
Assembler::target_address_at(pc_, constant_pool_)));
} else {
return Handle<HeapObject>::cast(origin->code_target_object_handle_at(pc_));
}
@ -171,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_, host_,
Assembler::set_target_address_at(target->GetIsolate(), pc_, constant_pool_,
reinterpret_cast<Address>(target),
icache_flush_mode);
if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != nullptr) {
@ -183,7 +171,7 @@ void RelocInfo::set_target_object(HeapObject* target,
Address RelocInfo::target_external_reference() {
DCHECK(rmode_ == EXTERNAL_REFERENCE);
return Assembler::target_address_at(pc_, host_);
return Assembler::target_address_at(pc_, constant_pool_);
}
Address RelocInfo::target_runtime_entry(Assembler* origin) {
@ -209,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_, host_, nullptr,
Assembler::set_target_address_at(isolate, pc_, constant_pool_, nullptr,
SKIP_ICACHE_FLUSH);
} else {
Assembler::set_target_address_at(isolate, pc_, host_, nullptr);
Assembler::set_target_address_at(isolate, pc_, constant_pool_, nullptr);
}
}
@ -294,14 +282,14 @@ Address Assembler::target_address_at(Address pc, Address constant_pool) {
// 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, code, target);
set_target_address_at(isolate, 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) {
if (RelocInfo::IsInternalReferenceEncoded(mode)) {
Code* code = nullptr;
set_target_address_at(isolate, pc, code, target, SKIP_ICACHE_FLUSH);
set_target_address_at(isolate, pc, nullptr, target, SKIP_ICACHE_FLUSH);
} else {
Memory::Address_at(pc) = target;
}

View File

@ -271,22 +271,23 @@ bool RelocInfo::IsCodedSpecially() {
bool RelocInfo::IsInConstantPool() { return false; }
Address RelocInfo::embedded_address() const {
return Assembler::target_address_at(pc_, host_);
return Assembler::target_address_at(pc_, constant_pool_);
}
uint32_t RelocInfo::embedded_size() const {
return static_cast<uint32_t>(
reinterpret_cast<intptr_t>(Assembler::target_address_at(pc_, host_)));
return static_cast<uint32_t>(reinterpret_cast<intptr_t>(
Assembler::target_address_at(pc_, constant_pool_)));
}
void RelocInfo::set_embedded_address(Isolate* isolate, Address address,
ICacheFlushMode flush_mode) {
Assembler::set_target_address_at(isolate, pc_, host_, address, flush_mode);
Assembler::set_target_address_at(isolate, 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_, host_,
Assembler::set_target_address_at(isolate, pc_, constant_pool_,
reinterpret_cast<Address>(size), flush_mode);
}
@ -2213,8 +2214,7 @@ void Assembler::EmitRelocations() {
it != relocations_.end(); it++) {
RelocInfo::Mode rmode = it->rmode();
Address pc = buffer_ + it->position();
Code* code = nullptr;
RelocInfo rinfo(pc, rmode, it->data(), code);
RelocInfo rinfo(pc, rmode, it->data(), nullptr);
// Fix up internal references now that they are guaranteed to be bound.
if (RelocInfo::IsInternalReference(rmode)) {
@ -2223,8 +2223,8 @@ void Assembler::EmitRelocations() {
Memory::Address_at(pc) = buffer_ + pos;
} else if (RelocInfo::IsInternalReferenceEncoded(rmode)) {
// mov sequence
intptr_t pos = reinterpret_cast<intptr_t>(target_address_at(pc, code));
set_target_address_at(nullptr, pc, code, buffer_ + pos,
intptr_t pos = reinterpret_cast<intptr_t>(target_address_at(pc, nullptr));
set_target_address_at(nullptr, pc, nullptr, buffer_ + pos,
SKIP_ICACHE_FLUSH);
}

View File

@ -557,10 +557,6 @@ class Assembler : public AssemblerBase {
INLINE(static void set_target_address_at(
Isolate* isolate, Address pc, Address constant_pool, Address target,
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED));
INLINE(static Address target_address_at(Address pc, Code* code));
INLINE(static void set_target_address_at(
Isolate* isolate, Address pc, Code* code, Address target,
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED));
// Return the code target address at a call site from the return address
// of that call in the instruction stream.

View File

@ -279,18 +279,6 @@ void Assembler::set_target_address_at(Isolate* isolate, Address pc,
}
}
Address Assembler::target_address_at(Address pc, Code* code) {
Address constant_pool = code ? code->constant_pool() : nullptr;
return target_address_at(pc, constant_pool);
}
void Assembler::set_target_address_at(Isolate* isolate, Address pc, Code* code,
Address target,
ICacheFlushMode icache_flush_mode) {
Address constant_pool = code ? code->constant_pool() : nullptr;
set_target_address_at(isolate, pc, constant_pool, target, icache_flush_mode);
}
void Assembler::deserialization_set_target_internal_reference_at(
Isolate* isolate, Address pc, Address target, RelocInfo::Mode mode) {
Memory::Address_at(pc) = target;
@ -303,7 +291,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, code, target);
set_target_address_at(isolate, instruction_payload,
code ? code->constant_pool() : nullptr, target);
}
Handle<Code> Assembler::code_target_object_handle_at(Address pc) {
@ -330,7 +319,7 @@ void RelocInfo::apply(intptr_t delta) {
Address RelocInfo::target_address() {
DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) || IsWasmCall(rmode_));
return Assembler::target_address_at(pc_, host_);
return Assembler::target_address_at(pc_, constant_pool_);
}
Address RelocInfo::target_address_address() {
@ -421,7 +410,7 @@ void RelocInfo::WipeOut(Isolate* isolate) {
Memory::Address_at(pc_) = nullptr;
} else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) {
// Effectively write zero into the relocation.
Assembler::set_target_address_at(isolate, pc_, host_,
Assembler::set_target_address_at(isolate, pc_, constant_pool_,
pc_ + sizeof(int32_t));
} else {
UNREACHABLE();

View File

@ -478,10 +478,6 @@ class Assembler : public AssemblerBase {
static inline void set_target_address_at(
Isolate* isolate, Address pc, Address constant_pool, Address target,
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED);
static inline Address target_address_at(Address pc, Code* code);
static inline void set_target_address_at(
Isolate* isolate, Address pc, Code* code, Address target,
ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED);
// Return the code target address at a call site from the return address
// of that call in the instruction stream.