Commit 7cd438c6 authored by Lu Yahan's avatar Lu Yahan Committed by V8 LUCI CQ

[riscv64] Port [fastcall] Enable float support on arm64

Change-Id: Iba439f2de9da359baeebd23482880013939b3066
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3212059
Auto-Submit: Yahan Lu <yahan@iscas.ac.cn>
Reviewed-by: 's avatarji qiu <qiuji@iscas.ac.cn>
Commit-Queue: Yahan Lu <yahan@iscas.ac.cn>
Commit-Queue: ji qiu <qiuji@iscas.ac.cn>
Cr-Commit-Position: refs/heads/main@{#77294}
parent 316f02f4
......@@ -693,7 +693,8 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
AssemblePrepareTailCall();
break;
case kArchCallCFunction: {
int const num_parameters = MiscField::decode(instr->opcode());
int const num_gp_parameters = ParamField::decode(instr->opcode());
int const num_fp_parameters = FPParamField::decode(instr->opcode());
Label after_call;
bool isWasmCapiFunction =
linkage()->GetIncomingDescriptor()->IsWasmCapiFunction();
......@@ -705,10 +706,10 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
}
if (instr->InputAt(0)->IsImmediate()) {
ExternalReference ref = i.InputExternalReference(0);
__ CallCFunction(ref, num_parameters);
__ CallCFunction(ref, num_gp_parameters, num_fp_parameters);
} else {
Register func = i.InputOrZeroRegister(0);
__ CallCFunction(func, num_parameters);
__ CallCFunction(func, num_gp_parameters, num_fp_parameters);
}
__ bind(&after_call);
if (isWasmCapiFunction) {
......
......@@ -2218,8 +2218,20 @@ void Simulator::SoftwareInterrupt() {
reinterpret_cast<SimulatorRuntimeProfilingGetterCall>(external);
target(arg0, arg1, Redirection::ReverseRedirection(arg2));
} else {
DCHECK(redirection->type() == ExternalReference::BUILTIN_CALL ||
redirection->type() == ExternalReference::BUILTIN_CALL_PAIR);
DCHECK(
redirection->type() == ExternalReference::BUILTIN_CALL ||
redirection->type() == ExternalReference::BUILTIN_CALL_PAIR ||
// FAST_C_CALL is temporarily handled here as well, because we lack
// proper support for direct C calls with FP params in the simulator.
// The generic BUILTIN_CALL path assumes all parameters are passed in
// the GP registers, thus supporting calling the slow callback without
// crashing. The reason for that is that in the mjsunit tests we check
// the `fast_c_api.supports_fp_params` (which is false on
// non-simulator builds for arm/arm64), thus we expect that the slow
// path will be called. And since the slow path passes the arguments
// as a `const FunctionCallbackInfo<Value>&` (which is a GP argument),
// the call is made correctly.
redirection->type() == ExternalReference::FAST_C_CALL);
SimulatorRuntimeCall target =
reinterpret_cast<SimulatorRuntimeCall>(external);
if (::v8::internal::FLAG_trace_sim) {
......
......@@ -57,9 +57,10 @@ inline constexpr Condition ToCondition(LiftoffCondition liftoff_cond) {
// -----+--------------------+ <-- frame ptr (fp)
// -1 | 0xa: WASM |
// -2 | instance |
// -3 | feedback vector|
// -----+--------------------+---------------------------
// -3 | slot 0 | ^
// -4 | slot 1 | |
// -4 | slot 0 | ^
// -5 | slot 1 | |
// | | Frame slots
// | | |
// | | v
......@@ -68,7 +69,8 @@ inline constexpr Condition ToCondition(LiftoffCondition liftoff_cond) {
//
// fp-8 holds the stack marker, fp-16 is the instance parameter.
constexpr int kInstanceOffset = 16;
constexpr int kInstanceOffset = 2 * kSystemPointerSize;
constexpr int kFeedbackVectorOffset = 3 * kSystemPointerSize;
inline MemOperand GetStackSlot(int offset) { return MemOperand(fp, -offset); }
......
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