[codegen] Invoke full code writer barrier in set_target_address

While it is not required to invoke the full barrier in this case, we
can invoke the full write barrier which improves verification but also
makes the code easier to understand by relying less on GC
implementation details.

Bug: v8:11708
Change-Id: I4d2f6640bc0efb5b763ccd5ca99e573421be3a06
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3807592
Reviewed-by: Jakob Linke <jgruber@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82208}
This commit is contained in:
Dominik Inführ 2022-08-04 11:16:17 +02:00 committed by V8 LUCI CQ
parent 78ec12e928
commit f206986718
2 changed files with 3 additions and 6 deletions

View File

@ -349,10 +349,10 @@ void RelocInfo::set_target_address(Address target,
IsWasmCall(rmode_));
Assembler::set_target_address_at(pc_, constant_pool_, target,
icache_flush_mode);
if (write_barrier_mode == UPDATE_WRITE_BARRIER && !host().is_null() &&
IsCodeTargetMode(rmode_) && !FLAG_disable_write_barriers) {
if (!host().is_null() && IsCodeTargetMode(rmode_) &&
!FLAG_disable_write_barriers) {
Code target_code = Code::GetCodeFromTargetAddress(target);
WriteBarrier::Marking(host(), this, target_code);
WriteBarrierForCode(host(), this, target_code, write_barrier_mode);
}
}

View File

@ -317,9 +317,6 @@ void WriteBarrier::Marking(Code host, RelocInfo* reloc_info, HeapObject value) {
void WriteBarrier::Shared(Code host, RelocInfo* reloc_info, HeapObject value) {
if (V8_ENABLE_THIRD_PARTY_HEAP_BOOL) return;
// There are no code objects in the shared heap.
DCHECK(!MemoryChunk::FromHeapObject(host)->InSharedHeap());
heap_internals::MemoryChunk* value_chunk =
heap_internals::MemoryChunk::FromHeapObject(value);
if (!value_chunk->InSharedHeap()) return;