Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 69c4fc83032081fdcc44ea81a17a0999e83c4215
      
https://github.com/WebKit/WebKit/commit/69c4fc83032081fdcc44ea81a17a0999e83c4215
  Author: Yusuke Suzuki <[email protected]>
  Date:   2025-12-08 (Mon, 08 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] Update JSBigInt division algorithm
https://bugs.webkit.org/show_bug.cgi?id=303683
rdar://165964882

Reviewed by Justin Michaud.

This patch imports V8's BigInt division algorithm. We imports necessary
helper functions and replace our existing implementation with newer one.
We also use std::span<Digit> std::span<const Digit> to represent mutable /
immutable data behind the BigInt. And we use Vector to allocate
temporary data before the final JSBigInt creation, which avoids
unnecessary GC object allocations. Also we can avoid heap allocations
for small BigInt cases due to pre-capacity of Vector.

* JSTests/stress/big-int-out-of-memory-tests.js:
* Source/JavaScriptCore/runtime/JSBigInt.cpp:
(JSC::HeapBigIntImpl::digits):
(JSC::Int32BigIntImpl::Int32BigIntImpl):
(JSC::Int32BigIntImpl::digits):
(JSC::Int64BigIntImpl::Int64BigIntImpl):
(JSC::Int64BigIntImpl::digits):
(JSC::JSBigInt::multiplySingle):
(JSC::JSBigInt::multiplyTextbook):
(JSC::JSBigInt::multiplyImpl):
(JSC::JSBigInt::divideSingle):
(JSC::JSBigInt::addAndReturnCarry):
(JSC::JSBigInt::subtractAndReturnBorrow):
(JSC::JSBigInt::inplaceAdd):
(JSC::JSBigInt::inplaceSub):
(JSC::spanCopy):
(JSC::normalize):
(JSC::JSBigInt::leftShift):
(JSC::JSBigInt::rightShift):
(JSC::JSBigInt::divideTextbook):
(JSC::JSBigInt::divideImpl):
(JSC::JSBigInt::remainderImpl):
(JSC::JSBigInt::toStringGeneric):
(JSC::JSBigInt::createFrom):
(JSC::JSBigInt::absoluteDivWithDigitDivisor): Deleted.
(JSC::JSBigInt::absoluteDivWithBigIntDivisor): Deleted.
(JSC::JSBigInt::absoluteInplaceAdd): Deleted.
(JSC::JSBigInt::absoluteInplaceSub): Deleted.
(JSC::JSBigInt::inplaceRightShift): Deleted.
(JSC::JSBigInt::absoluteLeftShiftAlwaysCopy): Deleted.
* Source/JavaScriptCore/runtime/JSBigInt.h:

Canonical link: https://commits.webkit.org/304114@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to