[webkit-reviews] review granted: [Bug 220918] [WASM-References] Change default value for externref's tables from null to undefined : [Attachment 418283] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jan 25 12:33:30 PST 2021


Yusuke Suzuki <ysuzuki at apple.com> has granted Dmitry <dbezhetskov at igalia.com>'s
request for review:
Bug 220918: [WASM-References] Change default value for externref's tables from
null to undefined
https://bugs.webkit.org/show_bug.cgi?id=220918

Attachment 418283: Patch

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




--- Comment #2 from Yusuke Suzuki <ysuzuki at apple.com> ---
Comment on attachment 418283
  --> https://bugs.webkit.org/attachment.cgi?id=418283
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?


More information about the webkit-reviews mailing list