Commit 2f535cdf authored by Andreas Haas's avatar Andreas Haas Committed by V8 LUCI CQ

[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/+/3398496Reviewed-by: 's avatarThibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80176}
parent 7ae52c15
...@@ -2851,9 +2851,9 @@ void WasmJs::Install(Isolate* isolate, bool exposed_on_global_object) { ...@@ -2851,9 +2851,9 @@ void WasmJs::Install(Isolate* isolate, bool exposed_on_global_object) {
context->set_wasm_table_constructor(*table_constructor); context->set_wasm_table_constructor(*table_constructor);
InstallGetter(isolate, table_proto, "length", WebAssemblyTableGetLength); InstallGetter(isolate, table_proto, "length", WebAssemblyTableGetLength);
InstallFunc(isolate, table_proto, "grow", WebAssemblyTableGrow, 1); InstallFunc(isolate, table_proto, "grow", WebAssemblyTableGrow, 1);
InstallFunc(isolate, table_proto, "set", WebAssemblyTableSet, 1);
InstallFunc(isolate, table_proto, "get", WebAssemblyTableGet, 1, false, NONE, InstallFunc(isolate, table_proto, "get", WebAssemblyTableGet, 1, false, NONE,
SideEffectType::kHasNoSideEffect); SideEffectType::kHasNoSideEffect);
InstallFunc(isolate, table_proto, "set", WebAssemblyTableSet, 2);
if (enabled_features.has_type_reflection()) { if (enabled_features.has_type_reflection()) {
InstallFunc(isolate, table_proto, "type", WebAssemblyTableType, 0, false, InstallFunc(isolate, table_proto, "type", WebAssemblyTableType, 0, false,
NONE, SideEffectType::kHasNoSideEffect); NONE, SideEffectType::kHasNoSideEffect);
......
...@@ -691,7 +691,7 @@ assertTrue(setDesc.configurable); ...@@ -691,7 +691,7 @@ assertTrue(setDesc.configurable);
// 'WebAssembly.Table.prototype.set' method // 'WebAssembly.Table.prototype.set' method
let set = setDesc.value; let set = setDesc.value;
assertEq(set.length, 2); assertEq(set.length, 1);
assertFalse(isConstructor(set)); assertFalse(isConstructor(set));
assertThrows( assertThrows(
() => set.call(), TypeError, /Receiver is not a WebAssembly.Table/); () => set.call(), TypeError, /Receiver is not a WebAssembly.Table/);
......
...@@ -15,9 +15,11 @@ ...@@ -15,9 +15,11 @@
'wpt/function/table.tentative': [FAIL], 'wpt/function/table.tentative': [FAIL],
'wpt/function/type.tentative': [FAIL], 'wpt/function/type.tentative': [FAIL],
'wpt/global/type.tentative': [FAIL], 'wpt/global/type.tentative': [FAIL],
'wpt/interface': [FAIL],
'wpt/table/type.tentative': [FAIL], 'wpt/table/type.tentative': [FAIL],
# This test is out-dated in the spec repository
'interface': [FAIL],
# Outdated proposal tests. # Outdated proposal tests.
'proposals/js-types/table/get-set': [FAIL], 'proposals/js-types/table/get-set': [FAIL],
'proposals/memory64/table/get-set': [FAIL], 'proposals/memory64/table/get-set': [FAIL],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment