ppc64: [baseline] implement Tail/CallBuiltin

Change-Id: Ife52b4279aa17e73316a77c5b4ef6f03bef763b7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3555886
Reviewed-by: Milad Farazmand <mfarazma@redhat.com>
Commit-Queue: Junliang Yan <junyan@redhat.com>
Cr-Commit-Position: refs/heads/main@{#79641}
This commit is contained in:
Junliang Yan 2022-03-28 10:33:32 -04:00 committed by V8 LUCI CQ
parent ede0a4abee
commit 23ee49ada0
3 changed files with 43 additions and 2 deletions

View File

@ -197,12 +197,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, al);
} 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

@ -279,6 +279,13 @@ void TurboAssembler::CallBuiltin(Builtin builtin, Condition cond) {
bind(&skip); bind(&skip);
} }
void TurboAssembler::TailCallBuiltin(Builtin builtin) {
ASM_CODE_COMMENT_STRING(this,
CommentForOffHeapTrampoline("tail call", builtin));
mov(ip, Operand(BuiltinEntry(builtin), RelocInfo::OFF_HEAP_TARGET));
Jump(ip);
}
void TurboAssembler::Drop(int count) { void TurboAssembler::Drop(int count) {
if (count > 0) { if (count > 0) {
AddS64(sp, sp, Operand(count * kSystemPointerSize), r0); AddS64(sp, sp, Operand(count * kSystemPointerSize), r0);
@ -3603,6 +3610,19 @@ void TurboAssembler::CallBuiltinByIndex(Register builtin_index) {
Call(builtin_index); Call(builtin_index);
} }
void TurboAssembler::LoadEntryFromBuiltin(Builtin builtin,
Register destination) {
ASM_CODE_COMMENT(this);
LoadU64(destination, EntryFromBuiltinAsOperand(builtin));
}
MemOperand TurboAssembler::EntryFromBuiltinAsOperand(Builtin builtin) {
ASM_CODE_COMMENT(this);
DCHECK(root_array_available());
return MemOperand(kRootRegister,
IsolateData::BuiltinEntrySlotOffset(builtin));
}
void TurboAssembler::LoadCodeObjectEntry(Register destination, void TurboAssembler::LoadCodeObjectEntry(Register destination,
Register code_object) { Register code_object) {
// Code objects are called differently depending on whether we are generating // Code objects are called differently depending on whether we are generating

View File

@ -50,6 +50,7 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
using TurboAssemblerBase::TurboAssemblerBase; using TurboAssemblerBase::TurboAssemblerBase;
void CallBuiltin(Builtin builtin, Condition cond); void CallBuiltin(Builtin builtin, Condition cond);
void TailCallBuiltin(Builtin builtin);
void Popcnt32(Register dst, Register src); void Popcnt32(Register dst, Register src);
void Popcnt64(Register dst, Register src); void Popcnt64(Register dst, Register src);
// Converts the integer (untagged smi) in |src| to a double, storing // Converts the integer (untagged smi) in |src| to a double, storing
@ -707,6 +708,8 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
// Load the builtin given by the Smi in |builtin_index| into the same // Load the builtin given by the Smi in |builtin_index| into the same
// register. // register.
void LoadEntryFromBuiltinIndex(Register builtin_index); void LoadEntryFromBuiltinIndex(Register builtin_index);
void LoadEntryFromBuiltin(Builtin builtin, Register destination);
MemOperand EntryFromBuiltinAsOperand(Builtin builtin);
void LoadCodeObjectEntry(Register destination, Register code_object); void LoadCodeObjectEntry(Register destination, Register code_object);
void CallCodeObject(Register code_object); void CallCodeObject(Register code_object);
void JumpCodeObject(Register code_object, void JumpCodeObject(Register code_object,