Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e65b5874938c034f2d03b029d67afb64dff45eca
      
https://github.com/WebKit/WebKit/commit/e65b5874938c034f2d03b029d67afb64dff45eca
  Author: Vassili Bykov <v_by...@apple.com>
  Date:   2025-08-20 (Wed, 20 Aug 2025)

  Changed paths:
    M JSTests/wasm/js-api/memory-grow.js
    A JSTests/wasm/js-api/memory-toFixedLengthBuffer.js
    A JSTests/wasm/js-api/memory-toResizableBuffer.js
    M 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/idlharness.any-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/idlharness.any.html
    M 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/idlharness.any.worker-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/idlharness.any.worker.html
    M 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/to-fixed-length-buffer-shared.any-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/to-fixed-length-buffer-shared.any.html
    M 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/to-fixed-length-buffer-shared.any.worker-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/to-fixed-length-buffer-shared.any.worker.html
    M 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/to-fixed-length-buffer.any-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/to-fixed-length-buffer.any.html
    M 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/to-fixed-length-buffer.any.worker-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/to-fixed-length-buffer.any.worker.html
    M 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/to-resizable-buffer-shared.any-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/to-resizable-buffer-shared.any.html
    M 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/to-resizable-buffer-shared.any.worker-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/to-resizable-buffer-shared.any.worker.html
    M 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/to-resizable-buffer.any-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/to-resizable-buffer.any.html
    M 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/to-resizable-buffer.any.worker-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/to-resizable-buffer.any.worker.html
    M Source/JavaScriptCore/runtime/ArrayBuffer.cpp
    M Source/JavaScriptCore/runtime/ArrayBuffer.h
    M Source/JavaScriptCore/runtime/OptionsList.h
    M Source/JavaScriptCore/wasm/WasmMemory.cpp
    M Source/JavaScriptCore/wasm/WasmMemory.h
    M Source/JavaScriptCore/wasm/js/JSWebAssemblyMemory.cpp
    M Source/JavaScriptCore/wasm/js/JSWebAssemblyMemory.h
    M Source/JavaScriptCore/wasm/js/WebAssemblyMemoryPrototype.cpp
    M Source/JavaScriptCore/wasm/js/WebAssemblyMemoryPrototype.h

  Log Message:
  -----------
  Implement resizable SABs for Wasm memories
https://bugs.webkit.org/show_bug.cgi?id=297071
rdar://147437929

Reviewed by Yusuke Suzuki.

This patch adds the implementation of the .toFixedLengthBuffer()
and .toResizableBuffer() methods of WebAssembly.Memory.prototype
as specified by 
https://webassembly.github.io/threads/js-api/index.html#memories.

Availability of this feature is controlled by the option 
`useWasmMemoryToBufferAPIs`.
It is set to false on landing, except for the tests specifically targeting this,
such as `imported/w3c/web-platform-tests/wasm/jsapi/idlharness.any`.

Notable changes:

  - ArrayBuffer is given the ability to point at the Wasm memory it represents.
    This is used when the buffer is resizable non-shared, so that growth 
requests
    initiated by the buffer are routed to the memory. (In the shared case that
    is not needed because growing is always done by SharedArrayBufferContents).

  - To support the above, Wasm::Memory is made CanMakeWeakPtr.

  - JSWebAssemblyMemory::growSuccessCallback sends a refresh notification to
    its associated buffer if it's resizable non-shared, to update its length.
    Again, this explicit update is needed because in that setup there is no
    SharedArrayBufferContents common to the buffer and the memory.

  - The ArrayBuffer::isFixedLength() function is added, not because it's 
strictly
    necessary, but to match the IsFixedLengthArrayBuffer abstract operations in 
the spec,
    making it harder to make a mistake.

The expectations of WPT jsapi/memory tests are updated to expect the tests to 
pass.

Canonical link: https://commits.webkit.org/298955@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to