s390x: [baseline] implement Tail/CallBuiltin

Change-Id: I68f9e6e8edc7054bec7e838f0d3b007be196d240
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3312157
Reviewed-by: Milad Farazmand <mfarazma@redhat.com>
Commit-Queue: Junliang Yan <junyan@redhat.com>
Cr-Commit-Position: refs/heads/main@{#78197}
This commit is contained in:
Junliang Yan 2021-12-01 16:16:32 -05:00 committed by V8 LUCI CQ
parent ef94d230bf
commit 516c17fb3a
3 changed files with 28 additions and 2 deletions

View File

@ -171,12 +171,30 @@ void BaselineAssembler::JumpIfNotSmi(Register value, Label* target,
__ JumpIfNotSmi(value, target); __ JumpIfNotSmi(value, target);
} }
void BaselineAssembler::CallBuiltin(Builtin builtin) { UNIMPLEMENTED(); } void BaselineAssembler::CallBuiltin(Builtin builtin) {
if (masm()->options().short_builtin_calls) {
// Generate pc-relative call.
__ CallBuiltin(builtin);
} else {
ScratchRegisterScope temps(this);
Register temp = temps.AcquireScratch();
__ LoadEntryFromBuiltin(builtin, temp);
__ Call(temp);
}
}
void BaselineAssembler::TailCallBuiltin(Builtin builtin) { void BaselineAssembler::TailCallBuiltin(Builtin builtin) {
ASM_CODE_COMMENT_STRING(masm_, ASM_CODE_COMMENT_STRING(masm_,
__ CommentForOffHeapTrampoline("tail call", builtin)); __ CommentForOffHeapTrampoline("tail call", builtin));
UNIMPLEMENTED(); if (masm()->options().short_builtin_calls) {
// Generate pc-relative call.
__ TailCallBuiltin(builtin);
} else {
ScratchRegisterScope temps(this);
Register temp = temps.AcquireScratch();
__ LoadEntryFromBuiltin(builtin, temp);
__ Jump(temp);
}
} }
void BaselineAssembler::TestAndBranch(Register value, int mask, Condition cc, void BaselineAssembler::TestAndBranch(Register value, int mask, Condition cc,

View File

@ -496,6 +496,13 @@ void TurboAssembler::CallBuiltin(Builtin builtin) {
Call(ip); Call(ip);
} }
void TurboAssembler::TailCallBuiltin(Builtin builtin) {
ASM_CODE_COMMENT_STRING(this,
CommentForOffHeapTrampoline("tail call", builtin));
mov(ip, Operand(BuiltinEntry(builtin), RelocInfo::OFF_HEAP_TARGET));
b(ip);
}
void TurboAssembler::Drop(int count) { void TurboAssembler::Drop(int count) {
if (count > 0) { if (count > 0) {
int total = count * kSystemPointerSize; int total = count * kSystemPointerSize;

View File

@ -45,6 +45,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
using TurboAssemblerBase::TurboAssemblerBase; using TurboAssemblerBase::TurboAssemblerBase;
void CallBuiltin(Builtin builtin); void CallBuiltin(Builtin builtin);
void TailCallBuiltin(Builtin builtin);
void AtomicCmpExchangeHelper(Register addr, Register output, void AtomicCmpExchangeHelper(Register addr, Register output,
Register old_value, Register new_value, Register old_value, Register new_value,
int start, int end, int shift_amount, int offset, int start, int end, int shift_amount, int offset,