Issue #1240 - Part 8 - Fix incorrect asserts with debug enabled. Fix BigInt errors in remainder operations https://bugzilla.mozilla.org/show_bug.cgi?id=1524136 Also fix 2 debug asserts in fallthroughs due to missing BigInt cases.

This commit is contained in:
Brian Smith 2023-07-21 04:10:47 -05:00 committed by roytam1
commit 7a30b0fa2d
3 changed files with 7 additions and 2 deletions

View file

@ -8093,6 +8093,9 @@ ICTypeOf_Typed::Compiler::generateStubCode(MacroAssembler& masm)
masm.branchTestSymbol(Assembler::NotEqual, R0, &failure);
break;
case JSTYPE_BIGINT:
return false;
default:
MOZ_CRASH("Unexpected type");
}

View file

@ -1778,7 +1778,7 @@ BigInt* BigInt::mod(ExclusiveContext* cx, HandleBigInt x, HandleBigInt y) {
return nullptr;
}
MOZ_ASSERT(remainder);
return remainder;
return destructivelyTrimHighZeroDigits(cx, remainder);
}
}
@ -2195,7 +2195,7 @@ uint64_t BigInt::toUint64(BigInt* x) {
uint64_t digit = x->digit(0);
if (DigitBits == 32 && x->digitLength() >= 1) {
if (DigitBits == 32 && x->digitLength() > 1) {
digit |= static_cast<uint64_t>(x->digit(1)) << 32;
}