[macro-assembler] Avoid using the isolate in CallRecordWriteStub
CallRecordWriteStub is used in a background compile thread for JS-to-Wasm wrapper compilation, so it should avoid accessing the isolate. Call the builtin using CallBuiltin which does not require a Handle<Code> object and instead gets the call target directly from the embedded data. R=clemensb@chromium.org Bug: chromium:1146813 Change-Id: I4ee59084e4184f2e9039208e4e6db43482cefde6 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2593333 Reviewed-by: Clemens Backes <clemensb@chromium.org> Commit-Queue: Thibaud Michaud <thibaudm@chromium.org> Cr-Commit-Position: refs/heads/master@{#71785}
This commit is contained in:
parent
43d61196b0
commit
6b3994e850
@ -716,23 +716,22 @@ void TurboAssembler::CallEphemeronKeyBarrier(Register object, Operand offset,
|
|||||||
void TurboAssembler::CallRecordWriteStub(
|
void TurboAssembler::CallRecordWriteStub(
|
||||||
Register object, Operand offset, RememberedSetAction remembered_set_action,
|
Register object, Operand offset, RememberedSetAction remembered_set_action,
|
||||||
SaveFPRegsMode fp_mode) {
|
SaveFPRegsMode fp_mode) {
|
||||||
CallRecordWriteStub(
|
CallRecordWriteStub(object, offset, remembered_set_action, fp_mode,
|
||||||
object, offset, remembered_set_action, fp_mode,
|
Builtins::kRecordWrite, kNullAddress);
|
||||||
isolate()->builtins()->builtin_handle(Builtins::kRecordWrite),
|
|
||||||
kNullAddress);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TurboAssembler::CallRecordWriteStub(
|
void TurboAssembler::CallRecordWriteStub(
|
||||||
Register object, Operand offset, RememberedSetAction remembered_set_action,
|
Register object, Operand offset, RememberedSetAction remembered_set_action,
|
||||||
SaveFPRegsMode fp_mode, Address wasm_target) {
|
SaveFPRegsMode fp_mode, Address wasm_target) {
|
||||||
CallRecordWriteStub(object, offset, remembered_set_action, fp_mode,
|
CallRecordWriteStub(object, offset, remembered_set_action, fp_mode,
|
||||||
Handle<Code>::null(), wasm_target);
|
Builtins::kNoBuiltinId, wasm_target);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TurboAssembler::CallRecordWriteStub(
|
void TurboAssembler::CallRecordWriteStub(
|
||||||
Register object, Operand offset, RememberedSetAction remembered_set_action,
|
Register object, Operand offset, RememberedSetAction remembered_set_action,
|
||||||
SaveFPRegsMode fp_mode, Handle<Code> code_target, Address wasm_target) {
|
SaveFPRegsMode fp_mode, int builtin_index, Address wasm_target) {
|
||||||
DCHECK_NE(code_target.is_null(), wasm_target == kNullAddress);
|
DCHECK_NE(builtin_index == Builtins::kNoBuiltinId,
|
||||||
|
wasm_target == kNullAddress);
|
||||||
// TODO(albertnetymk): For now we ignore remembered_set_action and fp_mode,
|
// TODO(albertnetymk): For now we ignore remembered_set_action and fp_mode,
|
||||||
// i.e. always emit remember set and save FP registers in RecordWriteStub. If
|
// i.e. always emit remember set and save FP registers in RecordWriteStub. If
|
||||||
// large performance regression is observed, we should use these values to
|
// large performance regression is observed, we should use these values to
|
||||||
@ -756,9 +755,13 @@ void TurboAssembler::CallRecordWriteStub(
|
|||||||
|
|
||||||
Move(remembered_set_parameter, Smi::FromEnum(remembered_set_action));
|
Move(remembered_set_parameter, Smi::FromEnum(remembered_set_action));
|
||||||
Move(fp_mode_parameter, Smi::FromEnum(fp_mode));
|
Move(fp_mode_parameter, Smi::FromEnum(fp_mode));
|
||||||
if (code_target.is_null()) {
|
if (builtin_index == Builtins::kNoBuiltinId) {
|
||||||
Call(wasm_target, RelocInfo::WASM_STUB_CALL);
|
Call(wasm_target, RelocInfo::WASM_STUB_CALL);
|
||||||
|
} else if (options().inline_offheap_trampolines) {
|
||||||
|
CallBuiltin(builtin_index);
|
||||||
} else {
|
} else {
|
||||||
|
Handle<Code> code_target =
|
||||||
|
isolate()->builtins()->builtin_handle(Builtins::kRecordWrite);
|
||||||
Call(code_target, RelocInfo::CODE_TARGET);
|
Call(code_target, RelocInfo::CODE_TARGET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -604,7 +604,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
|
|||||||
|
|
||||||
void CallRecordWriteStub(Register object, Operand offset,
|
void CallRecordWriteStub(Register object, Operand offset,
|
||||||
RememberedSetAction remembered_set_action,
|
RememberedSetAction remembered_set_action,
|
||||||
SaveFPRegsMode fp_mode, Handle<Code> code_target,
|
SaveFPRegsMode fp_mode, int builtin_index,
|
||||||
Address wasm_target);
|
Address wasm_target);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2882,23 +2882,22 @@ void TurboAssembler::CallEphemeronKeyBarrier(Register object, Operand offset,
|
|||||||
void TurboAssembler::CallRecordWriteStub(
|
void TurboAssembler::CallRecordWriteStub(
|
||||||
Register object, Operand offset, RememberedSetAction remembered_set_action,
|
Register object, Operand offset, RememberedSetAction remembered_set_action,
|
||||||
SaveFPRegsMode fp_mode) {
|
SaveFPRegsMode fp_mode) {
|
||||||
CallRecordWriteStub(
|
CallRecordWriteStub(object, offset, remembered_set_action, fp_mode,
|
||||||
object, offset, remembered_set_action, fp_mode,
|
Builtins::kRecordWrite, kNullAddress);
|
||||||
isolate()->builtins()->builtin_handle(Builtins::kRecordWrite),
|
|
||||||
kNullAddress);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TurboAssembler::CallRecordWriteStub(
|
void TurboAssembler::CallRecordWriteStub(
|
||||||
Register object, Operand offset, RememberedSetAction remembered_set_action,
|
Register object, Operand offset, RememberedSetAction remembered_set_action,
|
||||||
SaveFPRegsMode fp_mode, Address wasm_target) {
|
SaveFPRegsMode fp_mode, Address wasm_target) {
|
||||||
CallRecordWriteStub(object, offset, remembered_set_action, fp_mode,
|
CallRecordWriteStub(object, offset, remembered_set_action, fp_mode,
|
||||||
Handle<Code>::null(), wasm_target);
|
Builtins::kNoBuiltinId, wasm_target);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TurboAssembler::CallRecordWriteStub(
|
void TurboAssembler::CallRecordWriteStub(
|
||||||
Register object, Operand offset, RememberedSetAction remembered_set_action,
|
Register object, Operand offset, RememberedSetAction remembered_set_action,
|
||||||
SaveFPRegsMode fp_mode, Handle<Code> code_target, Address wasm_target) {
|
SaveFPRegsMode fp_mode, int builtin_index, Address wasm_target) {
|
||||||
DCHECK_NE(code_target.is_null(), wasm_target == kNullAddress);
|
DCHECK_NE(builtin_index == Builtins::kNoBuiltinId,
|
||||||
|
wasm_target == kNullAddress);
|
||||||
// TODO(albertnetymk): For now we ignore remembered_set_action and fp_mode,
|
// TODO(albertnetymk): For now we ignore remembered_set_action and fp_mode,
|
||||||
// i.e. always emit remember set and save FP registers in RecordWriteStub. If
|
// i.e. always emit remember set and save FP registers in RecordWriteStub. If
|
||||||
// large performance regression is observed, we should use these values to
|
// large performance regression is observed, we should use these values to
|
||||||
@ -2922,9 +2921,13 @@ void TurboAssembler::CallRecordWriteStub(
|
|||||||
|
|
||||||
Mov(remembered_set_parameter, Smi::FromEnum(remembered_set_action));
|
Mov(remembered_set_parameter, Smi::FromEnum(remembered_set_action));
|
||||||
Mov(fp_mode_parameter, Smi::FromEnum(fp_mode));
|
Mov(fp_mode_parameter, Smi::FromEnum(fp_mode));
|
||||||
if (code_target.is_null()) {
|
if (builtin_index == Builtins::kNoBuiltinId) {
|
||||||
Call(wasm_target, RelocInfo::WASM_STUB_CALL);
|
Call(wasm_target, RelocInfo::WASM_STUB_CALL);
|
||||||
|
} else if (options().inline_offheap_trampolines) {
|
||||||
|
CallBuiltin(builtin_index);
|
||||||
} else {
|
} else {
|
||||||
|
Handle<Code> code_target =
|
||||||
|
isolate()->builtins()->builtin_handle(Builtins::kRecordWrite);
|
||||||
Call(code_target, RelocInfo::CODE_TARGET);
|
Call(code_target, RelocInfo::CODE_TARGET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1440,7 +1440,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
|
|||||||
|
|
||||||
void CallRecordWriteStub(Register object, Operand offset,
|
void CallRecordWriteStub(Register object, Operand offset,
|
||||||
RememberedSetAction remembered_set_action,
|
RememberedSetAction remembered_set_action,
|
||||||
SaveFPRegsMode fp_mode, Handle<Code> code_target,
|
SaveFPRegsMode fp_mode, int builtin_index,
|
||||||
Address wasm_target);
|
Address wasm_target);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -443,10 +443,8 @@ void TurboAssembler::CallEphemeronKeyBarrier(Register object, Register address,
|
|||||||
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) {
|
||||||
CallRecordWriteStub(
|
CallRecordWriteStub(object, address, remembered_set_action, fp_mode,
|
||||||
object, address, remembered_set_action, fp_mode,
|
Builtins::kRecordWrite, kNullAddress);
|
||||||
isolate()->builtins()->builtin_handle(Builtins::kRecordWrite),
|
|
||||||
kNullAddress);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TurboAssembler::CallRecordWriteStub(
|
void TurboAssembler::CallRecordWriteStub(
|
||||||
@ -454,14 +452,15 @@ void TurboAssembler::CallRecordWriteStub(
|
|||||||
RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode,
|
RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode,
|
||||||
Address wasm_target) {
|
Address wasm_target) {
|
||||||
CallRecordWriteStub(object, address, remembered_set_action, fp_mode,
|
CallRecordWriteStub(object, address, remembered_set_action, fp_mode,
|
||||||
Handle<Code>::null(), wasm_target);
|
Builtins::kNoBuiltinId, wasm_target);
|
||||||
}
|
}
|
||||||
|
|
||||||
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,
|
||||||
Handle<Code> code_target, Address wasm_target) {
|
int builtin_index, Address wasm_target) {
|
||||||
DCHECK_NE(code_target.is_null(), wasm_target == kNullAddress);
|
DCHECK_NE(builtin_index == Builtins::kNoBuiltinId,
|
||||||
|
wasm_target == kNullAddress);
|
||||||
// TODO(albertnetymk): For now we ignore remembered_set_action and fp_mode,
|
// TODO(albertnetymk): For now we ignore remembered_set_action and fp_mode,
|
||||||
// i.e. always emit remember set and save FP registers in RecordWriteStub. If
|
// i.e. always emit remember set and save FP registers in RecordWriteStub. If
|
||||||
// large performance regression is observed, we should use these values to
|
// large performance regression is observed, we should use these values to
|
||||||
@ -489,10 +488,14 @@ void TurboAssembler::CallRecordWriteStub(
|
|||||||
|
|
||||||
Move(remembered_set_parameter, Smi::FromEnum(remembered_set_action));
|
Move(remembered_set_parameter, Smi::FromEnum(remembered_set_action));
|
||||||
Move(fp_mode_parameter, Smi::FromEnum(fp_mode));
|
Move(fp_mode_parameter, Smi::FromEnum(fp_mode));
|
||||||
if (code_target.is_null()) {
|
if (builtin_index == Builtins::kNoBuiltinId) {
|
||||||
// Use {wasm_call} for direct Wasm call within a module.
|
// Use {wasm_call} for direct Wasm call within a module.
|
||||||
wasm_call(wasm_target, RelocInfo::WASM_STUB_CALL);
|
wasm_call(wasm_target, RelocInfo::WASM_STUB_CALL);
|
||||||
|
} else if (options().inline_offheap_trampolines) {
|
||||||
|
CallBuiltin(builtin_index);
|
||||||
} else {
|
} else {
|
||||||
|
Handle<Code> code_target =
|
||||||
|
isolate()->builtins()->builtin_handle(Builtins::kRecordWrite);
|
||||||
Call(code_target, RelocInfo::CODE_TARGET);
|
Call(code_target, RelocInfo::CODE_TARGET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -665,7 +665,7 @@ 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, Handle<Code> code_target,
|
SaveFPRegsMode fp_mode, int builtin_index,
|
||||||
Address wasm_target);
|
Address wasm_target);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -389,10 +389,8 @@ void TurboAssembler::CallEphemeronKeyBarrier(Register object, Register address,
|
|||||||
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) {
|
||||||
CallRecordWriteStub(
|
CallRecordWriteStub(object, address, remembered_set_action, fp_mode,
|
||||||
object, address, remembered_set_action, fp_mode,
|
Builtins::kRecordWrite, kNullAddress);
|
||||||
isolate()->builtins()->builtin_handle(Builtins::kRecordWrite),
|
|
||||||
kNullAddress);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TurboAssembler::CallRecordWriteStub(
|
void TurboAssembler::CallRecordWriteStub(
|
||||||
@ -400,14 +398,15 @@ void TurboAssembler::CallRecordWriteStub(
|
|||||||
RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode,
|
RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode,
|
||||||
Address wasm_target) {
|
Address wasm_target) {
|
||||||
CallRecordWriteStub(object, address, remembered_set_action, fp_mode,
|
CallRecordWriteStub(object, address, remembered_set_action, fp_mode,
|
||||||
Handle<Code>::null(), wasm_target);
|
Builtins::kNoBuiltinId, wasm_target);
|
||||||
}
|
}
|
||||||
|
|
||||||
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,
|
||||||
Handle<Code> code_target, Address wasm_target) {
|
int builtin_index, Address wasm_target) {
|
||||||
DCHECK_NE(code_target.is_null(), wasm_target == kNullAddress);
|
DCHECK_NE(builtin_index == Builtins::kNoBuiltinId,
|
||||||
|
wasm_target == kNullAddress);
|
||||||
|
|
||||||
RecordWriteDescriptor descriptor;
|
RecordWriteDescriptor descriptor;
|
||||||
RegList registers = descriptor.allocatable_registers();
|
RegList registers = descriptor.allocatable_registers();
|
||||||
@ -436,10 +435,14 @@ void TurboAssembler::CallRecordWriteStub(
|
|||||||
} else {
|
} else {
|
||||||
movq(fp_mode_parameter, remembered_set_parameter);
|
movq(fp_mode_parameter, remembered_set_parameter);
|
||||||
}
|
}
|
||||||
if (code_target.is_null()) {
|
if (builtin_index == Builtins::kNoBuiltinId) {
|
||||||
// Use {near_call} for direct Wasm call within a module.
|
// Use {near_call} for direct Wasm call within a module.
|
||||||
near_call(wasm_target, RelocInfo::WASM_STUB_CALL);
|
near_call(wasm_target, RelocInfo::WASM_STUB_CALL);
|
||||||
|
} else if (options().inline_offheap_trampolines) {
|
||||||
|
CallBuiltin(builtin_index);
|
||||||
} else {
|
} else {
|
||||||
|
Handle<Code> code_target =
|
||||||
|
isolate()->builtins()->builtin_handle(Builtins::kRecordWrite);
|
||||||
Call(code_target, RelocInfo::CODE_TARGET);
|
Call(code_target, RelocInfo::CODE_TARGET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -730,7 +730,7 @@ 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, Handle<Code> code_target,
|
SaveFPRegsMode fp_mode, int builtin_index,
|
||||||
Address wasm_target);
|
Address wasm_target);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user