[loong64][mips64][heap] Remove write barrier builtin for incremental marking
Port commit e50d19cb11
Bug: v8:11708
Change-Id: Ia9a8cb9d8cd9e768fc056bc5555959e0aaeb3694
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3692435
Reviewed-by: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Auto-Submit: Liu Yu <liuyu@loongson.cn>
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Cr-Commit-Position: refs/heads/main@{#80974}
This commit is contained in:
parent
72c2068731
commit
851854c46f
@ -813,7 +813,7 @@ static void ReplaceClosureCodeWithOptimizedCode(MacroAssembler* masm,
|
||||
__ St_d(optimized_code, FieldMemOperand(closure, JSFunction::kCodeOffset));
|
||||
__ RecordWriteField(closure, JSFunction::kCodeOffset, optimized_code,
|
||||
kRAHasNotBeenSaved, SaveFPRegsMode::kIgnore,
|
||||
RememberedSetAction::kOmit, SmiCheck::kOmit);
|
||||
SmiCheck::kOmit);
|
||||
}
|
||||
|
||||
static void LeaveInterpreterFrame(MacroAssembler* masm, Register scratch1,
|
||||
|
@ -818,7 +818,7 @@ static void ReplaceClosureCodeWithOptimizedCode(MacroAssembler* masm,
|
||||
__ mov(scratch1, optimized_code); // Write barrier clobbers scratch1 below.
|
||||
__ RecordWriteField(closure, JSFunction::kCodeOffset, scratch1, scratch2,
|
||||
kRAHasNotBeenSaved, SaveFPRegsMode::kIgnore,
|
||||
RememberedSetAction::kOmit, SmiCheck::kOmit);
|
||||
SmiCheck::kOmit);
|
||||
}
|
||||
|
||||
static void LeaveInterpreterFrame(MacroAssembler* masm, Register scratch1,
|
||||
|
@ -130,7 +130,6 @@ void TurboAssembler::PushStandardFrame(Register function_reg) {
|
||||
void MacroAssembler::RecordWriteField(Register object, int offset,
|
||||
Register value, RAStatus ra_status,
|
||||
SaveFPRegsMode save_fp,
|
||||
RememberedSetAction remembered_set_action,
|
||||
SmiCheck smi_check) {
|
||||
ASM_CODE_COMMENT(this);
|
||||
// First, check if a write barrier is even needed. The tests below
|
||||
@ -159,7 +158,7 @@ void MacroAssembler::RecordWriteField(Register object, int offset,
|
||||
}
|
||||
|
||||
RecordWrite(object, Operand(offset - kHeapObjectTag), value, ra_status,
|
||||
save_fp, remembered_set_action, SmiCheck::kOmit);
|
||||
save_fp, SmiCheck::kOmit);
|
||||
|
||||
bind(&done);
|
||||
}
|
||||
@ -192,9 +191,10 @@ void TurboAssembler::CallEphemeronKeyBarrier(Register object, Operand offset,
|
||||
MaybeRestoreRegisters(registers);
|
||||
}
|
||||
|
||||
void TurboAssembler::CallRecordWriteStubSaveRegisters(
|
||||
Register object, Operand offset, RememberedSetAction remembered_set_action,
|
||||
SaveFPRegsMode fp_mode, StubCallMode mode) {
|
||||
void TurboAssembler::CallRecordWriteStubSaveRegisters(Register object,
|
||||
Operand offset,
|
||||
SaveFPRegsMode fp_mode,
|
||||
StubCallMode mode) {
|
||||
ASM_CODE_COMMENT(this);
|
||||
RegList registers = WriteBarrierDescriptor::ComputeSavedRegisters(object);
|
||||
MaybeSaveRegisters(registers);
|
||||
@ -205,30 +205,27 @@ void TurboAssembler::CallRecordWriteStubSaveRegisters(
|
||||
|
||||
MoveObjectAndSlot(object_parameter, slot_address_parameter, object, offset);
|
||||
|
||||
CallRecordWriteStub(object_parameter, slot_address_parameter,
|
||||
remembered_set_action, fp_mode, mode);
|
||||
CallRecordWriteStub(object_parameter, slot_address_parameter, fp_mode, mode);
|
||||
|
||||
MaybeRestoreRegisters(registers);
|
||||
}
|
||||
|
||||
void TurboAssembler::CallRecordWriteStub(
|
||||
Register object, Register slot_address,
|
||||
RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode,
|
||||
StubCallMode mode) {
|
||||
void TurboAssembler::CallRecordWriteStub(Register object, Register slot_address,
|
||||
SaveFPRegsMode fp_mode,
|
||||
StubCallMode mode) {
|
||||
// Use CallRecordWriteStubSaveRegisters if the object and slot registers
|
||||
// need to be caller saved.
|
||||
DCHECK_EQ(WriteBarrierDescriptor::ObjectRegister(), object);
|
||||
DCHECK_EQ(WriteBarrierDescriptor::SlotAddressRegister(), slot_address);
|
||||
#if V8_ENABLE_WEBASSEMBLY
|
||||
if (mode == StubCallMode::kCallWasmRuntimeStub) {
|
||||
auto wasm_target =
|
||||
wasm::WasmCode::GetRecordWriteStub(remembered_set_action, fp_mode);
|
||||
auto wasm_target = wasm::WasmCode::GetRecordWriteStub(fp_mode);
|
||||
Call(wasm_target, RelocInfo::WASM_STUB_CALL);
|
||||
#else
|
||||
if (false) {
|
||||
#endif
|
||||
} else {
|
||||
auto builtin = Builtins::GetRecordWriteStub(remembered_set_action, fp_mode);
|
||||
auto builtin = Builtins::GetRecordWriteStub(fp_mode);
|
||||
if (options().inline_offheap_trampolines) {
|
||||
// Inline the trampoline.
|
||||
RecordCommentForOffHeapTrampoline(builtin);
|
||||
@ -285,9 +282,7 @@ void TurboAssembler::MoveObjectAndSlot(Register dst_object, Register dst_slot,
|
||||
// tag is shifted away.
|
||||
void MacroAssembler::RecordWrite(Register object, Operand offset,
|
||||
Register value, RAStatus ra_status,
|
||||
SaveFPRegsMode fp_mode,
|
||||
RememberedSetAction remembered_set_action,
|
||||
SmiCheck smi_check) {
|
||||
SaveFPRegsMode fp_mode, SmiCheck smi_check) {
|
||||
DCHECK(!AreAliased(object, value));
|
||||
|
||||
if (FLAG_debug_code) {
|
||||
@ -299,9 +294,7 @@ void MacroAssembler::RecordWrite(Register object, Operand offset,
|
||||
Operand(value));
|
||||
}
|
||||
|
||||
if ((remembered_set_action == RememberedSetAction::kOmit &&
|
||||
!FLAG_incremental_marking) ||
|
||||
FLAG_disable_write_barriers) {
|
||||
if (FLAG_disable_write_barriers) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -329,7 +322,7 @@ void MacroAssembler::RecordWrite(Register object, Operand offset,
|
||||
DCHECK(!AreAliased(object, slot_address, value));
|
||||
DCHECK(offset.IsImmediate());
|
||||
Add_d(slot_address, object, offset);
|
||||
CallRecordWriteStub(object, slot_address, remembered_set_action, fp_mode);
|
||||
CallRecordWriteStub(object, slot_address, fp_mode);
|
||||
if (ra_status == kRAHasNotBeenSaved) {
|
||||
Pop(ra);
|
||||
}
|
||||
|
@ -285,12 +285,10 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
|
||||
SaveFPRegsMode fp_mode);
|
||||
|
||||
void CallRecordWriteStubSaveRegisters(
|
||||
Register object, Operand offset,
|
||||
RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode,
|
||||
Register object, Operand offset, SaveFPRegsMode fp_mode,
|
||||
StubCallMode mode = StubCallMode::kCallBuiltinPointer);
|
||||
void CallRecordWriteStub(
|
||||
Register object, Register slot_address,
|
||||
RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode,
|
||||
Register object, Register slot_address, SaveFPRegsMode fp_mode,
|
||||
StubCallMode mode = StubCallMode::kCallBuiltinPointer);
|
||||
|
||||
// For a given |object| and |offset|:
|
||||
@ -856,19 +854,15 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
|
||||
// stored.
|
||||
// The offset is the offset from the start of the object, not the offset from
|
||||
// the tagged HeapObject pointer. For use with FieldOperand(reg, off).
|
||||
void RecordWriteField(
|
||||
Register object, int offset, Register value, RAStatus ra_status,
|
||||
SaveFPRegsMode save_fp,
|
||||
RememberedSetAction remembered_set_action = RememberedSetAction::kEmit,
|
||||
SmiCheck smi_check = SmiCheck::kInline);
|
||||
void RecordWriteField(Register object, int offset, Register value,
|
||||
RAStatus ra_status, SaveFPRegsMode save_fp,
|
||||
SmiCheck smi_check = SmiCheck::kInline);
|
||||
|
||||
// For a given |object| notify the garbage collector that the slot at |offset|
|
||||
// has been written. |value| is the object being stored.
|
||||
void RecordWrite(
|
||||
Register object, Operand offset, Register value, RAStatus ra_status,
|
||||
SaveFPRegsMode save_fp,
|
||||
RememberedSetAction remembered_set_action = RememberedSetAction::kEmit,
|
||||
SmiCheck smi_check = SmiCheck::kInline);
|
||||
void RecordWrite(Register object, Operand offset, Register value,
|
||||
RAStatus ra_status, SaveFPRegsMode save_fp,
|
||||
SmiCheck smi_check = SmiCheck::kInline);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Pseudo-instructions.
|
||||
|
@ -136,7 +136,6 @@ void MacroAssembler::RecordWriteField(Register object, int offset,
|
||||
Register value, Register dst,
|
||||
RAStatus ra_status,
|
||||
SaveFPRegsMode save_fp,
|
||||
RememberedSetAction remembered_set_action,
|
||||
SmiCheck smi_check) {
|
||||
ASM_CODE_COMMENT(this);
|
||||
DCHECK(!AreAliased(value, dst, t8, object));
|
||||
@ -163,8 +162,7 @@ void MacroAssembler::RecordWriteField(Register object, int offset,
|
||||
bind(&ok);
|
||||
}
|
||||
|
||||
RecordWrite(object, dst, value, ra_status, save_fp, remembered_set_action,
|
||||
SmiCheck::kOmit);
|
||||
RecordWrite(object, dst, value, ra_status, save_fp, SmiCheck::kOmit);
|
||||
|
||||
bind(&done);
|
||||
|
||||
@ -210,10 +208,10 @@ void TurboAssembler::CallEphemeronKeyBarrier(Register object,
|
||||
MaybeRestoreRegisters(registers);
|
||||
}
|
||||
|
||||
void TurboAssembler::CallRecordWriteStubSaveRegisters(
|
||||
Register object, Register slot_address,
|
||||
RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode,
|
||||
StubCallMode mode) {
|
||||
void TurboAssembler::CallRecordWriteStubSaveRegisters(Register object,
|
||||
Register slot_address,
|
||||
SaveFPRegsMode fp_mode,
|
||||
StubCallMode mode) {
|
||||
DCHECK(!AreAliased(object, slot_address));
|
||||
RegList registers =
|
||||
WriteBarrierDescriptor::ComputeSavedRegisters(object, slot_address);
|
||||
@ -228,30 +226,27 @@ void TurboAssembler::CallRecordWriteStubSaveRegisters(
|
||||
Pop(slot_address_parameter);
|
||||
Pop(object_parameter);
|
||||
|
||||
CallRecordWriteStub(object_parameter, slot_address_parameter,
|
||||
remembered_set_action, fp_mode, mode);
|
||||
CallRecordWriteStub(object_parameter, slot_address_parameter, fp_mode, mode);
|
||||
|
||||
MaybeRestoreRegisters(registers);
|
||||
}
|
||||
|
||||
void TurboAssembler::CallRecordWriteStub(
|
||||
Register object, Register slot_address,
|
||||
RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode,
|
||||
StubCallMode mode) {
|
||||
void TurboAssembler::CallRecordWriteStub(Register object, Register slot_address,
|
||||
SaveFPRegsMode fp_mode,
|
||||
StubCallMode mode) {
|
||||
// Use CallRecordWriteStubSaveRegisters if the object and slot registers
|
||||
// need to be caller saved.
|
||||
DCHECK_EQ(WriteBarrierDescriptor::ObjectRegister(), object);
|
||||
DCHECK_EQ(WriteBarrierDescriptor::SlotAddressRegister(), slot_address);
|
||||
#if V8_ENABLE_WEBASSEMBLY
|
||||
if (mode == StubCallMode::kCallWasmRuntimeStub) {
|
||||
auto wasm_target =
|
||||
wasm::WasmCode::GetRecordWriteStub(remembered_set_action, fp_mode);
|
||||
auto wasm_target = wasm::WasmCode::GetRecordWriteStub(fp_mode);
|
||||
Call(wasm_target, RelocInfo::WASM_STUB_CALL);
|
||||
#else
|
||||
if (false) {
|
||||
#endif
|
||||
} else {
|
||||
auto builtin = Builtins::GetRecordWriteStub(remembered_set_action, fp_mode);
|
||||
auto builtin = Builtins::GetRecordWriteStub(fp_mode);
|
||||
if (options().inline_offheap_trampolines) {
|
||||
// Inline the trampoline.
|
||||
RecordCommentForOffHeapTrampoline(builtin);
|
||||
@ -270,9 +265,7 @@ void TurboAssembler::CallRecordWriteStub(
|
||||
// tag is shifted away.
|
||||
void MacroAssembler::RecordWrite(Register object, Register address,
|
||||
Register value, RAStatus ra_status,
|
||||
SaveFPRegsMode fp_mode,
|
||||
RememberedSetAction remembered_set_action,
|
||||
SmiCheck smi_check) {
|
||||
SaveFPRegsMode fp_mode, SmiCheck smi_check) {
|
||||
DCHECK(!AreAliased(object, address, value, t8));
|
||||
DCHECK(!AreAliased(object, address, value, t9));
|
||||
|
||||
@ -285,9 +278,7 @@ void MacroAssembler::RecordWrite(Register object, Register address,
|
||||
Operand(value));
|
||||
}
|
||||
|
||||
if ((remembered_set_action == RememberedSetAction::kOmit &&
|
||||
!FLAG_incremental_marking) ||
|
||||
FLAG_disable_write_barriers) {
|
||||
if (FLAG_disable_write_barriers) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -315,7 +306,7 @@ void MacroAssembler::RecordWrite(Register object, Register address,
|
||||
Register slot_address = WriteBarrierDescriptor::SlotAddressRegister();
|
||||
DCHECK(!AreAliased(object, slot_address, value));
|
||||
mov(slot_address, address);
|
||||
CallRecordWriteStub(object, slot_address, remembered_set_action, fp_mode);
|
||||
CallRecordWriteStub(object, slot_address, fp_mode);
|
||||
|
||||
if (ra_status == kRAHasNotBeenSaved) {
|
||||
pop(ra);
|
||||
|
@ -358,12 +358,10 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
|
||||
SaveFPRegsMode fp_mode);
|
||||
|
||||
void CallRecordWriteStubSaveRegisters(
|
||||
Register object, Register slot_address,
|
||||
RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode,
|
||||
Register object, Register slot_address, SaveFPRegsMode fp_mode,
|
||||
StubCallMode mode = StubCallMode::kCallBuiltinPointer);
|
||||
void CallRecordWriteStub(
|
||||
Register object, Register slot_address,
|
||||
RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode,
|
||||
Register object, Register slot_address, SaveFPRegsMode fp_mode,
|
||||
StubCallMode mode = StubCallMode::kCallBuiltinPointer);
|
||||
|
||||
// Push multiple registers on the stack.
|
||||
@ -1028,20 +1026,17 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
|
||||
// stored. value and scratch registers are clobbered by the operation.
|
||||
// The offset is the offset from the start of the object, not the offset from
|
||||
// the tagged HeapObject pointer. For use with FieldOperand(reg, off).
|
||||
void RecordWriteField(
|
||||
Register object, int offset, Register value, Register scratch,
|
||||
RAStatus ra_status, SaveFPRegsMode save_fp,
|
||||
RememberedSetAction remembered_set_action = RememberedSetAction::kEmit,
|
||||
SmiCheck smi_check = SmiCheck::kInline);
|
||||
void RecordWriteField(Register object, int offset, Register value,
|
||||
Register scratch, RAStatus ra_status,
|
||||
SaveFPRegsMode save_fp,
|
||||
SmiCheck smi_check = SmiCheck::kInline);
|
||||
|
||||
// For a given |object| notify the garbage collector that the slot |address|
|
||||
// has been written. |value| is the object being stored. The value and
|
||||
// address registers are clobbered by the operation.
|
||||
void RecordWrite(
|
||||
Register object, Register address, Register value, RAStatus ra_status,
|
||||
SaveFPRegsMode save_fp,
|
||||
RememberedSetAction remembered_set_action = RememberedSetAction::kEmit,
|
||||
SmiCheck smi_check = SmiCheck::kInline);
|
||||
void RecordWrite(Register object, Register address, Register value,
|
||||
RAStatus ra_status, SaveFPRegsMode save_fp,
|
||||
SmiCheck smi_check = SmiCheck::kInline);
|
||||
|
||||
void Pref(int32_t hint, const MemOperand& rs);
|
||||
|
||||
|
@ -164,11 +164,6 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
|
||||
void Generate() final {
|
||||
__ CheckPageFlag(value_, MemoryChunk::kPointersToHereAreInterestingMask, eq,
|
||||
exit());
|
||||
RememberedSetAction const remembered_set_action =
|
||||
mode_ > RecordWriteMode::kValueIsMap ||
|
||||
FLAG_use_full_record_write_builtin
|
||||
? RememberedSetAction::kEmit
|
||||
: RememberedSetAction::kOmit;
|
||||
SaveFPRegsMode const save_fp_mode = frame()->DidAllocateDoubleRegisters()
|
||||
? SaveFPRegsMode::kSave
|
||||
: SaveFPRegsMode::kIgnore;
|
||||
@ -183,13 +178,11 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
|
||||
// A direct call to a wasm runtime stub defined in this module.
|
||||
// Just encode the stub index. This will be patched when the code
|
||||
// is added to the native module and copied into wasm code space.
|
||||
__ CallRecordWriteStubSaveRegisters(object_, offset_,
|
||||
remembered_set_action, save_fp_mode,
|
||||
__ CallRecordWriteStubSaveRegisters(object_, offset_, save_fp_mode,
|
||||
StubCallMode::kCallWasmRuntimeStub);
|
||||
#endif // V8_ENABLE_WEBASSEMBLY
|
||||
} else {
|
||||
__ CallRecordWriteStubSaveRegisters(object_, offset_,
|
||||
remembered_set_action, save_fp_mode);
|
||||
__ CallRecordWriteStubSaveRegisters(object_, offset_, save_fp_mode);
|
||||
}
|
||||
if (must_save_lr_) {
|
||||
__ Pop(ra);
|
||||
|
@ -169,11 +169,6 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
|
||||
MemoryChunk::kPointersToHereAreInterestingMask, eq,
|
||||
exit());
|
||||
__ Daddu(scratch1_, object_, index_);
|
||||
RememberedSetAction const remembered_set_action =
|
||||
mode_ > RecordWriteMode::kValueIsMap ||
|
||||
FLAG_use_full_record_write_builtin
|
||||
? RememberedSetAction::kEmit
|
||||
: RememberedSetAction::kOmit;
|
||||
SaveFPRegsMode const save_fp_mode = frame()->DidAllocateDoubleRegisters()
|
||||
? SaveFPRegsMode::kSave
|
||||
: SaveFPRegsMode::kIgnore;
|
||||
@ -188,13 +183,11 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
|
||||
// A direct call to a wasm runtime stub defined in this module.
|
||||
// Just encode the stub index. This will be patched when the code
|
||||
// is added to the native module and copied into wasm code space.
|
||||
__ CallRecordWriteStubSaveRegisters(object_, scratch1_,
|
||||
remembered_set_action, save_fp_mode,
|
||||
__ CallRecordWriteStubSaveRegisters(object_, scratch1_, save_fp_mode,
|
||||
StubCallMode::kCallWasmRuntimeStub);
|
||||
#endif // V8_ENABLE_WEBASSEMBLY
|
||||
} else {
|
||||
__ CallRecordWriteStubSaveRegisters(object_, scratch1_,
|
||||
remembered_set_action, save_fp_mode);
|
||||
__ CallRecordWriteStubSaveRegisters(object_, scratch1_, save_fp_mode);
|
||||
}
|
||||
if (must_save_lr_) {
|
||||
__ Pop(ra);
|
||||
|
@ -413,9 +413,8 @@ void LiftoffAssembler::StoreTaggedPointer(Register dst_addr,
|
||||
JumpIfSmi(src.gp(), &exit);
|
||||
CheckPageFlag(src.gp(), MemoryChunk::kPointersToHereAreInterestingMask, eq,
|
||||
&exit);
|
||||
CallRecordWriteStubSaveRegisters(
|
||||
dst_addr, offset_op, RememberedSetAction::kEmit, SaveFPRegsMode::kSave,
|
||||
StubCallMode::kCallWasmRuntimeStub);
|
||||
CallRecordWriteStubSaveRegisters(dst_addr, offset_op, SaveFPRegsMode::kSave,
|
||||
StubCallMode::kCallWasmRuntimeStub);
|
||||
bind(&exit);
|
||||
}
|
||||
|
||||
|
@ -520,9 +520,8 @@ void LiftoffAssembler::StoreTaggedPointer(Register dst_addr,
|
||||
MemoryChunk::kPointersToHereAreInterestingMask, eq,
|
||||
&exit);
|
||||
Daddu(scratch, dst_op.rm(), dst_op.offset());
|
||||
CallRecordWriteStubSaveRegisters(
|
||||
dst_addr, scratch, RememberedSetAction::kEmit, SaveFPRegsMode::kSave,
|
||||
StubCallMode::kCallWasmRuntimeStub);
|
||||
CallRecordWriteStubSaveRegisters(dst_addr, scratch, SaveFPRegsMode::kSave,
|
||||
StubCallMode::kCallWasmRuntimeStub);
|
||||
bind(&exit);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user