Title: [291331] trunk/Source/_javascript_Core
- Revision
- 291331
- Author
- [email protected]
- Date
- 2022-03-15 22:19:45 -0700 (Tue, 15 Mar 2022)
Log Message
[JSC] Concurrent byteOffsetImpl should not assume non-detached array-buffer
https://bugs.webkit.org/show_bug.cgi?id=237935
Reviewed by Saam Barati.
r279707 is not enough to fix the issue since underlying ArrayBuffer can be also detached concurrently to
the compiler thread too. This patch fixes it by using dataWithoutPACValidation in the concurrent compiler
thread.
* runtime/ArrayBuffer.h:
(JSC::ArrayBufferContents::dataWithoutPACValidation const):
(JSC::ArrayBuffer::dataWithoutPACValidation):
(JSC::ArrayBuffer::dataWithoutPACValidation const):
* runtime/JSArrayBufferViewInlines.h:
(JSC::JSArrayBufferView::byteOffsetImpl):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (291330 => 291331)
--- trunk/Source/_javascript_Core/ChangeLog 2022-03-16 04:11:41 UTC (rev 291330)
+++ trunk/Source/_javascript_Core/ChangeLog 2022-03-16 05:19:45 UTC (rev 291331)
@@ -1,3 +1,21 @@
+2022-03-15 Yusuke Suzuki <[email protected]>
+
+ [JSC] Concurrent byteOffsetImpl should not assume non-detached array-buffer
+ https://bugs.webkit.org/show_bug.cgi?id=237935
+
+ Reviewed by Saam Barati.
+
+ r279707 is not enough to fix the issue since underlying ArrayBuffer can be also detached concurrently to
+ the compiler thread too. This patch fixes it by using dataWithoutPACValidation in the concurrent compiler
+ thread.
+
+ * runtime/ArrayBuffer.h:
+ (JSC::ArrayBufferContents::dataWithoutPACValidation const):
+ (JSC::ArrayBuffer::dataWithoutPACValidation):
+ (JSC::ArrayBuffer::dataWithoutPACValidation const):
+ * runtime/JSArrayBufferViewInlines.h:
+ (JSC::JSArrayBufferView::byteOffsetImpl):
+
2022-03-14 Adrian Perez de Castro <[email protected]>
[GLib] Expose typed arrays in the public API
Modified: trunk/Source/_javascript_Core/runtime/ArrayBuffer.h (291330 => 291331)
--- trunk/Source/_javascript_Core/runtime/ArrayBuffer.h 2022-03-16 04:11:41 UTC (rev 291330)
+++ trunk/Source/_javascript_Core/runtime/ArrayBuffer.h 2022-03-16 05:19:45 UTC (rev 291331)
@@ -88,6 +88,7 @@
explicit operator bool() { return !!m_data; }
void* data() const { return m_data.getMayBeNull(sizeInBytes()); }
+ void* dataWithoutPACValidation() const { return m_data.getUnsafe(); }
size_t sizeInBytes() const { return m_sizeInBytes; }
bool isShared() const { return m_shared; }
@@ -136,6 +137,9 @@
inline void* data();
inline const void* data() const;
inline size_t byteLength() const;
+
+ inline void* dataWithoutPACValidation();
+ inline const void* dataWithoutPACValidation() const;
void makeShared();
void setSharingMode(ArrayBufferSharingMode);
@@ -201,6 +205,16 @@
return m_contents.data();
}
+void* ArrayBuffer::dataWithoutPACValidation()
+{
+ return m_contents.dataWithoutPACValidation();
+}
+
+const void* ArrayBuffer::dataWithoutPACValidation() const
+{
+ return m_contents.dataWithoutPACValidation();
+}
+
size_t ArrayBuffer::byteLength() const
{
return m_contents.sizeInBytes();
Modified: trunk/Source/_javascript_Core/runtime/JSArrayBufferViewInlines.h (291330 => 291331)
--- trunk/Source/_javascript_Core/runtime/JSArrayBufferViewInlines.h 2022-03-16 04:11:41 UTC (rev 291330)
+++ trunk/Source/_javascript_Core/runtime/JSArrayBufferViewInlines.h 2022-03-16 05:19:45 UTC (rev 291331)
@@ -91,16 +91,21 @@
ArrayBuffer* buffer = possiblySharedBufferImpl<requester>();
ASSERT(buffer);
- if (requester == Mutator) {
+ ptrdiff_t delta = 0;
+ if constexpr (requester == Mutator) {
ASSERT(!isCompilationThread());
ASSERT(!vector() == !buffer->data());
+ delta = bitwise_cast<uint8_t*>(vector()) - static_cast<uint8_t*>(buffer->data());
+ } else {
+ uint8_t* vector = bitwise_cast<uint8_t*>(vectorWithoutPACValidation());
+ uint8_t* data = ""
+ if (!vector || !data)
+ return 0;
+ delta = vector - data;
}
- ptrdiff_t delta =
- bitwise_cast<uint8_t*>(vectorWithoutPACValidation()) - static_cast<uint8_t*>(buffer->data());
-
size_t result = static_cast<size_t>(delta);
- if (requester == Mutator)
+ if constexpr (requester == Mutator)
ASSERT(static_cast<ptrdiff_t>(result) == delta);
else {
if (static_cast<ptrdiff_t>(result) != delta)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes