Bug 220918 - [WASM-References] Change default value for externref's tables from null to undefined
Summary: [WASM-References] Change default value for externref's tables from null to un...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebAssembly (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-01-25 05:56 PST by Dmitry
Modified: 2021-01-26 13:46 PST (History)
8 users (show)

See Also:


Attachments
Patch (10.10 KB, patch)
2021-01-25 06:00 PST, Dmitry
no flags Details | Formatted Diff | Diff
Patch (10.87 KB, patch)
2021-01-26 07:17 PST, Dmitry
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry 2021-01-25 05:56:09 PST
[WASM-References] Change default value for externref's tables from null to undefined
Comment 1 Dmitry 2021-01-25 06:00:24 PST
Created attachment 418283 [details]
Patch
Comment 2 Yusuke Suzuki 2021-01-25 12:33:30 PST
Comment on attachment 418283 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=418283&action=review

r=me with comments.

> Source/JavaScriptCore/wasm/js/WebAssemblyTableConstructor.cpp:126
> +            : callFrame->argument(1);

Use `uncheckedArgument(1)` since we already checked.

> Source/JavaScriptCore/wasm/js/WebAssemblyTablePrototype.cpp:99
> +            defaultValue = callFrame->argument(1);

Use `callFrame->uncheckedArgument(1);` since we already checked `callFrame->argumentCount() < 2`

> Source/JavaScriptCore/wasm/js/WebAssemblyTablePrototype.cpp:137
>      JSValue value = callFrame->argument(1);
> -    if (Options::useWebAssemblyReferences() && value.isUndefined())
> -        value = jsNull();
> +    if (Options::useWebAssemblyReferences() && callFrame->argumentCount() < 2)
> +        value = defaultValueForTable(table->table()->type());

This needs to be done after

    if (index >= table->length())
        return throwVMRangeError(globalObject, throwScope, "WebAssembly.Table.prototype.set expects an integer less than the length of the table"_s);


part. Can you move it, and add test for this?
Comment 3 Dmitry 2021-01-26 07:17:06 PST
Created attachment 418416 [details]
Patch
Comment 4 Yusuke Suzuki 2021-01-26 12:52:25 PST
Comment on attachment 418416 [details]
Patch

r=me
Comment 5 Yusuke Suzuki 2021-01-26 12:52:55 PST
Comment on attachment 418416 [details]
Patch

EWS is getting stuck.
Comment 6 EWS 2021-01-26 13:45:25 PST
Committed r271903: <https://trac.webkit.org/changeset/271903>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 418416 [details].
Comment 7 Radar WebKit Bug Importer 2021-01-26 13:46:27 PST
<rdar://problem/73631096>