diff --git a/src/compiler/backend/ppc/code-generator-ppc.cc b/src/compiler/backend/ppc/code-generator-ppc.cc index b861c3d026..fd954d94c8 100644 --- a/src/compiler/backend/ppc/code-generator-ppc.cc +++ b/src/compiler/backend/ppc/code-generator-ppc.cc @@ -180,7 +180,9 @@ class OutOfLineRecordWrite final : public OutOfLineCode { __ mflr(scratch0_); __ Push(scratch0_); } - if (stub_mode_ == StubCallMode::kCallWasmRuntimeStub) { + if (mode_ == RecordWriteMode::kValueIsEphemeronKey) { + __ CallEphemeronKeyBarrier(object_, scratch1_, save_fp_mode); + } else if (stub_mode_ == StubCallMode::kCallWasmRuntimeStub) { __ CallRecordWriteStub(object_, scratch1_, remembered_set_action, save_fp_mode, wasm::WasmCode::kWasmRecordWrite); } else { diff --git a/src/compiler/backend/s390/code-generator-s390.cc b/src/compiler/backend/s390/code-generator-s390.cc index cbca355ca8..bd72664acc 100644 --- a/src/compiler/backend/s390/code-generator-s390.cc +++ b/src/compiler/backend/s390/code-generator-s390.cc @@ -217,7 +217,9 @@ class OutOfLineRecordWrite final : public OutOfLineCode { // We need to save and restore r14 if the frame was elided. __ Push(r14); } - if (stub_mode_ == StubCallMode::kCallWasmRuntimeStub) { + if (mode_ == RecordWriteMode::kValueIsEphemeronKey) { + __ CallEphemeronKeyBarrier(object_, scratch1_, save_fp_mode); + } else if (stub_mode_ == StubCallMode::kCallWasmRuntimeStub) { __ CallRecordWriteStub(object_, scratch1_, remembered_set_action, save_fp_mode, wasm::WasmCode::kWasmRecordWrite); } else { diff --git a/src/ppc/interface-descriptors-ppc.cc b/src/ppc/interface-descriptors-ppc.cc index 20e395834c..a9f9635bd5 100644 --- a/src/ppc/interface-descriptors-ppc.cc +++ b/src/ppc/interface-descriptors-ppc.cc @@ -34,6 +34,18 @@ void RecordWriteDescriptor::InitializePlatformSpecific( data->InitializePlatformSpecific(kParameterCount, default_stub_registers); } +void EphemeronKeyBarrierDescriptor::InitializePlatformSpecific( + CallInterfaceDescriptorData* data) { + const Register default_stub_registers[] = {r3, r4, r5, r6, r7}; + + data->RestrictAllocatableRegisters(default_stub_registers, + arraysize(default_stub_registers)); + + CHECK_LE(static_cast(kParameterCount), + arraysize(default_stub_registers)); + data->InitializePlatformSpecific(kParameterCount, default_stub_registers); +} + const Register FastNewFunctionContextDescriptor::ScopeInfoRegister() { return r4; } diff --git a/src/ppc/macro-assembler-ppc.cc b/src/ppc/macro-assembler-ppc.cc index 9462ee4aa1..708cb30c60 100644 --- a/src/ppc/macro-assembler-ppc.cc +++ b/src/ppc/macro-assembler-ppc.cc @@ -459,6 +459,32 @@ void TurboAssembler::RestoreRegisters(RegList registers) { MultiPop(regs); } +void TurboAssembler::CallEphemeronKeyBarrier(Register object, Register address, + SaveFPRegsMode fp_mode) { + EphemeronKeyBarrierDescriptor descriptor; + RegList registers = descriptor.allocatable_registers(); + + SaveRegisters(registers); + + Register object_parameter( + descriptor.GetRegisterParameter(EphemeronKeyBarrierDescriptor::kObject)); + Register slot_parameter(descriptor.GetRegisterParameter( + EphemeronKeyBarrierDescriptor::kSlotAddress)); + Register fp_mode_parameter( + descriptor.GetRegisterParameter(EphemeronKeyBarrierDescriptor::kFPMode)); + + push(object); + push(address); + + pop(slot_parameter); + pop(object_parameter); + + Move(fp_mode_parameter, Smi::FromEnum(fp_mode)); + Call(isolate()->builtins()->builtin_handle(Builtins::kEphemeronKeyBarrier), + RelocInfo::CODE_TARGET); + RestoreRegisters(registers); +} + void TurboAssembler::CallRecordWriteStub( Register object, Register address, RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode) { diff --git a/src/ppc/macro-assembler-ppc.h b/src/ppc/macro-assembler-ppc.h index f67666ce33..c010e6a2bd 100644 --- a/src/ppc/macro-assembler-ppc.h +++ b/src/ppc/macro-assembler-ppc.h @@ -272,6 +272,8 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { void CallRecordWriteStub(Register object, Register address, RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode, Address wasm_target); + void CallEphemeronKeyBarrier(Register object, Register address, + SaveFPRegsMode fp_mode); void MultiPush(RegList regs, Register location = sp); void MultiPop(RegList regs, Register location = sp); diff --git a/src/s390/interface-descriptors-s390.cc b/src/s390/interface-descriptors-s390.cc index da51d195ff..70033be214 100644 --- a/src/s390/interface-descriptors-s390.cc +++ b/src/s390/interface-descriptors-s390.cc @@ -34,6 +34,18 @@ void RecordWriteDescriptor::InitializePlatformSpecific( data->InitializePlatformSpecific(kParameterCount, default_stub_registers); } +void EphemeronKeyBarrierDescriptor::InitializePlatformSpecific( + CallInterfaceDescriptorData* data) { + const Register default_stub_registers[] = {r2, r3, r4, r5, r6}; + + data->RestrictAllocatableRegisters(default_stub_registers, + arraysize(default_stub_registers)); + + CHECK_LE(static_cast(kParameterCount), + arraysize(default_stub_registers)); + data->InitializePlatformSpecific(kParameterCount, default_stub_registers); +} + const Register FastNewFunctionContextDescriptor::ScopeInfoRegister() { return r3; } diff --git a/src/s390/macro-assembler-s390.cc b/src/s390/macro-assembler-s390.cc index e2ac0fa973..03ebdb0c7b 100644 --- a/src/s390/macro-assembler-s390.cc +++ b/src/s390/macro-assembler-s390.cc @@ -478,6 +478,32 @@ void TurboAssembler::RestoreRegisters(RegList registers) { MultiPop(regs); } +void TurboAssembler::CallEphemeronKeyBarrier(Register object, Register address, + SaveFPRegsMode fp_mode) { + EphemeronKeyBarrierDescriptor descriptor; + RegList registers = descriptor.allocatable_registers(); + + SaveRegisters(registers); + + Register object_parameter( + descriptor.GetRegisterParameter(EphemeronKeyBarrierDescriptor::kObject)); + Register slot_parameter(descriptor.GetRegisterParameter( + EphemeronKeyBarrierDescriptor::kSlotAddress)); + Register fp_mode_parameter( + descriptor.GetRegisterParameter(EphemeronKeyBarrierDescriptor::kFPMode)); + + Push(object); + Push(address); + + Pop(slot_parameter); + Pop(object_parameter); + + Move(fp_mode_parameter, Smi::FromEnum(fp_mode)); + Call(isolate()->builtins()->builtin_handle(Builtins::kEphemeronKeyBarrier), + RelocInfo::CODE_TARGET); + RestoreRegisters(registers); +} + void TurboAssembler::CallRecordWriteStub( Register object, Register address, RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode) { diff --git a/src/s390/macro-assembler-s390.h b/src/s390/macro-assembler-s390.h index 90f5e1fc44..be3785c035 100644 --- a/src/s390/macro-assembler-s390.h +++ b/src/s390/macro-assembler-s390.h @@ -203,6 +203,8 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { void CallRecordWriteStub(Register object, Register address, RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode, Address wasm_target); + void CallEphemeronKeyBarrier(Register object, Register address, + SaveFPRegsMode fp_mode); void MultiPush(RegList regs, Register location = sp); void MultiPop(RegList regs, Register location = sp);