mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 12:20:27 +01:00
deps: V8: cherry-pick 59d52e311bb1
Original commit message:
[liftoff] Fix parameter passing during CallC
Values smaller than 8 bytes need to be sign/zero extended to
8 bytes then pushed on to the stack.
Change-Id: I5c9a2179ef2b65cf08b7e773180d78b252c2253f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6597365
Commit-Queue: Milad Farazmand <mfarazma@redhat.com>
Reviewed-by: Junliang Yan <junyan@redhat.com>
Cr-Commit-Position: refs/heads/main@{#100578}
Refs: 59d52e311b
PR-URL: https://github.com/nodejs/node/pull/59485
Refs: https://github.com/nodejs/build/issues/4091
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
This commit is contained in:
parent
3fc70198e0
commit
2565e1c44e
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
# Reset this number to 0 on major V8 upgrades.
|
||||
# Increment by one for each non-official patch applied to deps/v8.
|
||||
'v8_embedder_string': '-node.18',
|
||||
'v8_embedder_string': '-node.19',
|
||||
|
||||
##### V8 defaults for Node.js #####
|
||||
|
||||
|
|
|
|||
|
|
@ -2893,14 +2893,38 @@ void LiftoffAssembler::CallC(const std::initializer_list<VarState> args,
|
|||
parallel_move.LoadIntoRegister(LiftoffRegister{kCArgRegs[reg_args]}, arg);
|
||||
++reg_args;
|
||||
} else {
|
||||
int bias = 0;
|
||||
// On BE machines values with less than 8 bytes are right justified.
|
||||
// bias here is relative to the stack pointer.
|
||||
if (arg.kind() == kI32 || arg.kind() == kF32) bias = -stack_bias;
|
||||
int offset =
|
||||
(kStackFrameExtraParamSlot + stack_args) * kSystemPointerSize;
|
||||
MemOperand dst{sp, offset + bias};
|
||||
liftoff::StoreToMemory(this, dst, arg, r0, ip);
|
||||
MemOperand dst{sp, offset};
|
||||
Register scratch1 = r0;
|
||||
Register scratch2 = ip;
|
||||
if (arg.is_reg()) {
|
||||
switch (arg.kind()) {
|
||||
case kI16:
|
||||
extsh(scratch1, arg.reg().gp());
|
||||
StoreU64(scratch1, dst);
|
||||
break;
|
||||
case kI32:
|
||||
extsw(scratch1, arg.reg().gp());
|
||||
StoreU64(scratch1, dst);
|
||||
break;
|
||||
case kI64:
|
||||
StoreU64(arg.reg().gp(), dst);
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
} else if (arg.is_const()) {
|
||||
mov(scratch1, Operand(static_cast<int64_t>(arg.i32_const())));
|
||||
StoreU64(scratch1, dst);
|
||||
} else if (value_kind_size(arg.kind()) == 4) {
|
||||
LoadS32(scratch1, liftoff::GetStackSlot(arg.offset()), scratch2);
|
||||
StoreU64(scratch1, dst);
|
||||
} else {
|
||||
DCHECK_EQ(8, value_kind_size(arg.kind()));
|
||||
LoadU64(scratch1, liftoff::GetStackSlot(arg.offset()), scratch1);
|
||||
StoreU64(scratch1, dst);
|
||||
}
|
||||
++stack_args;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3271,14 +3271,37 @@ void LiftoffAssembler::CallC(const std::initializer_list<VarState> args,
|
|||
parallel_move.LoadIntoRegister(LiftoffRegister{kCArgRegs[reg_args]}, arg);
|
||||
++reg_args;
|
||||
} else {
|
||||
int bias = 0;
|
||||
// On BE machines values with less than 8 bytes are right justified.
|
||||
// bias here is relative to the stack pointer.
|
||||
if (arg.kind() == kI32 || arg.kind() == kF32) bias = -stack_bias;
|
||||
int offset =
|
||||
(kStackFrameExtraParamSlot + stack_args) * kSystemPointerSize;
|
||||
MemOperand dst{sp, offset + bias};
|
||||
liftoff::StoreToMemory(this, dst, arg, ip);
|
||||
MemOperand dst{sp, offset};
|
||||
Register scratch = ip;
|
||||
if (arg.is_reg()) {
|
||||
switch (arg.kind()) {
|
||||
case kI16:
|
||||
LoadS16(scratch, arg.reg().gp());
|
||||
StoreU64(scratch, dst);
|
||||
break;
|
||||
case kI32:
|
||||
LoadS32(scratch, arg.reg().gp());
|
||||
StoreU64(scratch, dst);
|
||||
break;
|
||||
case kI64:
|
||||
StoreU64(arg.reg().gp(), dst);
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
} else if (arg.is_const()) {
|
||||
mov(scratch, Operand(static_cast<int64_t>(arg.i32_const())));
|
||||
StoreU64(scratch, dst);
|
||||
} else if (value_kind_size(arg.kind()) == 4) {
|
||||
LoadS32(scratch, liftoff::GetStackSlot(arg.offset()), scratch);
|
||||
StoreU64(scratch, dst);
|
||||
} else {
|
||||
DCHECK_EQ(8, value_kind_size(arg.kind()));
|
||||
LoadU64(scratch, liftoff::GetStackSlot(arg.offset()), scratch);
|
||||
StoreU64(scratch, dst);
|
||||
}
|
||||
++stack_args;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user