Modified: trunk/JSTests/ChangeLog (288036 => 288037)
--- trunk/JSTests/ChangeLog 2022-01-14 23:48:46 UTC (rev 288036)
+++ trunk/JSTests/ChangeLog 2022-01-15 00:44:17 UTC (rev 288037)
@@ -1,3 +1,13 @@
+2022-01-14 Mark Lam <[email protected]>
+
+ JSStringJoiner's constructor should take a size_t length.
+ https://bugs.webkit.org/show_bug.cgi?id=235217
+ rdar://87538657
+
+ Reviewed by Yusuke Suzuki.
+
+ * stress/max-typed-array-length-toString.js: Added.
+
2022-01-14 Alexey Shvayka <[email protected]>
JSArray::fastSlice() should not convert the source from CoW
Added: trunk/JSTests/stress/max-typed-array-length-toString.js (0 => 288037)
--- trunk/JSTests/stress/max-typed-array-length-toString.js (rev 0)
+++ trunk/JSTests/stress/max-typed-array-length-toString.js 2022-01-15 00:44:17 UTC (rev 288037)
@@ -0,0 +1,14 @@
+//@ skip if $architecture != "arm64" && $architecture != "x86-64"
+
+var exception;
+try {
+ var memory = new WebAssembly.Memory({
+ initial: 65536
+ });
+ new Uint8Array(memory.buffer).toString();
+} catch (e) {
+ exception = e;
+}
+
+if (exception != "RangeError: Out of memory")
+ throw "FAILED: " + exception;
Modified: trunk/Source/_javascript_Core/ChangeLog (288036 => 288037)
--- trunk/Source/_javascript_Core/ChangeLog 2022-01-14 23:48:46 UTC (rev 288036)
+++ trunk/Source/_javascript_Core/ChangeLog 2022-01-15 00:44:17 UTC (rev 288037)
@@ -1,3 +1,18 @@
+2022-01-14 Mark Lam <[email protected]>
+
+ JSStringJoiner's constructor should take a size_t length.
+ https://bugs.webkit.org/show_bug.cgi?id=235217
+ rdar://87538657
+
+ Reviewed by Yusuke Suzuki.
+
+ Also removed an unnecessary exception check in JSStringJoiner::append().
+ This is because appendWithoutSideEffects() cannot throw any exceptions.
+
+ * runtime/JSStringJoiner.h:
+ (JSC::JSStringJoiner::JSStringJoiner):
+ (JSC::JSStringJoiner::append):
+
2022-01-14 Alexey Shvayka <[email protected]>
JSArray::fastSlice() should not convert the source from CoW
Modified: trunk/Source/_javascript_Core/runtime/JSStringJoiner.h (288036 => 288037)
--- trunk/Source/_javascript_Core/runtime/JSStringJoiner.h 2022-01-14 23:48:46 UTC (rev 288036)
+++ trunk/Source/_javascript_Core/runtime/JSStringJoiner.h 2022-01-15 00:44:17 UTC (rev 288037)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -33,8 +33,8 @@
class JSStringJoiner {
public:
- JSStringJoiner(JSGlobalObject*, LChar separator, unsigned stringCount);
- JSStringJoiner(JSGlobalObject*, StringView separator, unsigned stringCount);
+ JSStringJoiner(JSGlobalObject*, LChar separator, size_t stringCount);
+ JSStringJoiner(JSGlobalObject*, StringView separator, size_t stringCount);
~JSStringJoiner();
void append(JSGlobalObject*, JSValue);
@@ -57,7 +57,7 @@
bool m_isAll8Bit { true };
};
-inline JSStringJoiner::JSStringJoiner(JSGlobalObject* globalObject, StringView separator, unsigned stringCount)
+inline JSStringJoiner::JSStringJoiner(JSGlobalObject* globalObject, StringView separator, size_t stringCount)
: m_separator(separator)
, m_isAll8Bit(m_separator.is8Bit())
{
@@ -67,7 +67,7 @@
throwOutOfMemoryError(globalObject, scope);
}
-inline JSStringJoiner::JSStringJoiner(JSGlobalObject* globalObject, LChar separator, unsigned stringCount)
+inline JSStringJoiner::JSStringJoiner(JSGlobalObject* globalObject, LChar separator, size_t stringCount)
: m_singleCharacterSeparator(separator)
, m_separator { &m_singleCharacterSeparator, 1 }
{
@@ -152,7 +152,6 @@
auto scope = DECLARE_THROW_SCOPE(vm);
bool success = appendWithoutSideEffects(globalObject, value);
- RETURN_IF_EXCEPTION(scope, void());
if (!success) {
JSString* jsString = value.toString(globalObject);
RETURN_IF_EXCEPTION(scope, void());