Commit ec7b99d5 authored by Liu Yu's avatar Liu Yu Committed by V8 LUCI CQ

[mips][baseline] Retry compiling on-heap when growing buffer

Port fb4f89ae

Bug: v8:11872

Change-Id: I662394f7bc0e7f7563b6a8939e5badfa2895f37e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3072323
Auto-Submit: Liu yu <liuyu@loongson.cn>
Reviewed-by: 's avatarZhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Cr-Commit-Position: refs/heads/master@{#76105}
parent 4371d88d
......@@ -3539,16 +3539,16 @@ void Assembler::RelocateRelativeReference(RelocInfo::Mode rmode, Address pc,
void Assembler::FixOnHeapReferences() {
for (auto p : saved_handles_for_raw_object_ptr_) {
Address base = reinterpret_cast<Address>(buffer_->start() + p.first);
Address address = reinterpret_cast<Address>(buffer_->start() + p.first);
Handle<HeapObject> object(reinterpret_cast<Address*>(p.second));
set_target_value_at(base, *object);
set_target_value_at(address, object->ptr());
}
}
void Assembler::FixOnHeapReferencesToHandles() {
for (auto p : saved_handles_for_raw_object_ptr_) {
Address base = reinterpret_cast<Address>(buffer_->start() + p.first);
set_target_value_at(base, p.second);
Address address = reinterpret_cast<Address>(buffer_->start() + p.first);
set_target_value_at(address, p.second);
}
}
......
......@@ -167,8 +167,13 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
GetCode(isolate, desc, kNoSafepointTable, kNoHandlerTable);
}
// This function is called when on-heap-compilation invariants are
// invalidated. For instance, when the assembler buffer grows or a GC happens
// between Code object allocation and Code object finalization.
void FixOnHeapReferences();
// This function is called when we fallback from on-heap to off-heap
// compilation and patch on-heap references to handles.
void FixOnHeapReferencesToHandles();
// Unused on this architecture.
......
......@@ -3738,16 +3738,16 @@ int Assembler::RelocateInternalReference(RelocInfo::Mode rmode, Address pc,
void Assembler::FixOnHeapReferences() {
for (auto p : saved_handles_for_raw_object_ptr_) {
Address base = reinterpret_cast<Address>(buffer_->start() + p.first);
Address address = reinterpret_cast<Address>(buffer_->start() + p.first);
Handle<HeapObject> object(reinterpret_cast<Address*>(p.second));
set_target_value_at(base, *object);
set_target_value_at(address, object->ptr());
}
}
void Assembler::FixOnHeapReferencesToHandles() {
for (auto p : saved_handles_for_raw_object_ptr_) {
Address base = reinterpret_cast<Address>(buffer_->start() + p.first);
set_target_value_at(base, p.second);
Address address = reinterpret_cast<Address>(buffer_->start() + p.first);
set_target_value_at(address, p.second);
}
}
......@@ -3795,9 +3795,14 @@ void Assembler::GrowBuffer() {
RelocateInternalReference(rmode, it.rinfo()->pc(), pc_delta);
}
}
// Patch on-heap references to handles.
if (previously_on_heap && !buffer_->IsOnHeap()) FixOnHeapReferences();
DCHECK(!overflow());
// Fix on-heap references.
if (previously_on_heap) {
if (buffer_->IsOnHeap()) {
FixOnHeapReferences();
} else {
FixOnHeapReferencesToHandles();
}
}
}
void Assembler::db(uint8_t data) {
......
......@@ -167,8 +167,13 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
GetCode(isolate, desc, kNoSafepointTable, kNoHandlerTable);
}
// This function is called when on-heap-compilation invariants are
// invalidated. For instance, when the assembler buffer grows or a GC happens
// between Code object allocation and Code object finalization.
void FixOnHeapReferences();
// This function is called when we fallback from on-heap to off-heap
// compilation and patch on-heap references to handles.
void FixOnHeapReferencesToHandles();
// Unused on this architecture.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment