PPC/s390: [Turboprop] Support HeapObject immediate deopt args.
Port bbb1b3457b
Original Commit Message:
Adds support for emitting data with a reloc info to enable support
for HeapObjects for immediate deopt args, required by dynamic check maps.
In order to do this, a new DATA_EMBEDDED_OBJECT relocinfo type is added.
This represents a raw object inserted into the instruction stream. For
x64/ia32 it is treated the same as FULL_EMBEDDED_OBJECT, but on
Arm/Arm64 this behaves differently since it points directly to the
embedded object pointer rather than to an instruction that loads it.
R=rmcilroy@chromium.org, joransiu@ca.ibm.com, junyan@redhat.com, midawson@redhat.com
BUG=v8:10582
LOG=N
Change-Id: I949acb69ca6f6a377102eb0ac5f44919d4f7d25b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2612930
Reviewed-by: Junliang Yan <junyan@redhat.com>
Commit-Queue: Milad Fa <mfarazma@redhat.com>
Cr-Commit-Position: refs/heads/master@{#71931}
This commit is contained in:
parent
90996698b9
commit
0b94bed703
@ -149,7 +149,9 @@ Handle<Object> Assembler::code_target_object_handle_at(Address pc,
|
||||
|
||||
HeapObject RelocInfo::target_object() {
|
||||
DCHECK(IsCodeTarget(rmode_) || IsEmbeddedObjectMode(rmode_));
|
||||
if (IsCompressedEmbeddedObject(rmode_)) {
|
||||
if (IsDataEmbeddedObject(rmode_)) {
|
||||
return HeapObject::cast(Object(ReadUnalignedValue<Address>(pc_)));
|
||||
} else if (IsCompressedEmbeddedObject(rmode_)) {
|
||||
return HeapObject::cast(Object(DecompressTaggedAny(
|
||||
host_.address(),
|
||||
Assembler::target_compressed_address_at(pc_, constant_pool_))));
|
||||
@ -176,7 +178,9 @@ Handle<HeapObject> Assembler::compressed_embedded_object_handle_at(
|
||||
|
||||
Handle<HeapObject> RelocInfo::target_object_handle(Assembler* origin) {
|
||||
DCHECK(IsCodeTarget(rmode_) || IsEmbeddedObjectMode(rmode_));
|
||||
if (IsCodeTarget(rmode_)) {
|
||||
if (IsDataEmbeddedObject(rmode_)) {
|
||||
return Handle<HeapObject>::cast(ReadUnalignedValue<Handle<Object>>(pc_));
|
||||
} else if (IsCodeTarget(rmode_)) {
|
||||
return Handle<HeapObject>::cast(
|
||||
origin->code_target_object_handle_at(pc_, constant_pool_));
|
||||
} else {
|
||||
@ -192,7 +196,10 @@ void RelocInfo::set_target_object(Heap* heap, HeapObject target,
|
||||
WriteBarrierMode write_barrier_mode,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(IsCodeTarget(rmode_) || IsEmbeddedObjectMode(rmode_));
|
||||
if (IsCompressedEmbeddedObject(rmode_)) {
|
||||
if (IsDataEmbeddedObject(rmode_)) {
|
||||
WriteUnalignedValue(pc_, target.ptr());
|
||||
// No need to flush icache since no instructions were changed.
|
||||
} else if (IsCompressedEmbeddedObject(rmode_)) {
|
||||
Assembler::set_target_compressed_address_at(
|
||||
pc_, constant_pool_, CompressTagged(target.ptr()), icache_flush_mode);
|
||||
} else {
|
||||
|
@ -1948,20 +1948,32 @@ void Assembler::db(uint8_t data) {
|
||||
pc_ += sizeof(uint8_t);
|
||||
}
|
||||
|
||||
void Assembler::dd(uint32_t data) {
|
||||
void Assembler::dd(uint32_t data, RelocInfo::Mode rmode) {
|
||||
CheckBuffer();
|
||||
if (!RelocInfo::IsNone(rmode)) {
|
||||
DCHECK(RelocInfo::IsDataEmbeddedObject(rmode));
|
||||
RecordRelocInfo(rmode);
|
||||
}
|
||||
*reinterpret_cast<uint32_t*>(pc_) = data;
|
||||
pc_ += sizeof(uint32_t);
|
||||
}
|
||||
|
||||
void Assembler::dq(uint64_t value) {
|
||||
void Assembler::dq(uint64_t value, RelocInfo::Mode rmode) {
|
||||
CheckBuffer();
|
||||
if (!RelocInfo::IsNone(rmode)) {
|
||||
DCHECK(RelocInfo::IsDataEmbeddedObject(rmode));
|
||||
RecordRelocInfo(rmode);
|
||||
}
|
||||
*reinterpret_cast<uint64_t*>(pc_) = value;
|
||||
pc_ += sizeof(uint64_t);
|
||||
}
|
||||
|
||||
void Assembler::dp(uintptr_t data) {
|
||||
void Assembler::dp(uintptr_t data, RelocInfo::Mode rmode) {
|
||||
CheckBuffer();
|
||||
if (!RelocInfo::IsNone(rmode)) {
|
||||
DCHECK(RelocInfo::IsDataEmbeddedObject(rmode));
|
||||
RecordRelocInfo(rmode);
|
||||
}
|
||||
*reinterpret_cast<uintptr_t*>(pc_) = data;
|
||||
pc_ += sizeof(uintptr_t);
|
||||
}
|
||||
|
@ -1123,9 +1123,9 @@ class Assembler : public AssemblerBase {
|
||||
// Writes a single byte or word of data in the code stream. Used
|
||||
// for inline tables, e.g., jump-tables.
|
||||
void db(uint8_t data);
|
||||
void dd(uint32_t data);
|
||||
void dq(uint64_t data);
|
||||
void dp(uintptr_t data);
|
||||
void dd(uint32_t data, RelocInfo::Mode rmode = RelocInfo::NONE);
|
||||
void dq(uint64_t data, RelocInfo::Mode rmode = RelocInfo::NONE);
|
||||
void dp(uintptr_t data, RelocInfo::Mode rmode = RelocInfo::NONE);
|
||||
|
||||
// Read/patch instructions
|
||||
Instr instr_at(int pos) {
|
||||
|
@ -145,7 +145,9 @@ Handle<Object> Assembler::code_target_object_handle_at(Address pc) {
|
||||
|
||||
HeapObject RelocInfo::target_object() {
|
||||
DCHECK(IsCodeTarget(rmode_) || IsEmbeddedObjectMode(rmode_));
|
||||
if (IsCompressedEmbeddedObject(rmode_)) {
|
||||
if (IsDataEmbeddedObject(rmode_)) {
|
||||
return HeapObject::cast(Object(ReadUnalignedValue<Address>(pc_)));
|
||||
} else if (IsCompressedEmbeddedObject(rmode_)) {
|
||||
return HeapObject::cast(Object(DecompressTaggedAny(
|
||||
host_.address(),
|
||||
Assembler::target_compressed_address_at(pc_, constant_pool_))));
|
||||
@ -173,7 +175,9 @@ Handle<HeapObject> Assembler::compressed_embedded_object_handle_at(
|
||||
Handle<HeapObject> RelocInfo::target_object_handle(Assembler* origin) {
|
||||
DCHECK(IsRelativeCodeTarget(rmode_) || IsCodeTarget(rmode_) ||
|
||||
IsEmbeddedObjectMode(rmode_));
|
||||
if (IsCodeTarget(rmode_) || IsRelativeCodeTarget(rmode_)) {
|
||||
if (IsDataEmbeddedObject(rmode_)) {
|
||||
return Handle<HeapObject>::cast(ReadUnalignedValue<Handle<Object>>(pc_));
|
||||
} else if (IsCodeTarget(rmode_) || IsRelativeCodeTarget(rmode_)) {
|
||||
return Handle<HeapObject>::cast(origin->code_target_object_handle_at(pc_));
|
||||
} else {
|
||||
if (IsCompressedEmbeddedObject(rmode_)) {
|
||||
@ -188,7 +192,10 @@ void RelocInfo::set_target_object(Heap* heap, HeapObject target,
|
||||
WriteBarrierMode write_barrier_mode,
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(IsCodeTarget(rmode_) || IsEmbeddedObjectMode(rmode_));
|
||||
if (IsCompressedEmbeddedObject(rmode_)) {
|
||||
if (IsDataEmbeddedObject(rmode_)) {
|
||||
WriteUnalignedValue(pc_, target.ptr());
|
||||
// No need to flush icache since no instructions were changed.
|
||||
} else if (IsCompressedEmbeddedObject(rmode_)) {
|
||||
Assembler::set_target_compressed_address_at(
|
||||
pc_, constant_pool_, CompressTagged(target.ptr()), icache_flush_mode);
|
||||
} else {
|
||||
|
@ -781,20 +781,32 @@ void Assembler::db(uint8_t data) {
|
||||
pc_ += sizeof(uint8_t);
|
||||
}
|
||||
|
||||
void Assembler::dd(uint32_t data) {
|
||||
void Assembler::dd(uint32_t data, RelocInfo::Mode rmode) {
|
||||
CheckBuffer();
|
||||
if (!RelocInfo::IsNone(rmode)) {
|
||||
DCHECK(RelocInfo::IsDataEmbeddedObject(rmode));
|
||||
RecordRelocInfo(rmode);
|
||||
}
|
||||
*reinterpret_cast<uint32_t*>(pc_) = data;
|
||||
pc_ += sizeof(uint32_t);
|
||||
}
|
||||
|
||||
void Assembler::dq(uint64_t value) {
|
||||
void Assembler::dq(uint64_t value, RelocInfo::Mode rmode) {
|
||||
CheckBuffer();
|
||||
if (!RelocInfo::IsNone(rmode)) {
|
||||
DCHECK(RelocInfo::IsDataEmbeddedObject(rmode));
|
||||
RecordRelocInfo(rmode);
|
||||
}
|
||||
*reinterpret_cast<uint64_t*>(pc_) = value;
|
||||
pc_ += sizeof(uint64_t);
|
||||
}
|
||||
|
||||
void Assembler::dp(uintptr_t data) {
|
||||
void Assembler::dp(uintptr_t data, RelocInfo::Mode rmode) {
|
||||
CheckBuffer();
|
||||
if (!RelocInfo::IsNone(rmode)) {
|
||||
DCHECK(RelocInfo::IsDataEmbeddedObject(rmode));
|
||||
RecordRelocInfo(rmode);
|
||||
}
|
||||
*reinterpret_cast<uintptr_t*>(pc_) = data;
|
||||
pc_ += sizeof(uintptr_t);
|
||||
}
|
||||
|
@ -1310,9 +1310,9 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
|
||||
// Writes a single byte or word of data in the code stream. Used
|
||||
// for inline tables, e.g., jump-tables.
|
||||
void db(uint8_t data);
|
||||
void dd(uint32_t data);
|
||||
void dq(uint64_t data);
|
||||
void dp(uintptr_t data);
|
||||
void dd(uint32_t data, RelocInfo::Mode rmode = RelocInfo::NONE);
|
||||
void dq(uint64_t data, RelocInfo::Mode rmode = RelocInfo::NONE);
|
||||
void dp(uintptr_t data, RelocInfo::Mode rmode = RelocInfo::NONE);
|
||||
|
||||
// Read/patch instructions
|
||||
SixByteInstr instr_at(int pos) {
|
||||
|
Loading…
Reference in New Issue
Block a user