mirror of
https://github.com/nodejs/node.git
synced 2026-11-29 14:27:57 -05:00
deps: V8: cherry-pick eadaef581c29
Original commit message:
Fix usage of MulHighS64 on <= z13
mgrk is only available with MISC_INSTR_EXT2 installed.
A runtime call needs to be made if it's unavailable.
We also need to make sure caller saved registers are saved
accordingly before making a call.
Change-Id: If7ac06eef57cc3db059c2640b77c80de3b16fced
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4521297
Reviewed-by: Junliang Yan <junyan@redhat.com>
Commit-Queue: Milad Farazmand <mfarazma@redhat.com>
Cr-Commit-Position: refs/heads/main@{#87675}
Fixes: https://github.com/nodejs/node/issues/47064
PR-URL: https://github.com/nodejs/node/pull/49401
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
This commit is contained in:
1 parent
ae40cb1612
commit
5b70b68b3d
3 files changed
+27
-22
No files matched your search
+1
-1
@@ -36,7 +36,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.14',
|
||||
'v8_embedder_string': '-node.15',
|
||||
|
||||
##### V8 defaults for Node.js #####
|
||||
|
||||
|
||||
+17
-2
@@ -2906,8 +2906,23 @@ void MacroAssembler::MulS64(Register dst, const MemOperand& opnd) {
|
||||
}
|
||||
|
||||
void MacroAssembler::MulHighS64(Register dst, Register src1, Register src2) {
|
||||
mgrk(r0, src1, src2);
|
||||
lgr(dst, r0);
|
||||
if (CpuFeatures::IsSupported(MISC_INSTR_EXT2)) {
|
||||
mgrk(r0, src1, src2);
|
||||
lgr(dst, r0);
|
||||
} else {
|
||||
SaveFPRegsMode fp_mode = SaveFPRegsMode::kSave;
|
||||
PushCallerSaved(fp_mode, ip);
|
||||
Push(src1, src2);
|
||||
Pop(r2, r3);
|
||||
{
|
||||
FrameScope scope(this, StackFrame::INTERNAL);
|
||||
PrepareCallCFunction(2, 0, r0);
|
||||
CallCFunction(ExternalReference::int64_mul_high_function(), 2, 0);
|
||||
}
|
||||
mov(r0, r2);
|
||||
PopCallerSaved(fp_mode, ip);
|
||||
mov(dst, r0);
|
||||
}
|
||||
}
|
||||
|
||||
void MacroAssembler::MulHighS64(Register dst, Register src1,
|
||||
|
||||
+9
-19
@@ -1699,15 +1699,18 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
||||
case kS390_Mul64WithOverflow: {
|
||||
Register dst = i.OutputRegister(), src1 = i.InputRegister(0),
|
||||
src2 = i.InputRegister(1);
|
||||
DCHECK(!AreAliased(dst, src1, src2));
|
||||
CHECK(!AreAliased(dst, src1, src2));
|
||||
if (CpuFeatures::IsSupported(MISC_INSTR_EXT2)) {
|
||||
__ msgrkc(dst, src1, src2);
|
||||
} else {
|
||||
__ mgrk(r0, src1, src2); // r0 = high 64-bits, r1 = low 64-bits.
|
||||
__ lgr(dst, r1);
|
||||
__ ShiftRightS64(r1, r1, Operand(63));
|
||||
// Mul high.
|
||||
__ MulHighS64(r1, src1, src2);
|
||||
// Mul low.
|
||||
__ mov(dst, src1);
|
||||
__ MulS64(dst, src2);
|
||||
// Test whether {high} is a sign-extension of {result}.
|
||||
__ CmpU64(r0, r1);
|
||||
__ ShiftRightS64(r0, dst, Operand(63));
|
||||
__ CmpU64(r1, r0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1725,20 +1728,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
||||
ASSEMBLE_BIN_OP(RRRInstr(MulHighU64), nullInstr, nullInstr);
|
||||
break;
|
||||
case kS390_MulHighS64:
|
||||
if (CpuFeatures::IsSupported(MISC_INSTR_EXT2)) {
|
||||
ASSEMBLE_BIN_OP(RRRInstr(MulHighS64), nullInstr, nullInstr);
|
||||
} else {
|
||||
__ Push(r2, r3, i.InputRegister(0), i.InputRegister(1));
|
||||
__ Pop(r2, r3);
|
||||
{
|
||||
FrameScope scope(masm(), StackFrame::INTERNAL);
|
||||
__ PrepareCallCFunction(2, 0, kScratchReg);
|
||||
__ CallCFunction(ExternalReference::int64_mul_high_function(), 2, 0);
|
||||
}
|
||||
__ mov(kScratchReg, r2);
|
||||
__ Pop(r2, r3);
|
||||
__ mov(i.OutputRegister(), kScratchReg);
|
||||
}
|
||||
ASSEMBLE_BIN_OP(RRRInstr(MulHighS64), nullInstr, nullInstr);
|
||||
break;
|
||||
case kS390_MulFloat:
|
||||
ASSEMBLE_BIN_OP(DDInstr(meebr), DMTInstr(MulFloat32), nullInstr);
|
||||
|
||||
Reference in new issue
Block a user