Commit df202d2e authored by Leon Bettscheider's avatar Leon Bettscheider Committed by V8 LUCI CQ

[heap] Make generated code write barrier mark young objects with MinorMC

This CL makes concurrent MinorMC only bailout on the write barrier if
the value is not in young generation.

Bug: v8:13012
Change-Id: I941c6f1e676440cf69e1d4fefcf2786383c9f678
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3840296
Commit-Queue: Leon Bettscheider <bettscheider@google.com>
Reviewed-by: 's avatarDominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82595}
parent 2dd40bfc
......@@ -364,12 +364,31 @@ class WriteBarrierCodeStubAssembler : public CodeStubAssembler {
Branch(object_is_young, true_label, false_label);
}
void IncrementalWriteBarrier(TNode<IntPtrT> slot, TNode<IntPtrT> value,
SaveFPRegsMode fp_mode) {
Label call_incremental_wb(this), next(this);
void IncrementalWriteBarrierMinor(TNode<IntPtrT> slot, TNode<IntPtrT> value,
SaveFPRegsMode fp_mode, Label* next) {
Label check_is_white(this);
// No write barrier for minor incremental marking.
GotoIf(IsMinorMarking(), &next);
InYoungGeneration(value, &check_is_white, next);
BIND(&check_is_white);
GotoIfNot(IsWhite(value), next);
{
TNode<ExternalReference> function = ExternalConstant(
ExternalReference::write_barrier_marking_from_code_function());
TNode<IntPtrT> object = BitcastTaggedToWord(
UncheckedParameter<Object>(WriteBarrierDescriptor::kObject));
CallCFunctionWithCallerSavedRegisters(
function, MachineTypeOf<Int32T>::value, fp_mode,
std::make_pair(MachineTypeOf<IntPtrT>::value, object),
std::make_pair(MachineTypeOf<IntPtrT>::value, slot));
Goto(next);
}
}
void IncrementalWriteBarrierMajor(TNode<IntPtrT> slot, TNode<IntPtrT> value,
SaveFPRegsMode fp_mode, Label* next) {
Label call_incremental_wb(this);
// There are two cases we need to call incremental write barrier.
// 1) value_is_white
......@@ -378,14 +397,14 @@ class WriteBarrierCodeStubAssembler : public CodeStubAssembler {
// 2) is_compacting && value_in_EC && obj_isnt_skip
// is_compacting = true when is_marking = true
GotoIfNot(IsPageFlagSet(value, MemoryChunk::kEvacuationCandidateMask),
&next);
next);
{
TNode<IntPtrT> object = BitcastTaggedToWord(
UncheckedParameter<Object>(WriteBarrierDescriptor::kObject));
Branch(
IsPageFlagSet(object, MemoryChunk::kSkipEvacuationSlotsRecordingMask),
&next, &call_incremental_wb);
next, &call_incremental_wb);
}
BIND(&call_incremental_wb);
{
......@@ -397,8 +416,22 @@ class WriteBarrierCodeStubAssembler : public CodeStubAssembler {
function, MachineTypeOf<Int32T>::value, fp_mode,
std::make_pair(MachineTypeOf<IntPtrT>::value, object),
std::make_pair(MachineTypeOf<IntPtrT>::value, slot));
Goto(&next);
Goto(next);
}
}
void IncrementalWriteBarrier(TNode<IntPtrT> slot, TNode<IntPtrT> value,
SaveFPRegsMode fp_mode) {
Label call_incremental_wb(this), is_minor(this), is_major(this), next(this);
Branch(IsMinorMarking(), &is_minor, &is_major);
BIND(&is_minor);
IncrementalWriteBarrierMinor(slot, value, fp_mode, &next);
BIND(&is_major);
IncrementalWriteBarrierMajor(slot, value, fp_mode, &next);
BIND(&next);
}
......
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