Commit 94881314 authored by Yu Yin's avatar Yu Yin Committed by Commit Bot

[mips32][heap] Clean-up keys of oldspace weakmaps during scavenge

port https://crrev.com/c/1541476

Original Commit Message:

     This CL adds handling for cleaning up weakmap (EphemeronHashTable)
     keys during scavenge, even if the weakmap resides in oldspace.

Change-Id: If6e06ea8621fd6aff374c04247c3168b2cbb361a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1568712Reviewed-by: 's avatarBill Budge <bbudge@chromium.org>
Commit-Queue: Yu Yin <xwafish@gmail.com>
Cr-Commit-Position: refs/heads/master@{#60912}
parent 912b3912
...@@ -171,7 +171,9 @@ class OutOfLineRecordWrite final : public OutOfLineCode { ...@@ -171,7 +171,9 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
__ Push(ra); __ Push(ra);
} }
if (stub_mode_ == StubCallMode::kCallWasmRuntimeStub) { if (mode_ == RecordWriteMode::kValueIsEphemeronKey) {
__ CallEphemeronKeyBarrier(object_, scratch1_, save_fp_mode);
} else if (stub_mode_ == StubCallMode::kCallWasmRuntimeStub) {
// A direct call to a wasm runtime stub defined in this module. // A direct call to a wasm runtime stub defined in this module.
// Just encode the stub index. This will be patched when the code // Just encode the stub index. This will be patched when the code
// is added to the native module and copied into wasm code space. // is added to the native module and copied into wasm code space.
......
...@@ -61,6 +61,18 @@ void RecordWriteDescriptor::InitializePlatformSpecific( ...@@ -61,6 +61,18 @@ void RecordWriteDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(kParameterCount, default_stub_registers); data->InitializePlatformSpecific(kParameterCount, default_stub_registers);
} }
void EphemeronKeyBarrierDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
const Register default_stub_registers[] = {a0, a1, a2, a3, kReturnRegister0};
data->RestrictAllocatableRegisters(default_stub_registers,
arraysize(default_stub_registers));
CHECK_LE(static_cast<size_t>(kParameterCount),
arraysize(default_stub_registers));
data->InitializePlatformSpecific(kParameterCount, default_stub_registers);
}
const Register FastNewFunctionContextDescriptor::ScopeInfoRegister() { const Register FastNewFunctionContextDescriptor::ScopeInfoRegister() {
return a1; return a1;
} }
......
...@@ -251,6 +251,32 @@ void TurboAssembler::RestoreRegisters(RegList registers) { ...@@ -251,6 +251,32 @@ void TurboAssembler::RestoreRegisters(RegList registers) {
MultiPop(regs); 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( void TurboAssembler::CallRecordWriteStub(
Register object, Register address, Register object, Register address,
RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode) { RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode) {
......
...@@ -329,6 +329,8 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { ...@@ -329,6 +329,8 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
void CallRecordWriteStub(Register object, Register address, void CallRecordWriteStub(Register object, Register address,
RememberedSetAction remembered_set_action, RememberedSetAction remembered_set_action,
SaveFPRegsMode fp_mode, Address wasm_target); SaveFPRegsMode fp_mode, Address wasm_target);
void CallEphemeronKeyBarrier(Register object, Register address,
SaveFPRegsMode fp_mode);
// Push multiple registers on the stack. // Push multiple registers on the stack.
// Registers are saved in numerical order, with higher numbered registers // Registers are saved in numerical order, with higher numbered registers
......
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