Commit 67ac2a7d authored by Milad Fa's avatar Milad Fa Committed by Commit Bot

PPC/s390: [macro-assembler] Avoid using the isolate in CallRecordWriteStub

Port 6b3994e8

Original Commit Message:

    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=thibaudm@chromium.org, joransiu@ca.ibm.com, junyan@redhat.com, midawson@redhat.com
BUG=
LOG=N

Change-Id: Ibf3cb676b15d3ab946c673e38c454c8050ff1435
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2595292Reviewed-by: 's avatarJunliang Yan <junyan@redhat.com>
Commit-Queue: Milad Fa <mfarazma@redhat.com>
Cr-Commit-Position: refs/heads/master@{#71801}
parent ae78e0c0
......@@ -647,10 +647,8 @@ void TurboAssembler::CallEphemeronKeyBarrier(Register object, Register address,
void TurboAssembler::CallRecordWriteStub(
Register object, Register address,
RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode) {
CallRecordWriteStub(
object, address, remembered_set_action, fp_mode,
isolate()->builtins()->builtin_handle(Builtins::kRecordWrite),
kNullAddress);
CallRecordWriteStub(object, address, remembered_set_action, fp_mode,
Builtins::kRecordWrite, kNullAddress);
}
void TurboAssembler::CallRecordWriteStub(
......@@ -658,14 +656,15 @@ void TurboAssembler::CallRecordWriteStub(
RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode,
Address wasm_target) {
CallRecordWriteStub(object, address, remembered_set_action, fp_mode,
Handle<Code>::null(), wasm_target);
Builtins::kNoBuiltinId, wasm_target);
}
void TurboAssembler::CallRecordWriteStub(
Register object, Register address,
RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode,
Handle<Code> code_target, Address wasm_target) {
DCHECK_NE(code_target.is_null(), wasm_target == kNullAddress);
int builtin_index, Address wasm_target) {
DCHECK_NE(builtin_index == Builtins::kNoBuiltinId,
wasm_target == kNullAddress);
// 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
// large performance regression is observed, we should use these values to
......@@ -693,9 +692,19 @@ void TurboAssembler::CallRecordWriteStub(
Move(remembered_set_parameter, Smi::FromEnum(remembered_set_action));
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);
} else if (options().inline_offheap_trampolines) {
RecordCommentForOffHeapTrampoline(builtin_index);
EmbeddedData d = EmbeddedData::FromBlob();
Address entry = d.InstructionStartOfBuiltin(builtin_index);
// Use ip directly instead of using UseScratchRegisterScope, as we do
// not preserve scratch registers across calls.
mov(ip, Operand(entry, RelocInfo::OFF_HEAP_TARGET));
Call(ip);
} else {
Handle<Code> code_target =
isolate()->builtins()->builtin_handle(Builtins::kRecordWrite);
Call(code_target, RelocInfo::CODE_TARGET);
}
......
......@@ -719,7 +719,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
bool has_function_descriptor);
void CallRecordWriteStub(Register object, Register address,
RememberedSetAction remembered_set_action,
SaveFPRegsMode fp_mode, Handle<Code> code_target,
SaveFPRegsMode fp_mode, int builtin_index,
Address wasm_target);
};
......
......@@ -812,10 +812,8 @@ void TurboAssembler::CallEphemeronKeyBarrier(Register object, Register address,
void TurboAssembler::CallRecordWriteStub(
Register object, Register address,
RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode) {
CallRecordWriteStub(
object, address, remembered_set_action, fp_mode,
isolate()->builtins()->builtin_handle(Builtins::kRecordWrite),
kNullAddress);
CallRecordWriteStub(object, address, remembered_set_action, fp_mode,
Builtins::kRecordWrite, kNullAddress);
}
void TurboAssembler::CallRecordWriteStub(
......@@ -823,14 +821,15 @@ void TurboAssembler::CallRecordWriteStub(
RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode,
Address wasm_target) {
CallRecordWriteStub(object, address, remembered_set_action, fp_mode,
Handle<Code>::null(), wasm_target);
Builtins::kNoBuiltinId, wasm_target);
}
void TurboAssembler::CallRecordWriteStub(
Register object, Register address,
RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode,
Handle<Code> code_target, Address wasm_target) {
DCHECK_NE(code_target.is_null(), wasm_target == kNullAddress);
int builtin_index, Address wasm_target) {
DCHECK_NE(builtin_index == Builtins::kNoBuiltinId,
wasm_target == kNullAddress);
// 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
// large performance regression is observed, we should use these values to
......@@ -857,9 +856,18 @@ void TurboAssembler::CallRecordWriteStub(
Move(remembered_set_parameter, Smi::FromEnum(remembered_set_action));
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);
} else if (options().inline_offheap_trampolines) {
RecordCommentForOffHeapTrampoline(builtin_index);
CHECK_NE(builtin_index, Builtins::kNoBuiltinId);
EmbeddedData d = EmbeddedData::FromBlob();
Address entry = d.InstructionStartOfBuiltin(builtin_index);
mov(ip, Operand(entry, RelocInfo::OFF_HEAP_TARGET));
Call(ip);
} else {
Handle<Code> code_target =
isolate()->builtins()->builtin_handle(Builtins::kRecordWrite);
Call(code_target, RelocInfo::CODE_TARGET);
}
......
......@@ -975,7 +975,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
void CallRecordWriteStub(Register object, Register address,
RememberedSetAction remembered_set_action,
SaveFPRegsMode fp_mode, Handle<Code> code_target,
SaveFPRegsMode fp_mode, int builtin_index,
Address wasm_target);
void Jump(intptr_t target, RelocInfo::Mode rmode, Condition cond = al);
......
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