Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 559de0581a46a0432076447ba22305af8119dade
      
https://github.com/WebKit/WebKit/commit/559de0581a46a0432076447ba22305af8119dade
  Author: Yusuke Suzuki <[email protected]>
  Date:   2026-03-09 (Mon, 09 Mar 2026)

  Changed paths:
    A JSTests/stress/bigint-cached-mod.js
    M Source/JavaScriptCore/runtime/JSBigInt.cpp
    M Source/JavaScriptCore/runtime/JSBigInt.h
    M Source/JavaScriptCore/runtime/VM.cpp
    M Source/JavaScriptCore/runtime/VM.h

  Log Message:
  -----------
  [JSC] Implement cached BigInt remainder
https://bugs.webkit.org/show_bug.cgi?id=309479
rdar://172062278

Reviewed by Yijia Huang.

This patch implements V8's optimization[1] for repeated remainder
computation with the same BigInt divisor. There are many cases which
repeatedly compute the modulo with the same divisor, this patch
accelerates it by caching the multiplicative inverse of the divisor.

[1]: https://chromium-review.googlesource.com/c/v8/v8/+/7607186

Test: JSTests/stress/bigint-cached-mod.js

* JSTests/stress/bigint-cached-mod.js: Added.
(shouldBe):
(throw.new.Error):
* Source/JavaScriptCore/runtime/JSBigInt.cpp:
(JSC::JSBigInt::multiplyTextbook):
(JSC::JSBigInt::multiplySpecialLow):
(JSC::JSBigInt::greaterThanOrEqual):
(JSC::JSBigInt::cachedModMakeInverse):
(JSC::JSBigInt::cachedMod):
(JSC::JSBigInt::remainderImpl):
* Source/JavaScriptCore/runtime/JSBigInt.h:
* Source/JavaScriptCore/runtime/VM.cpp:
(JSC::VM::visitAggregateImpl):
* Source/JavaScriptCore/runtime/VM.h:

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



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

Reply via email to