Commit 7f00bb5a authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[wasm] Add support to construct 'exnref' type globals.

R=ahaas@chromium.org
TEST=mjsunit/wasm/exceptions-global
BUG=v8:8091

Change-Id: I9eb4c92cca087719afda2da5d11c206aaed28c95
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1771788Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63414}
parent 27b52b2e
......@@ -1223,6 +1223,9 @@ bool GetValueType(Isolate* isolate, MaybeLocal<Value> maybe,
} else if (enabled_features.anyref &&
string->StringEquals(v8_str(isolate, "anyfunc"))) {
*type = i::wasm::kWasmFuncRef;
} else if (enabled_features.eh &&
string->StringEquals(v8_str(isolate, "exnref"))) {
*type = i::wasm::kWasmExnRef;
} else {
// Unrecognized type.
*type = i::wasm::kWasmStmt;
......@@ -1337,7 +1340,8 @@ void WebAssemblyGlobal(const v8::FunctionCallbackInfo<v8::Value>& args) {
global_obj->SetF64(f64_value);
break;
}
case i::wasm::kWasmAnyRef: {
case i::wasm::kWasmAnyRef:
case i::wasm::kWasmExnRef: {
if (args.Length() < 2) {
// When no inital value is provided, we have to use the WebAssembly
// default value 'null', and not the JS default value 'undefined'.
......
......@@ -115,10 +115,8 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
assertThrowsEquals(() => instance.exports.rethrow_exnref(), exception2);
})();
// TODO(mstarzinger): Add the following test once proposal makes it clear how
// far interaction with the mutable globals proposal is intended to go.
// Test loading an imported mutable "exnref" being changed from the outside.
/*(function TestGlobalExnRefGetImportedMutableAndRethrow() {
(function TestGlobalExnRefGetImportedMutableAndRethrow() {
print(arguments.callee.name);
let builder = new WasmModuleBuilder();
let g_index = builder.addImportedGlobal("m", "exn", kWasmExnRef, true);
......@@ -135,7 +133,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
assertThrowsEquals(() => instance.exports.rethrow_exnref(), exception1);
let exception2 = mutable_global.value = "an even fancier exception";
assertThrowsEquals(() => instance.exports.rethrow_exnref(), exception2);
})();*/
})();
// Test custom initialization index for a global "exnref" variable.
(function TestGlobalExnRefInitIndex() {
......
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