diff options
author | Brian Smith <brian@dbsoft.org> | 2023-07-23 15:36:19 -0500 |
---|---|---|
committer | Brian Smith <brian@dbsoft.org> | 2023-07-23 15:36:19 -0500 |
commit | f359533b82ec4131d5af7955685e9178887ba9cd (patch) | |
tree | 57d4bc112d682b2e8125c6b6bea14660038523a5 /js/src/builtin/BigInt.cpp | |
parent | 94609cf97bae8b30f51ddabd94cfc2d301d59b83 (diff) | |
download | uxp-f359533b82ec4131d5af7955685e9178887ba9cd.tar.gz |
Issue #1240 - Part 11 - Fix several issue reported on review.
Skip over block delimiters when parsing BigInt literals.
Update BigInt hashing to account for the possibility of moving GC.
https://bugzilla.mozilla.org/show_bug.cgi?id=1531018
Make HashableValue comparison of BigInts infallible.
https://bugzilla.mozilla.org/show_bug.cgi?id=1530406
Fix BigInt constructor API CallArgs usage.
https://bugzilla.mozilla.org/show_bug.cgi?id=1526279
Diffstat (limited to 'js/src/builtin/BigInt.cpp')
-rw-r--r-- | js/src/builtin/BigInt.cpp | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/js/src/builtin/BigInt.cpp b/js/src/builtin/BigInt.cpp index f6c244ce39..6c78970d74 100644 --- a/js/src/builtin/BigInt.cpp +++ b/js/src/builtin/BigInt.cpp @@ -76,20 +76,6 @@ BigIntObject::unbox() const return getFixedSlot(PRIMITIVE_VALUE_SLOT).toBigInt(); } -bool -js::intrinsic_ToBigInt(JSContext* cx, unsigned argc, Value* vp) -{ - CallArgs args = CallArgsFromVp(argc, vp); - MOZ_ASSERT(args.length() == 1); - - BigInt* result = ToBigInt(cx, args[0]); - if (!result) - return false; - - args.rval().setBigInt(result); - return true; -} - // BigInt proposal section 5.3.4 bool BigIntObject::valueOf_impl(JSContext* cx, const CallArgs& args) @@ -129,7 +115,7 @@ BigIntObject::toString_impl(JSContext* cx, const CallArgs& args) // Steps 4-5. if (args.hasDefined(0)) { double d; - if (!ToInteger(cx, args[0], &d)) + if (!ToInteger(cx, args.get(0), &d)) return false; if (d < 2 || d > 36) { JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_BAD_RADIX); @@ -187,12 +173,12 @@ BigIntObject::asUintN(JSContext* cx, unsigned argc, Value* vp) // Step 1. uint64_t bits; - if (!ToIndex(cx, args[0], &bits)) { + if (!ToIndex(cx, args.get(0), &bits)) { return false; } // Step 2. - RootedBigInt bi(cx, ToBigInt(cx, args[1])); + RootedBigInt bi(cx, ToBigInt(cx, args.get(1))); if (!bi) { return false; } @@ -215,12 +201,12 @@ BigIntObject::asIntN(JSContext* cx, unsigned argc, Value* vp) // Step 1. uint64_t bits; - if (!ToIndex(cx, args[0], &bits)) { + if (!ToIndex(cx, args.get(0), &bits)) { return false; } // Step 2. - RootedBigInt bi(cx, ToBigInt(cx, args[1])); + RootedBigInt bi(cx, ToBigInt(cx, args.get(1))); if (!bi) { return false; } |