• Tobias Tebbi's avatar
    [wasm] add experimental string/Wasm GC array conversion fast-path · b16d2a4e
    Tobias Tebbi authored
    This CL adds two experimental JS builtins to convert between
    i16 Wasm GC and JS strings. This is a non-standard experimental
    feature only available with the flag --wasm-gc-js-interop.
    
    WebAssembly.experimentalConvertArrayToString(array, start, count)
    Convert the `count`-many WTF-16 code units starting at index `start`
    into a JS string. Throws a TypeError if `array` is not an i16 array,
    or if `start` and `count` are not numbers or not in range.
    
    WebAssembly.experimentalConvertStringToArray(string, sampleArray)
    Convert `string` to an i16 array. The `sampleArray` parameter needs
    to be an arbitrary i16 array, which is only used to extract the rtt.
    Throws a TypeError if `string` is not a string or `sampleArray` is not
    an i16 array.
    
    Change-Id: I7ac2f6bd89b8f638427f61da1bb01ccba90d735b
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3642301
    Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
    Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#80505}
    b16d2a4e
wasm.tq 28 KB