From eb7a856c766a508cde0a9ad90a233b272c7a9e54 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Thu, 13 Jul 2023 01:59:24 -0500 Subject: Issue #1240 - Part 1 - Define a new BigInt primitive type. Based on https://bugzilla.mozilla.org/show_bug.cgi?id=1366287 Part 1.0. However leaving out the --enable-bigint changes. --- js/src/jsstr.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'js/src/jsstr.cpp') diff --git a/js/src/jsstr.cpp b/js/src/jsstr.cpp index fdee274c32..bd1ca38972 100644 --- a/js/src/jsstr.cpp +++ b/js/src/jsstr.cpp @@ -3734,6 +3734,10 @@ js::ToStringSlow(ExclusiveContext* cx, typename MaybeRooted::Han JSMSG_SYMBOL_TO_STRING); } return nullptr; + } else if (v.isBigInt()) { + if (!allowGC) + return nullptr; + str = BigInt::toString(cx, v.toBigInt()); } else { MOZ_ASSERT(v.isUndefined()); str = cx->names().undefined; -- cgit v1.2.3 From b2ae4d388529c1a63959cc169f3ec1f7fdce9558 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Thu, 13 Jul 2023 02:40:25 -0500 Subject: Issue #1240 - Part 2 - Define the BigIntObject class for BigInt wrapper objects. Based on https://bugzilla.mozilla.org/show_bug.cgi?id=1366287 Part 3. In our Part 3 we will fast forward to the V8 implementation skipping GMP. --- js/src/jsstr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/src/jsstr.cpp') diff --git a/js/src/jsstr.cpp b/js/src/jsstr.cpp index bd1ca38972..3b5461b441 100644 --- a/js/src/jsstr.cpp +++ b/js/src/jsstr.cpp @@ -3737,7 +3737,7 @@ js::ToStringSlow(ExclusiveContext* cx, typename MaybeRooted::Han } else if (v.isBigInt()) { if (!allowGC) return nullptr; - str = BigInt::toString(cx, v.toBigInt()); + str = BigInt::toString(cx, v.toBigInt(), 10); } else { MOZ_ASSERT(v.isUndefined()); str = cx->names().undefined; -- cgit v1.2.3 From cb1aa7f456b4d44f4a1f5cdc63b490c8fb743a1b Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Thu, 13 Jul 2023 04:07:05 -0500 Subject: Issue #1240 - Part 3c - Fast-forward to the V8 version of BigIntType. Disabling some sections temporarily since the dependencies are not there yet. Based on the following: https://bugzilla.mozilla.org/show_bug.cgi?id=1502797 https://bugzilla.mozilla.org/show_bug.cgi?id=1471134 https://bugzilla.mozilla.org/show_bug.cgi?id=1441098 Part 3 & 4 Add structured clone support for BigInt and Enable BigInt wrapping from DOM bindings. https://bugzilla.mozilla.org/show_bug.cgi?id=1522738 --- js/src/jsstr.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'js/src/jsstr.cpp') diff --git a/js/src/jsstr.cpp b/js/src/jsstr.cpp index 3b5461b441..593cf4d708 100644 --- a/js/src/jsstr.cpp +++ b/js/src/jsstr.cpp @@ -3737,7 +3737,8 @@ js::ToStringSlow(ExclusiveContext* cx, typename MaybeRooted::Han } else if (v.isBigInt()) { if (!allowGC) return nullptr; - str = BigInt::toString(cx, v.toBigInt(), 10); + RootedBigInt i(cx, v.toBigInt()); + str = BigInt::toString(cx, i, 10); } else { MOZ_ASSERT(v.isUndefined()); str = cx->names().undefined; -- cgit v1.2.3