commit f72b853afcad63b7c8c644c9f9d2bc1c3509a656
parent f2c78bd30a2a84e6e496b275d0ff5e7e9617b860
Author: Iain Ireland <iireland@mozilla.com>
Date: Fri, 19 Dec 2025 17:12:30 +0000
Bug 2005652: Inline BigInt::digit/setDigit r=spidermonkey-reviewers,mgaudet
This improves bigint-noble-ed25519 by 60-70% on Mac/Linux.
Differential Revision: https://phabricator.services.mozilla.com/D277076
Diffstat:
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/js/src/vm/BigIntType.h b/js/src/vm/BigIntType.h
@@ -94,17 +94,19 @@ class BigInt final : public js::gc::CellWithLengthAndFlags {
bool hasHeapDigits() const { return !hasInlineDigits(); }
using Digits = mozilla::Span<Digit>;
- Digits digits() {
+ MOZ_ALWAYS_INLINE Digits digits() {
return Digits(hasInlineDigits() ? inlineDigits_ : heapDigits_,
digitLength());
}
using ConstDigits = mozilla::Span<const Digit>;
- ConstDigits digits() const {
+ MOZ_ALWAYS_INLINE ConstDigits digits() const {
return ConstDigits(hasInlineDigits() ? inlineDigits_ : heapDigits_,
digitLength());
}
- Digit digit(size_t idx) const { return digits()[idx]; }
- void setDigit(size_t idx, Digit digit) { digits()[idx] = digit; }
+ MOZ_ALWAYS_INLINE Digit digit(size_t idx) const { return digits()[idx]; }
+ MOZ_ALWAYS_INLINE void setDigit(size_t idx, Digit digit) {
+ digits()[idx] = digit;
+ }
bool isZero() const { return digitLength() == 0; }
bool isNegative() const { return headerFlagsField() & SignBit; }