Title: [260906] trunk
Revision
260906
Author
[email protected]
Date
2020-04-29 11:03:53 -0700 (Wed, 29 Apr 2020)

Log Message

[JSC] JSStringJoiner is missing BigInt handling
https://bugs.webkit.org/show_bug.cgi?id=211174

Reviewed by Mark Lam.

JSTests:

* stress/bigint-to-string-in-array.js: Added.
(shouldBe):

Source/_javascript_Core:

JSStringJoiner missed handling of BigInt (specifically BigInt32) and appending empty string incorrectly.
In debug build, assertion hits. We should support BigInt in JSStringJoiner.

* runtime/JSStringJoiner.h:
(JSC::JSStringJoiner::appendWithoutSideEffects):

Modified Paths

Added Paths

Diff

Modified: trunk/JSTests/ChangeLog (260905 => 260906)


--- trunk/JSTests/ChangeLog	2020-04-29 17:52:30 UTC (rev 260905)
+++ trunk/JSTests/ChangeLog	2020-04-29 18:03:53 UTC (rev 260906)
@@ -1,3 +1,13 @@
+2020-04-29  Yusuke Suzuki  <[email protected]>
+
+        [JSC] JSStringJoiner is missing BigInt handling
+        https://bugs.webkit.org/show_bug.cgi?id=211174
+
+        Reviewed by Mark Lam.
+
+        * stress/bigint-to-string-in-array.js: Added.
+        (shouldBe):
+
 2020-04-28  Yusuke Suzuki  <[email protected]>
 
         [JSC] BigInt constructor should accept larger integers than safe-integers

Added: trunk/JSTests/stress/bigint-to-string-in-array.js (0 => 260906)


--- trunk/JSTests/stress/bigint-to-string-in-array.js	                        (rev 0)
+++ trunk/JSTests/stress/bigint-to-string-in-array.js	2020-04-29 18:03:53 UTC (rev 260906)
@@ -0,0 +1,10 @@
+function shouldBe(actual, expected) {
+    if (actual !== expected)
+        throw new Error('bad value: ' + actual);
+}
+
+shouldBe([10n].toString(), `10`);
+shouldBe([10n, 20n, 30n].toString(), `10,20,30`);
+shouldBe([createHeapBigInt(10n)].toString(), `10`);
+shouldBe([10n, createHeapBigInt(20n), 30n].toString(), `10,20,30`);
+shouldBe([createHeapBigInt(10n), createHeapBigInt(20n), 30n].toString(), `10,20,30`);

Modified: trunk/Source/_javascript_Core/ChangeLog (260905 => 260906)


--- trunk/Source/_javascript_Core/ChangeLog	2020-04-29 17:52:30 UTC (rev 260905)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-04-29 18:03:53 UTC (rev 260906)
@@ -1,3 +1,16 @@
+2020-04-29  Yusuke Suzuki  <[email protected]>
+
+        [JSC] JSStringJoiner is missing BigInt handling
+        https://bugs.webkit.org/show_bug.cgi?id=211174
+
+        Reviewed by Mark Lam.
+
+        JSStringJoiner missed handling of BigInt (specifically BigInt32) and appending empty string incorrectly.
+        In debug build, assertion hits. We should support BigInt in JSStringJoiner.
+
+        * runtime/JSStringJoiner.h:
+        (JSC::JSStringJoiner::appendWithoutSideEffects):
+
 2020-04-29  Saam Barati  <[email protected]>
 
         U_STRING_NOT_TERMINATED_WARNING ICU must be handled when using the output buffer as a C string

Modified: trunk/Source/_javascript_Core/runtime/JSStringJoiner.h (260905 => 260906)


--- trunk/Source/_javascript_Core/runtime/JSStringJoiner.h	2020-04-29 17:52:30 UTC (rev 260905)
+++ trunk/Source/_javascript_Core/runtime/JSStringJoiner.h	2020-04-29 18:03:53 UTC (rev 260906)
@@ -116,6 +116,8 @@
 
     if (value.isCell()) {
         JSString* jsString;
+        // FIXME: Support JSBigInt in side-effect-free append.
+        // https://bugs.webkit.org/show_bug.cgi?id=211173
         if (!value.asCell()->isString())
             return false;
         jsString = asString(value);
@@ -139,6 +141,14 @@
         append8Bit(globalObject->vm().propertyNames->falseKeyword.string());
         return true;
     }
+
+#if USE(BIGINT32)
+    if (value.isBigInt32()) {
+        appendNumber(globalObject->vm(), value.bigInt32AsInt32());
+        return true;
+    }
+#endif
+
     ASSERT(value.isUndefinedOrNull());
     appendEmptyString();
     return true;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to