Skip to content

Commit a3e2702

Browse files
thibaudmichaudguybedford
authored andcommitted
deps: V8: cherry-pick 8e214ec3ec8c
Original commit message: [wasm][exnref] Fix catchless try_table If the try_table does not have a catch handler, we don't update the {current_catch_} index or set the {previous_catch} field of the block when we enter it. Therefore also skip the reverse operation when the block ends. [email protected] Fixed: 372261626 Change-Id: Ib3a23e32f9d0ec153d6a00733d96b52cf040e8bd Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5920086 Commit-Queue: Thibaud Michaud <[email protected]> Reviewed-by: Clemens Backes <[email protected]> Cr-Commit-Position: refs/heads/main@{#96481} Refs: v8/v8@8e214ec
1 parent ef09254 commit a3e2702

3 files changed

Lines changed: 27 additions & 2 deletions

File tree

common.gypi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
# Reset this number to 0 on major V8 upgrades.
4040
# Increment by one for each non-official patch applied to deps/v8.
41-
'v8_embedder_string': '-node.49',
41+
'v8_embedder_string': '-node.50',
4242

4343
##### V8 defaults for Node.js #####
4444

deps/v8/src/wasm/function-body-decoder-impl.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3483,7 +3483,11 @@ class WasmFullDecoder : public WasmDecoder<ValidationTag, decoding_mode> {
34833483
if (!VALIDATE(TypeCheckOneArmedIf(c))) return 0;
34843484
}
34853485
if (c->is_try_table()) {
3486-
current_catch_ = c->previous_catch;
3486+
// "Pop" the {current_catch_} index. We did not push it if the block has
3487+
// no handler, so also skip it here in this case.
3488+
if (c->catch_cases.size() > 0) {
3489+
current_catch_ = c->previous_catch;
3490+
}
34873491
FallThrough();
34883492
// Temporarily set the reachability for the catch handlers, and restore
34893493
// it before we actually exit the try block.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2024 the V8 project authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
// Flags: --experimental-wasm-exnref
6+
7+
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
8+
9+
let builder = new WasmModuleBuilder();
10+
let tag = builder.addTag(kSig_v_v);
11+
builder.addFunction("main", kSig_v_v)
12+
.addBody([
13+
kExprTry, kWasmVoid,
14+
kExprTryTable, kWasmVoid, 0,
15+
kExprEnd,
16+
kExprThrow, tag,
17+
kExprCatchAll,
18+
kExprEnd
19+
]).exportFunc();
20+
let instance = builder.instantiate();
21+
assertDoesNotThrow(instance.exports.main);

0 commit comments

Comments
 (0)