[wasm] Fix argument count of Table.set

Table.set has two arguments, the table index and the value. Therefore
Table.set was defined with a length of 2. However, the value argument is
optional, so the length should actually be 1.

Change-Id: Ica2ea13a8e78c974cb011df2b5dc99f8e7eb4bcd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3398496
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80176}
This commit is contained in:
Andreas Haas 2022-01-19 17:18:34 +01:00 committed by V8 LUCI CQ
parent 7ae52c1521
commit 2f535cdf89
3 changed files with 5 additions and 3 deletions

View File

@ -2851,9 +2851,9 @@ void WasmJs::Install(Isolate* isolate, bool exposed_on_global_object) {
context->set_wasm_table_constructor(*table_constructor);
InstallGetter(isolate, table_proto, "length", WebAssemblyTableGetLength);
InstallFunc(isolate, table_proto, "grow", WebAssemblyTableGrow, 1);
InstallFunc(isolate, table_proto, "set", WebAssemblyTableSet, 1);
InstallFunc(isolate, table_proto, "get", WebAssemblyTableGet, 1, false, NONE,
SideEffectType::kHasNoSideEffect);
InstallFunc(isolate, table_proto, "set", WebAssemblyTableSet, 2);
if (enabled_features.has_type_reflection()) {
InstallFunc(isolate, table_proto, "type", WebAssemblyTableType, 0, false,
NONE, SideEffectType::kHasNoSideEffect);

View File

@ -691,7 +691,7 @@ assertTrue(setDesc.configurable);
// 'WebAssembly.Table.prototype.set' method
let set = setDesc.value;
assertEq(set.length, 2);
assertEq(set.length, 1);
assertFalse(isConstructor(set));
assertThrows(
() => set.call(), TypeError, /Receiver is not a WebAssembly.Table/);

View File

@ -15,9 +15,11 @@
'wpt/function/table.tentative': [FAIL],
'wpt/function/type.tentative': [FAIL],
'wpt/global/type.tentative': [FAIL],
'wpt/interface': [FAIL],
'wpt/table/type.tentative': [FAIL],
# This test is out-dated in the spec repository
'interface': [FAIL],
# Outdated proposal tests.
'proposals/js-types/table/get-set': [FAIL],
'proposals/memory64/table/get-set': [FAIL],