Commit 4812f2af authored by Junliang Yan's avatar Junliang Yan Committed by Commit Bot

PPC/s390: [nojit] Add a kCallBuiltinPointer call kind

Port f323a5f4

Original Commit Message:

    Currently, Torque's builtin pointers store a Code target underneath and
    callsites generate a kArchCallCodeObject opcode. When embedded builtins
    are enabled, the call thus first calls the on-heap trampoline, which
    finally jumps to the target off-heap builtin code.

    This will no longer be possible in jitless mode, since on-heap code must
    not be executable.

    As a step towards changing the way builtin pointers are called
    (function pointers will hold the builtin index as a Smi, and callsites
    look up the off-heap target address and jump there), this CL adds a
    dedicated opcode for builtin pointer calls to the compiler pipeline.

    The calling mechanism itself is unchanged, changes there will happen
    in a follow-up.

R=jgruber@chromium.org, joransiu@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: I2d2229227e1c62e7c2515d4f5cb3d4dae49b3dd4
Reviewed-on: https://chromium-review.googlesource.com/c/1393913Reviewed-by: 's avatarJoran Siu <joransiu@ca.ibm.com>
Commit-Queue: Junliang Yan <jyan@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#58525}
parent 0f867644
......@@ -875,6 +875,14 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
frame_access_state()->ClearSPDelta();
break;
}
case kArchCallBuiltinPointer: {
DCHECK(!instr->InputAt(0)->IsImmediate());
Register builtin_pointer = i.InputRegister(0);
__ CallBuiltinPointer(builtin_pointer);
RecordCallPosition(instr);
frame_access_state()->ClearSPDelta();
break;
}
case kArchCallWasmFunction: {
// We must not share code targets for calls to builtins for wasm code, as
// they might need to be patched individually.
......
......@@ -1381,6 +1381,14 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
frame_access_state()->ClearSPDelta();
break;
}
case kArchCallBuiltinPointer: {
DCHECK(!instr->InputAt(0)->IsImmediate());
Register builtin_pointer = i.InputRegister(0);
__ CallBuiltinPointer(builtin_pointer);
RecordCallPosition(instr);
frame_access_state()->ClearSPDelta();
break;
}
case kArchCallWasmFunction: {
// We must not share code targets for calls to builtins for wasm code, as
// they might need to be patched individually.
......
......@@ -3023,6 +3023,12 @@ void TurboAssembler::JumpIfLessThan(Register x, int32_t y, Label* dest) {
blt(dest);
}
void TurboAssembler::CallBuiltinPointer(Register builtin_pointer) {
addi(builtin_pointer, builtin_pointer,
Operand(Code::kHeaderSize - kHeapObjectTag));
Call(builtin_pointer);
}
void TurboAssembler::StoreReturnAddressAndCall(Register target) {
// This generates the final instruction sequence for calls to C functions
// once an exit frame has been constructed.
......
......@@ -412,6 +412,9 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
Condition cond = al);
void Call(Label* target);
void CallBuiltinPointer(Register builtin_pointer) override;
void CallForDeoptimization(Address target, int deopt_id,
RelocInfo::Mode rmode) {
USE(deopt_id);
......
......@@ -4392,6 +4392,12 @@ void TurboAssembler::JumpIfLessThan(Register x, int32_t y, Label* dest) {
blt(dest);
}
void TurboAssembler::CallBuiltinPointer(Register builtin_pointer) {
AddP(builtin_pointer, builtin_pointer,
Operand(Code::kHeaderSize - kHeapObjectTag));
Call(builtin_pointer);
}
void TurboAssembler::StoreReturnAddressAndCall(Register target) {
// This generates the final instruction sequence for calls to C functions
// once an exit frame has been constructed.
......
......@@ -177,6 +177,8 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
void Call(Label* target);
void CallBuiltinPointer(Register builtin_pointer) override;
// Register move. May do nothing if the registers are identical.
void Move(Register dst, Smi smi) { LoadSmiLiteral(dst, smi); }
void Move(Register dst, Handle<HeapObject> value);
......
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