Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 25c0be0b69f90d3b85f5f16ad7a007aeb48de5f2
https://github.com/WebKit/WebKit/commit/25c0be0b69f90d3b85f5f16ad7a007aeb48de5f2
Author: Yusuke Suzuki <[email protected]>
Date: 2025-12-11 (Thu, 11 Dec 2025)
Changed paths:
M JSTests/stress/big-int-out-of-memory-tests.js
M Source/JavaScriptCore/runtime/JSBigInt.cpp
M Source/JavaScriptCore/runtime/JSBigInt.h
Log Message:
-----------
[JSC] Clean up remaining JSBigInt methods with Vector
https://bugs.webkit.org/show_bug.cgi?id=303976
rdar://166279276
Reviewed by Justin Michaud.
This patch cleans up the remaining JSBigInt methods with Vector.
Previously we were allocating temporary JSBigInt in many computations
and doing rightTrim at the finalization. This is really costly since we
may end up allocating JSBigInt multiple times. So let's just use Vector
instead and use std::span<Digit> / std::span<const Digit> for
intermediate computation.
We also import the latest V8's implementation for addTextbook and
subTextbook which improves performance by using digitAdd3 etc.
* JSTests/stress/big-int-out-of-memory-tests.js:
* Source/JavaScriptCore/runtime/JSBigInt.cpp:
(JSC::JSBigInt::createFrom):
(JSC::normalize):
(JSC::JSBigInt::exponentiateImpl):
(JSC::JSBigInt::multiplyImpl):
(JSC::JSBigInt::divideTextbook):
(JSC::JSBigInt::divideImpl):
(JSC::JSBigInt::copy):
(JSC::JSBigInt::remainderImpl):
(JSC::JSBigInt::incImpl):
(JSC::JSBigInt::decImpl):
(JSC::JSBigInt::bitwiseAndImpl):
(JSC::JSBigInt::bitwiseOrImpl):
(JSC::JSBigInt::bitwiseXorImpl):
(JSC::JSBigInt::bitwiseNotImpl):
(JSC::JSBigInt::multiplyAdd):
(JSC::JSBigInt::addTextbook):
(JSC::JSBigInt::absoluteAdd):
(JSC::JSBigInt::subTextbook):
(JSC::JSBigInt::absoluteSub):
(JSC::JSBigInt::absoluteBitwiseOp):
(JSC::JSBigInt::absoluteAnd):
(JSC::JSBigInt::absoluteOr):
(JSC::JSBigInt::absoluteAndNot):
(JSC::JSBigInt::absoluteXor):
(JSC::JSBigInt::absoluteAddOne):
(JSC::JSBigInt::absoluteSubOne):
(JSC::JSBigInt::leftShiftByAbsolute):
(JSC::JSBigInt::rightShiftByAbsolute):
(JSC::JSBigInt::parseInt):
(JSC::JSBigInt::truncateToNBits):
(JSC::JSBigInt::truncateAndSubFromPowerOfTwo):
(JSC::JSBigInt::inplaceMultiplyAdd): Deleted.
(JSC::JSBigInt::internalMultiplyAdd): Deleted.
(JSC::JSBigInt::allocateFor): Deleted.
* Source/JavaScriptCore/runtime/JSBigInt.h:
Canonical link: https://commits.webkit.org/304337@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications