Commit cdf2e753 authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[wasm] Extend type reflection to 'exnref' types.

R=ahaas@chromium.org
TEST=mjsunit/wasm/type-reflection-with-exnref
BUG=v8:7742,v8:8091

Change-Id: Ib8bd7b7cfafa3509db743e4404c2f1b573253881
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1771790Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63415}
parent 7f00bb5a
......@@ -137,11 +137,18 @@ Handle<String> ToValueTypeString(Isolate* isolate, ValueType type) {
string = factory->InternalizeUtf8String("f64");
break;
}
// TODO(mstarzinger): Add support and tests for exnref and funcref.
case i::wasm::kWasmAnyRef: {
string = factory->InternalizeUtf8String("anyref");
break;
}
case i::wasm::kWasmFuncRef: {
string = factory->InternalizeUtf8String("anyfunc");
break;
}
case i::wasm::kWasmExnRef: {
string = factory->InternalizeUtf8String("exnref");
break;
}
default:
UNREACHABLE();
}
......
......@@ -33,6 +33,12 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
assertEquals("anyref", type.value);
assertEquals(false, type.mutable);
assertEquals(2, Object.getOwnPropertyNames(type).length);
global = new WebAssembly.Global({value: "anyfunc"});
type = WebAssembly.Global.type(global);
assertEquals("anyfunc", type.value);
assertEquals(false, type.mutable);
assertEquals(2, Object.getOwnPropertyNames(type).length);
})();
// This is an extension of "type-reflection.js/TestFunctionTableSetAndCall" to
......
// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --experimental-wasm-type-reflection --experimental-wasm-eh
load('test/mjsunit/wasm/wasm-module-builder.js');
(function TestGlobalType() {
let global = new WebAssembly.Global({value: "exnref", mutable: true});
let type = WebAssembly.Global.type(global);
assertEquals("exnref", type.value);
assertEquals(true, type.mutable);
assertEquals(2, Object.getOwnPropertyNames(type).length);
global = new WebAssembly.Global({value: "exnref"});
type = WebAssembly.Global.type(global);
assertEquals("exnref", type.value);
assertEquals(false, type.mutable);
assertEquals(2, Object.getOwnPropertyNames(type).length);
})();
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