v8/test/message/fail/wasm-exception-throw.js
Michael Starzinger a0fd791875 [wasm] Fix source positions for thrown exceptions.
This fixes the source position printed in the stack trace for exceptions
thrown from within Wasm code. Specifically this affects the stack trace
attached to the exception object, as well as the message propagated to
the console. Both are tested by the new message test.

R=clemensh@chromium.org
TEST=message/fail/wasm-exception-throw
BUG=v8:8091

Change-Id: I5b2f76191cf47457ac113dce9d9601a8a810ee19
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1591603
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61239}
2019-05-06 13:42:48 +00:00

18 lines
539 B
JavaScript

// 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: --expose-wasm --experimental-wasm-eh
load('test/mjsunit/wasm/wasm-module-builder.js');
let builder = new WasmModuleBuilder();
let except = builder.addException(kSig_v_i);
builder.addFunction("throw0", kSig_v_v)
.addBody([
kExprI32Const, 23,
kExprThrow, except,
]).exportFunc();
let instance = builder.instantiate();
instance.exports.throw0();