Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 84d692d79760a756c224383b8c4a6010d88dab8a
      
https://github.com/WebKit/WebKit/commit/84d692d79760a756c224383b8c4a6010d88dab8a
  Author: Yusuke Suzuki <[email protected]>
  Date:   2025-12-04 (Thu, 04 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 multiplication
https://bugs.webkit.org/show_bug.cgi?id=303522
rdar://165817174

Reviewed by Dan Hecht.

This patch updates our JSBigInt::multiplyImpl based on the V8's newer
implementation. The JSBigInt algorithm are derived from V8's one, and
this patch updates multiplyImpl with,

1. Introduce multiplySingle, which only took single Digit for
   multiplier. We can make multiplication faster in this case and only
   having one Digit is quite common (Like, just 2x).
2. Replace our old multiply with multiplyTextbook. This is text book
   implementation of BigInt multiplication derived from V8's
   implementation.
3. We imported several Digit related operations which are necessary for
   newer algorithm.

* JSTests/stress/big-int-out-of-memory-tests.js:
* Source/JavaScriptCore/runtime/JSBigInt.cpp:
(JSC::JSBigInt::multiplySingle):
(JSC::JSBigInt::multiplyTextbook):
(JSC::JSBigInt::multiplyImpl):
(JSC::JSBigInt::digitAdd):
(JSC::JSBigInt::digitAdd3):
(JSC::JSBigInt::digitSub):
(JSC::JSBigInt::digitSub2):
(JSC::JSBigInt::digitMul):
(JSC::JSBigInt::digitDiv):
(JSC::JSBigInt::internalMultiplyAdd):
(JSC::JSBigInt::productGreaterThan):
(JSC::JSBigInt::multiplyAccumulate): Deleted.
* Source/JavaScriptCore/runtime/JSBigInt.h:

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



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

Reply via email to