RESOLVED FIXED 220323
[WASM-References] Add optional default value parameter for Table.constructor, Table.grow and Table.set
https://bugs.webkit.org/show_bug.cgi?id=220323
Summary [WASM-References] Add optional default value parameter for Table.constructor,...
Dmitry
Reported 2021-01-05 05:14:32 PST
[WASM-References] Add optional default value parameter for Table.grow
Attachments
Patch (7.29 KB, patch)
2021-01-05 05:18 PST, Dmitry
no flags
Patch (14.22 KB, patch)
2021-01-06 03:17 PST, Dmitry
no flags
Patch (18.50 KB, patch)
2021-01-06 22:56 PST, Dmitry
no flags
Patch (18.53 KB, patch)
2021-01-07 03:23 PST, Dmitry
no flags
Patch (18.54 KB, patch)
2021-01-07 21:54 PST, Dmitry
no flags
Dmitry
Comment 1 2021-01-05 05:18:34 PST
Yusuke Suzuki
Comment 2 2021-01-05 12:35:04 PST
Comment on attachment 416994 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=416994&action=review r- since I found a bug. We also need description more about the change. > Source/JavaScriptCore/ChangeLog:8 > + Introduce the Table.grow optional default value. ChangeLog is super important in WebKit project. Please add more comments about changes in ChangeLog. We need more description about the change in particular, for feature change. > Source/JavaScriptCore/wasm/js/WebAssemblyTablePrototype.cpp:100 > + JSValue defaultValue = callFrame->argument(1); > + if (defaultValue.isUndefined()) > + defaultValue = jsNull(); > uint32_t oldLength = table->length(); > > - if (!table->grow(delta)) > + if (!table->grow(delta, defaultValue)) > return JSValue::encode(throwException(globalObject, throwScope, createRangeError(globalObject, "WebAssembly.Table.prototype.grow could not grow the table"_s))); I think this has a bug. If table is function ref table, then values that can be configured to the table is limited. Can you align the implementation to the spec's change? https://webassembly.github.io/reference-types/js-api/index.html#dom-table-grow 5. If value is missing, 5.1. Let ref be DefaultValue(elementType). 6. Otherwise, 6.1. Let ref be ? ToWebAssemblyValue(value, elementType).
Yusuke Suzuki
Comment 3 2021-01-05 16:40:08 PST
Comment on attachment 416994 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=416994&action=review >> Source/JavaScriptCore/wasm/js/WebAssemblyTablePrototype.cpp:100 >> return JSValue::encode(throwException(globalObject, throwScope, createRangeError(globalObject, "WebAssembly.Table.prototype.grow could not grow the table"_s))); > > I think this has a bug. > If table is function ref table, then values that can be configured to the table is limited. > Can you align the implementation to the spec's change? https://webassembly.github.io/reference-types/js-api/index.html#dom-table-grow > > 5. If value is missing, > 5.1. Let ref be DefaultValue(elementType). > 6. Otherwise, > 6.1. Let ref be ? ToWebAssemblyValue(value, elementType). And can you add tests for the above thing :) ?
Dmitry
Comment 4 2021-01-06 03:17:55 PST
Yusuke Suzuki
Comment 5 2021-01-06 12:36:58 PST
Comment on attachment 417077 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=417077&action=review r=me with EWS fix. LayoutTest contain reference-types tests for Tables. expect files need to be rebaselined. > Source/JavaScriptCore/ChangeLog:3 > + [WASM-References] Add optional default value parameter for Table.grow Let's change the title since this patch includes constructor and Table#set support too. > Source/JavaScriptCore/wasm/js/WebAssemblyTableConstructor.cpp:124 > + JSValue jsWebAssemblyTableValue = JSWebAssemblyTable::tryCreate(globalObject, vm, webAssemblyTableStructure, wasmTable.releaseNonNull()); Let's just receive it as `JSWebAssemblyTable* jsWebAssemblyTableValue = ...`. > Source/JavaScriptCore/wasm/js/WebAssemblyTableConstructor.cpp:129 > + JSWebAssemblyTable* table = jsDynamicCast<JSWebAssemblyTable*>(vm, jsWebAssemblyTableValue); Remove this line. > Source/JavaScriptCore/wasm/js/WebAssemblyTablePrototype.cpp:98 > + return JSValue::encode(throwException(globalObject, throwScope, createTypeError(globalObject, "WebAssembly.Table.prototype.grow expects the second argument to be null or an instance of WebAssembly.Function"_s))); Use `throwVMTypeError` instead. > Source/JavaScriptCore/wasm/js/WebAssemblyTablePrototype.cpp:101 > + if (!table->grow(delta, defaultValue)) Let's change the old code with throwVMTypeError. > JSTests/ChangeLog:3 > + [WASM-References] Add optional default value parameter for Table.grow Ditto.
Yusuke Suzuki
Comment 6 2021-01-06 17:30:44 PST
Hmmm, it seems that many imported wpt tests are failing because of WebAssembly.Table's extension. And sometimes it involves many other non-related Table tests. This is not great since it regresses the coverage of testing. Can you import js-api tests separately from https://github.com/WebAssembly/reference-types and ensure they are passing?
Dmitry
Comment 7 2021-01-06 22:56:15 PST
Dmitry
Comment 8 2021-01-07 03:23:04 PST
Dmitry
Comment 9 2021-01-07 21:54:15 PST
EWS
Comment 10 2021-01-08 10:18:11 PST
Committed r271303: <https://trac.webkit.org/changeset/271303> All reviewed patches have been landed. Closing bug and clearing flags on attachment 417243 [details].
Radar WebKit Bug Importer
Comment 11 2021-01-08 10:19:15 PST
Note You need to log in before you can comment on or make changes to this bug.