Skip to content

Commit 9b69baf

Browse files
Milad Fatargos
authored andcommitted
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: v8/v8@59d52e3 PR-URL: #59485 Refs: nodejs/build#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>
1 parent c6e3d5d commit 9b69baf

File tree

3 files changed

+60
-13
lines changed

3 files changed

+60
-13
lines changed

common.gypi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
# Reset this number to 0 on major V8 upgrades.
4040
# Increment by one for each non-official patch applied to deps/v8.
41-
'v8_embedder_string': '-node.24',
41+
'v8_embedder_string': '-node.25',
4242

4343
##### V8 defaults for Node.js #####
4444

deps/v8/src/wasm/baseline/ppc/liftoff-assembler-ppc-inl.h

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2893,14 +2893,38 @@ void LiftoffAssembler::CallC(const std::initializer_list<VarState> args,
28932893
parallel_move.LoadIntoRegister(LiftoffRegister{kCArgRegs[reg_args]}, arg);
28942894
++reg_args;
28952895
} else {
2896-
int bias = 0;
2897-
// On BE machines values with less than 8 bytes are right justified.
2898-
// bias here is relative to the stack pointer.
2899-
if (arg.kind() == kI32 || arg.kind() == kF32) bias = -stack_bias;
29002896
int offset =
29012897
(kStackFrameExtraParamSlot + stack_args) * kSystemPointerSize;
2902-
MemOperand dst{sp, offset + bias};
2903-
liftoff::StoreToMemory(this, dst, arg, r0, ip);
2898+
MemOperand dst{sp, offset};
2899+
Register scratch1 = r0;
2900+
Register scratch2 = ip;
2901+
if (arg.is_reg()) {
2902+
switch (arg.kind()) {
2903+
case kI16:
2904+
extsh(scratch1, arg.reg().gp());
2905+
StoreU64(scratch1, dst);
2906+
break;
2907+
case kI32:
2908+
extsw(scratch1, arg.reg().gp());
2909+
StoreU64(scratch1, dst);
2910+
break;
2911+
case kI64:
2912+
StoreU64(arg.reg().gp(), dst);
2913+
break;
2914+
default:
2915+
UNREACHABLE();
2916+
}
2917+
} else if (arg.is_const()) {
2918+
mov(scratch1, Operand(static_cast<int64_t>(arg.i32_const())));
2919+
StoreU64(scratch1, dst);
2920+
} else if (value_kind_size(arg.kind()) == 4) {
2921+
LoadS32(scratch1, liftoff::GetStackSlot(arg.offset()), scratch2);
2922+
StoreU64(scratch1, dst);
2923+
} else {
2924+
DCHECK_EQ(8, value_kind_size(arg.kind()));
2925+
LoadU64(scratch1, liftoff::GetStackSlot(arg.offset()), scratch1);
2926+
StoreU64(scratch1, dst);
2927+
}
29042928
++stack_args;
29052929
}
29062930
}

deps/v8/src/wasm/baseline/s390/liftoff-assembler-s390-inl.h

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3271,14 +3271,37 @@ void LiftoffAssembler::CallC(const std::initializer_list<VarState> args,
32713271
parallel_move.LoadIntoRegister(LiftoffRegister{kCArgRegs[reg_args]}, arg);
32723272
++reg_args;
32733273
} else {
3274-
int bias = 0;
3275-
// On BE machines values with less than 8 bytes are right justified.
3276-
// bias here is relative to the stack pointer.
3277-
if (arg.kind() == kI32 || arg.kind() == kF32) bias = -stack_bias;
32783274
int offset =
32793275
(kStackFrameExtraParamSlot + stack_args) * kSystemPointerSize;
3280-
MemOperand dst{sp, offset + bias};
3281-
liftoff::StoreToMemory(this, dst, arg, ip);
3276+
MemOperand dst{sp, offset};
3277+
Register scratch = ip;
3278+
if (arg.is_reg()) {
3279+
switch (arg.kind()) {
3280+
case kI16:
3281+
LoadS16(scratch, arg.reg().gp());
3282+
StoreU64(scratch, dst);
3283+
break;
3284+
case kI32:
3285+
LoadS32(scratch, arg.reg().gp());
3286+
StoreU64(scratch, dst);
3287+
break;
3288+
case kI64:
3289+
StoreU64(arg.reg().gp(), dst);
3290+
break;
3291+
default:
3292+
UNREACHABLE();
3293+
}
3294+
} else if (arg.is_const()) {
3295+
mov(scratch, Operand(static_cast<int64_t>(arg.i32_const())));
3296+
StoreU64(scratch, dst);
3297+
} else if (value_kind_size(arg.kind()) == 4) {
3298+
LoadS32(scratch, liftoff::GetStackSlot(arg.offset()), scratch);
3299+
StoreU64(scratch, dst);
3300+
} else {
3301+
DCHECK_EQ(8, value_kind_size(arg.kind()));
3302+
LoadU64(scratch, liftoff::GetStackSlot(arg.offset()), scratch);
3303+
StoreU64(scratch, dst);
3304+
}
32823305
++stack_args;
32833306
}
32843307
}

0 commit comments

Comments
 (0)