[wasm][eh] Add WebAssembly.Tag.toStringTag()

R=jkummerow@chromium.org

Bug: v8:11992
Change-Id: I4229a6fff8d956a5baa9ab9d5028f9abc20d4039
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3071405
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#76109}
This commit is contained in:
Thibaud Michaud 2021-08-04 17:13:42 +02:00 committed by V8 LUCI CQ
parent 2ae50a3458
commit 51f566481d
2 changed files with 3 additions and 0 deletions

View File

@ -2627,6 +2627,8 @@ void WasmJs::Install(Isolate* isolate, bool exposed_on_global_object) {
JSFunction::EnsureHasInitialMap(tag_constructor);
Handle<JSObject> tag_proto(
JSObject::cast(tag_constructor->instance_prototype()), isolate);
JSObject::AddProperty(isolate, tag_proto, factory->to_string_tag_symbol(),
v8_str(isolate, "WebAssembly.Tag"), ro_attributes);
if (enabled_features.has_type_reflection()) {
InstallFunc(isolate, tag_proto, "type", WebAssemblyTagType, 0);
}

View File

@ -30,6 +30,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
assertThrows(
() => builder.instantiate({ m: { ex: js_except_v }}), WebAssembly.LinkError,
/imported tag does not match the expected type/);
assertTrue(js_except_i32.toString() == "[object WebAssembly.Tag]");
})();
(function TestExport() {