v8/test/mjsunit/regress/wasm/regress-crbug-1168612.js
Paolo Severini da491ec4e8 [compiler] Enable inlining of JS-to-Wasm calls inside try/catch
Fixes a problem with the inlining of JS-to-Wasm call wrappers into a
surrounding exception handler and re-enables this case.

Bug: v8:11092
Change-Id: I4937838c2b4a199e21f5ac90bee5b8e8de2470be
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2678341
Commit-Queue: Paolo Severini <paolosev@microsoft.com>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73086}
2021-02-28 09:49:40 +00:00

33 lines
849 B
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: --allow-natives-syntax --turbo-inline-js-wasm-calls
load('test/mjsunit/wasm/wasm-module-builder.js');
function getMain() {
var builder = new WasmModuleBuilder();
builder.addFunction("main", kSig_v_v)
.addBody([kExprUnreachable])
.exportAs("main");
return builder.instantiate().exports.main;
}
let foo = getMain();
function loop() {
for (let i = 0; i < 2; i++) {
try {
foo();
} catch (e) {
if (i) {
throw e;
}
}
}
}
%PrepareFunctionForOptimization(loop);
assertThrows(loop, WebAssembly.RuntimeError, "unreachable");
%OptimizeFunctionOnNextCall(loop);
assertThrows(loop, WebAssembly.RuntimeError, "unreachable");