[wasm] fix js-api global/value-get-set

Fix WebAssembly's global/value-get-set. The argument must not be
undefined.

mjsunit tests were updated.

Bug: v8:8319
Change-Id: Id3d3c9b18cbc8854e589481dfc7c52f35cfb7bf7
Cq-Include-Trybots: luci.chromium.try:linux-blink-rel
Reviewed-on: https://chromium-review.googlesource.com/c/1411886
Reviewed-by: Ben Smith <binji@chromium.org>
Commit-Queue: Sven Sauleau <ssauleau@igalia.com>
Cr-Commit-Position: refs/heads/master@{#58863}
This commit is contained in:
Sven Sauleau 2019-01-16 16:33:41 +01:00 committed by Commit Bot
parent 4064757cbf
commit e65736241b
3 changed files with 5 additions and 2 deletions

View File

@ -1517,6 +1517,10 @@ void WebAssemblyGlobalSetValue(
thrower.TypeError("Can't set the value of an immutable global.");
return;
}
if (args[0]->IsUndefined()) {
thrower.TypeError("Argument 0: must be a value");
return;
}
switch (receiver->type()) {
case i::wasm::kWasmI32: {

View File

@ -164,7 +164,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
}
TestGlobal(null);
TestGlobal(undefined);
assertThrows(() => TestGlobal(undefined), TypeError);
TestGlobal(1663);
TestGlobal("testmyglobal");
TestGlobal({a: 11});

View File

@ -9,7 +9,6 @@
'table/grow': [FAIL],
'table/get-set': [FAIL],
'module/customSections': [FAIL],
'global/value-get-set': [FAIL],
}], # ALWAYS
[ALWAYS, {