[baseline][ia32] Remove initial relocation when compiling on heap
Port of https://chromium-review.googlesource.com/c/v8/v8/+/3009221 to ia32. Bug: v8:11872 Change-Id: Ic142a35a1961afebca3f59f493bc801a59cf4914 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3014460 Reviewed-by: Leszek Swirski <leszeks@chromium.org> Commit-Queue: Victor Gomes <victorgomes@chromium.org> Cr-Commit-Position: refs/heads/master@{#75641}
This commit is contained in:
parent
742873c652
commit
fe5c9dfd90
@ -185,6 +185,13 @@ void Assembler::emit(Handle<HeapObject> handle) {
|
||||
void Assembler::emit(uint32_t x, RelocInfo::Mode rmode) {
|
||||
if (!RelocInfo::IsNone(rmode)) {
|
||||
RecordRelocInfo(rmode);
|
||||
if (rmode == RelocInfo::FULL_EMBEDDED_OBJECT && IsOnHeap()) {
|
||||
Handle<HeapObject> object(reinterpret_cast<Address*>(x));
|
||||
saved_handles_for_raw_object_ptr_.push_back(
|
||||
std::make_pair(pc_offset(), x));
|
||||
emit(object->ptr());
|
||||
return;
|
||||
}
|
||||
}
|
||||
emit(x);
|
||||
}
|
||||
@ -203,9 +210,15 @@ void Assembler::emit(const Immediate& x) {
|
||||
if (x.is_heap_object_request()) {
|
||||
RequestHeapObject(x.heap_object_request());
|
||||
emit(0);
|
||||
} else {
|
||||
emit(x.immediate());
|
||||
return;
|
||||
}
|
||||
if (x.is_embedded_object() && IsOnHeap()) {
|
||||
saved_handles_for_raw_object_ptr_.push_back(
|
||||
std::make_pair(pc_offset(), x.immediate()));
|
||||
emit(x.embedded_object()->ptr());
|
||||
return;
|
||||
}
|
||||
emit(x.immediate());
|
||||
}
|
||||
|
||||
void Assembler::emit_code_relative_offset(Label* label) {
|
||||
|
@ -3345,6 +3345,8 @@ void Assembler::GrowBuffer() {
|
||||
DCHECK(buffer_overflow());
|
||||
DCHECK_EQ(buffer_start_, buffer_->start());
|
||||
|
||||
bool previously_on_heap = buffer_->IsOnHeap();
|
||||
|
||||
// Compute new buffer size.
|
||||
int old_size = buffer_->size();
|
||||
int new_size = 2 * old_size;
|
||||
@ -3392,6 +3394,14 @@ void Assembler::GrowBuffer() {
|
||||
it.rinfo()->apply(pc_delta);
|
||||
}
|
||||
|
||||
// Patch on-heap references to handles.
|
||||
if (previously_on_heap && !buffer_->IsOnHeap()) {
|
||||
Address base = reinterpret_cast<Address>(buffer_->start());
|
||||
for (auto p : saved_handles_for_raw_object_ptr_) {
|
||||
WriteUnalignedValue<uint32_t>(base + p.first, p.second);
|
||||
}
|
||||
}
|
||||
|
||||
DCHECK(!buffer_overflow());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user