98c6744962
This reverts commit 0b091e9bd3
.
Reason for revert: Causes Web Platform Test failures, blocking roll
E.g., https://ci.chromium.org/ui/p/v8/builders/ci/V8%20Blink%20Linux/12616/overview
Original change's description:
> [wasm][eh] Rename Exception to Tag in the JS API
>
> See:
> https://github.com/WebAssembly/exception-handling/issues/159
>
> This change only does the rename where it's observable. This should also
> be renamed throughout the codebase for consistency and will be done
> separately.
>
> R=ahaas@chromium.org
>
> Bug: v8:8091
> Change-Id: Iec1118194981dfd33be6e30256b6e72d12143e1f
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3021172
> Reviewed-by: Andreas Haas <ahaas@chromium.org>
> Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#75718}
Bug: v8:8091
Change-Id: Id2067e1cdc33fa657ef738ef5fafad84057f7209
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3027261
Auto-Submit: Adam Klein <adamk@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/master@{#75725}
60 lines
2.4 KiB
JavaScript
60 lines
2.4 KiB
JavaScript
// Copyright 2021 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-eh
|
|
|
|
load("test/mjsunit/wasm/wasm-module-builder.js");
|
|
|
|
(function TestImport() {
|
|
print(arguments.callee.name);
|
|
|
|
assertThrows(() => new WebAssembly.Exception(), TypeError,
|
|
/Argument 0 must be an exception type/);
|
|
assertThrows(() => new WebAssembly.Exception({}), TypeError,
|
|
/Argument 0 must be an exception type with 'parameters'/);
|
|
assertThrows(() => new WebAssembly.Exception({parameters: ['foo']}), TypeError,
|
|
/Argument 0 parameter type at index #0 must be a value type/);
|
|
assertThrows(() => new WebAssembly.Exception({parameters: {}}), TypeError,
|
|
/Argument 0 contains parameters without 'length'/);
|
|
|
|
let js_except_i32 = new WebAssembly.Exception({parameters: ['i32']});
|
|
let js_except_v = new WebAssembly.Exception({parameters: []});
|
|
let builder = new WasmModuleBuilder();
|
|
builder.addImportedException("m", "ex", kSig_v_i);
|
|
|
|
assertDoesNotThrow(() => builder.instantiate({ m: { ex: js_except_i32 }}));
|
|
assertThrows(
|
|
() => builder.instantiate({ m: { ex: js_except_v }}), WebAssembly.LinkError,
|
|
/imported exception does not match the expected type/);
|
|
assertThrows(
|
|
() => builder.instantiate({ m: { ex: js_except_v }}), WebAssembly.LinkError,
|
|
/imported exception does not match the expected type/);
|
|
})();
|
|
|
|
(function TestExport() {
|
|
print(arguments.callee.name);
|
|
let builder = new WasmModuleBuilder();
|
|
let except = builder.addException(kSig_v_v);
|
|
builder.addExportOfKind("ex", kExternalException, except);
|
|
let instance = builder.instantiate();
|
|
|
|
assertTrue(Object.prototype.hasOwnProperty.call(instance.exports, 'ex'));
|
|
assertEquals("object", typeof instance.exports.ex);
|
|
assertInstanceof(instance.exports.ex, WebAssembly.Exception);
|
|
assertSame(instance.exports.ex.constructor, WebAssembly.Exception);
|
|
})();
|
|
|
|
(function TestImportExport() {
|
|
print(arguments.callee.name);
|
|
|
|
let js_ex_i32 = new WebAssembly.Exception({parameters: ['i32']});
|
|
let builder = new WasmModuleBuilder();
|
|
let index = builder.addImportedException("m", "ex", kSig_v_i);
|
|
builder.addExportOfKind("ex", kExternalException, index);
|
|
|
|
let instance = builder.instantiate({ m: { ex: js_ex_i32 }});
|
|
let res = instance.exports.ex;
|
|
assertEquals(res, js_ex_i32);
|
|
})();
|