Commit 34b1c557 authored by Camillo Bruni's avatar Camillo Bruni Committed by V8 LUCI CQ

[codegen] Add more register aliasing checks for RecordWrite helpers

Note: OutOfLineRecordWrite on arm/arm64 only takes "object" and "value"
as arguments. The currently can be the same and thus we don't add any
additional DHCECKs there.

Change-Id: I757d1f3ba9c0d0c5994ecedf26728454e32f41a5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2916813
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: 's avatarSantiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74758}
parent ec6134a4
......@@ -806,7 +806,7 @@ void MacroAssembler::RecordWrite(Register object, Operand offset,
SaveFPRegsMode fp_mode,
RememberedSetAction remembered_set_action,
SmiCheck smi_check) {
DCHECK_NE(object, value);
DCHECK(!AreAliased(object, value));
if (FLAG_debug_code) {
{
UseScratchRegisterScope temps(this);
......
......@@ -442,6 +442,7 @@ void TurboAssembler::CallRecordWriteStub(
Register object, Register address,
RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode,
StubCallMode mode) {
DCHECK(!AreAliased(object, address));
WriteBarrierDescriptor descriptor;
RegList registers = descriptor.allocatable_registers();
SaveRegisters(registers);
......@@ -485,9 +486,7 @@ void MacroAssembler::RecordWrite(Register object, Register address,
Register value, SaveFPRegsMode fp_mode,
RememberedSetAction remembered_set_action,
SmiCheck smi_check) {
DCHECK(object != value);
DCHECK(object != address);
DCHECK(value != address);
DCHECK(!AreAliased(object, value, address));
AssertNotSmi(object);
if ((remembered_set_action == RememberedSetAction::kOmit &&
......
......@@ -261,6 +261,7 @@ void TurboAssembler::CallRecordWriteStub(
Register object, Register address,
RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode,
StubCallMode mode) {
DCHECK(!AreAliased(object, address));
WriteBarrierDescriptor descriptor;
RegList registers = descriptor.allocatable_registers();
......
......@@ -259,6 +259,7 @@ void TurboAssembler::CallRecordWriteStub(
Register object, Register address,
RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode,
StubCallMode mode) {
DCHECK(!AreAliased(object, address));
WriteBarrierDescriptor descriptor;
RegList registers = descriptor.allocatable_registers();
SaveRegisters(registers);
......
......@@ -679,6 +679,7 @@ void TurboAssembler::CallRecordWriteStub(
Register object, Register address,
RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode,
StubCallMode mode) {
DCHECK(!AreAliased(object, address));
WriteBarrierDescriptor descriptor;
RegList registers = descriptor.allocatable_registers();
SaveRegisters(registers);
......@@ -732,7 +733,7 @@ void MacroAssembler::RecordWrite(Register object, Register address,
SaveFPRegsMode fp_mode,
RememberedSetAction remembered_set_action,
SmiCheck smi_check) {
DCHECK(object != value);
DCHECK(!AreAliased(object, value, address));
if (FLAG_debug_code) {
LoadTaggedPointerField(r0, MemOperand(address));
cmp(r0, value);
......
......@@ -260,6 +260,7 @@ void TurboAssembler::CallRecordWriteStub(
Register object, Register address,
RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode,
StubCallMode mode) {
DCHECK(!AreAliased(object, address, value));
WriteBarrierDescriptor descriptor;
RegList registers = descriptor.allocatable_registers();
SaveRegisters(registers);
......@@ -313,6 +314,7 @@ void MacroAssembler::RecordWrite(Register object, Register address,
SaveFPRegsMode fp_mode,
RememberedSetAction remembered_set_action,
SmiCheck smi_check) {
DCHECK(!AreAliased(object, address, value));
if (FLAG_debug_code) {
DCHECK(!AreAliased(object, address, value, kScratchReg));
Ld(kScratchReg, MemOperand(address));
......
......@@ -895,6 +895,7 @@ void TurboAssembler::CallRecordWriteStub(
Register object, Register address,
RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode,
StubCallMode mode) {
DCHECK(!AreAliased(object, address, value));
WriteBarrierDescriptor descriptor;
RegList registers = descriptor.allocatable_registers();
SaveRegisters(registers);
......@@ -946,7 +947,7 @@ void MacroAssembler::RecordWrite(Register object, Register address,
SaveFPRegsMode fp_mode,
RememberedSetAction remembered_set_action,
SmiCheck smi_check) {
DCHECK(object != value);
DCHECK(!AreAliased(object, address, value));
if (FLAG_debug_code) {
LoadTaggedPointerField(r0, MemOperand(address));
CmpS64(value, r0);
......
......@@ -409,6 +409,7 @@ void TurboAssembler::RestoreRegisters(RegList registers) {
void TurboAssembler::CallEphemeronKeyBarrier(Register object, Register address,
SaveFPRegsMode fp_mode) {
DCHECK(!AreAliased(object, address));
WriteBarrierDescriptor descriptor;
RegList registers = descriptor.allocatable_registers();
......@@ -430,6 +431,7 @@ void TurboAssembler::CallRecordWriteStub(
Register object, Register address,
RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode,
StubCallMode mode) {
DCHECK(!AreAliased(object, address));
WriteBarrierDescriptor descriptor;
RegList registers = descriptor.allocatable_registers();
SaveRegisters(registers);
......@@ -508,9 +510,7 @@ void MacroAssembler::RecordWrite(Register object, Register address,
Register value, SaveFPRegsMode fp_mode,
RememberedSetAction remembered_set_action,
SmiCheck smi_check) {
DCHECK(object != value);
DCHECK(object != address);
DCHECK(value != address);
DCHECK(!AreAliased(object, value, address));
AssertNotSmi(object);
if ((remembered_set_action == RememberedSetAction::kOmit &&
......
......@@ -317,6 +317,8 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
stub_mode_(stub_mode),
#endif // V8_ENABLE_WEBASSEMBLY
zone_(gen->zone()) {
DCHECK(!AreAliased(object, scratch0, scratch1));
DCHECK(!AreAliased(value, scratch0, scratch1));
}
void Generate() final {
......
......@@ -158,6 +158,8 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
#endif // V8_ENABLE_WEBASSEMBLY
must_save_lr_(!gen->frame_access_state()->has_frame()),
zone_(gen->zone()) {
DCHECK(!AreAliased(object, index, scratch0, scratch1));
DCHECK(!AreAliased(value, index, scratch0, scratch1));
}
void Generate() final {
......
......@@ -160,6 +160,8 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
#endif // V8_ENABLE_WEBASSEMBLY
must_save_lr_(!gen->frame_access_state()->has_frame()),
zone_(gen->zone()) {
DCHECK(!AreAliased(object, index, scratch0, scratch1));
DCHECK(!AreAliased(value, index, scratch0, scratch1));
}
void Generate() final {
......
......@@ -150,6 +150,8 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
must_save_lr_(!gen->frame_access_state()->has_frame()),
unwinding_info_writer_(unwinding_info_writer),
zone_(gen->zone()) {
DCHECK(!AreAliased(object, offset, scratch0, scratch1));
DCHECK(!AreAliased(value, offset, scratch0, scratch1));
}
OutOfLineRecordWrite(CodeGenerator* gen, Register object, int32_t offset,
......
......@@ -154,7 +154,10 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
mode_(mode),
stub_mode_(stub_mode),
must_save_lr_(!gen->frame_access_state()->has_frame()),
zone_(gen->zone()) {}
zone_(gen->zone()) {
DCHECK(!AreAliased(object, index, scratch0, scratch1));
DCHECK(!AreAliased(value, index, scratch0, scratch1));
}
void Generate() final {
__ CheckPageFlag(value_, scratch0_,
......
......@@ -186,6 +186,8 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
must_save_lr_(!gen->frame_access_state()->has_frame()),
unwinding_info_writer_(unwinding_info_writer),
zone_(gen->zone()) {
DCHECK(!AreAliased(object, offset, scratch0, scratch1));
DCHECK(!AreAliased(value, offset, scratch0, scratch1));
}
OutOfLineRecordWrite(CodeGenerator* gen, Register object, int32_t offset,
......
......@@ -273,6 +273,8 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
stub_mode_(stub_mode),
#endif // V8_ENABLE_WEBASSEMBLY
zone_(gen->zone()) {
DCHECK(!AreAliased(object, scratch0, scratch1));
DCHECK(!AreAliased(value, scratch0, scratch1));
}
void Generate() final {
......
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