Commit ee8ae932 authored by jpp's avatar jpp Committed by Commit bot

[V8][Wasm] Removes references to finally in wasm.

The initial support for low level exception handling in Wasm will not
support finally blocks. This decision is taken for both simplicity (
handling finallys is not straightforward if we want try blocks to yield
values), and lack of good use case (clang++ does not need them.) They
may be added in the future once we understand the implications of
having them.

BUG=

Review-Url: https://codereview.chromium.org/2336303002
Cr-Commit-Position: refs/heads/master@{#39393}
parent 36e58db6
This diff is collapsed.
......@@ -56,11 +56,8 @@ const WasmCodePosition kNoCodePosition = -1;
V(Return, 0x09, _) \
V(Unreachable, 0x0a, _) \
V(Throw, 0xfa, _) \
V(TryCatch, 0xfb, _) \
V(TryCatchFinally, 0xfc, _) \
V(TryFinally, 0xfd, _) \
V(Try, 0xfb, _) \
V(Catch, 0xfe, _) \
V(Finally, 0xff, _) \
V(End, 0x0F, _)
// Constants, locals, globals, and calls.
......
......@@ -2003,73 +2003,17 @@ TEST_F(AstDecoderTest, Throw) {
#define WASM_CATCH(local) kExprCatch, static_cast<byte>(local)
TEST_F(AstDecoderTest, TryCatch) {
FLAG_wasm_eh_prototype = true;
EXPECT_VERIFIES_INLINE(sigs.v_i(), kExprTryCatch, WASM_CATCH(0), kExprEnd);
EXPECT_VERIFIES_INLINE(sigs.v_i(), kExprTry, WASM_CATCH(0), kExprEnd);
// Missing catch.
EXPECT_FAILURE_INLINE(sigs.v_v(), kExprTryCatch, kExprEnd);
EXPECT_FAILURE_INLINE(sigs.v_v(), kExprTry, kExprEnd);
// Missing end.
EXPECT_FAILURE_INLINE(sigs.v_i(), kExprTryCatch, WASM_CATCH(0));
EXPECT_FAILURE_INLINE(sigs.v_i(), kExprTry, WASM_CATCH(0));
// Double catch.
EXPECT_FAILURE_INLINE(sigs.v_i(), kExprTryCatch, WASM_CATCH(0), WASM_CATCH(0),
EXPECT_FAILURE_INLINE(sigs.v_i(), kExprTry, WASM_CATCH(0), WASM_CATCH(0),
kExprEnd);
// Unexpected finally.
EXPECT_FAILURE_INLINE(sigs.v_i(), kExprTryCatch, WASM_CATCH(0), kExprFinally,
kExprEnd);
}
TEST_F(AstDecoderTest, TryFinally) {
FLAG_wasm_eh_prototype = true;
EXPECT_VERIFIES_INLINE(sigs.v_v(), kExprTryFinally, kExprFinally, kExprEnd);
// Mising finally.
EXPECT_FAILURE_INLINE(sigs.v_v(), kExprTryFinally, kExprEnd);
// Missing end.
EXPECT_FAILURE_INLINE(sigs.v_v(), kExprTryFinally, kExprFinally);
// Double finally.
EXPECT_FAILURE_INLINE(sigs.v_v(), kExprTryFinally, kExprFinally, kExprFinally,
kExprEnd);
// Unexpected catch.
EXPECT_FAILURE_INLINE(sigs.v_i(), kExprTryCatch, WASM_CATCH(0), kExprFinally,
kExprEnd);
}
TEST_F(AstDecoderTest, TryCatchFinally) {
FLAG_wasm_eh_prototype = true;
EXPECT_VERIFIES_INLINE(sigs.v_i(), kExprTryCatchFinally, WASM_CATCH(0),
kExprFinally, kExprEnd);
// Missing catch.
EXPECT_FAILURE_INLINE(sigs.v_i(), kExprTryCatchFinally, kExprFinally,
kExprEnd);
// Double catch.
EXPECT_FAILURE_INLINE(sigs.v_i(), kExprTryCatchFinally, WASM_CATCH(0),
WASM_CATCH(0), kExprFinally, kExprEnd);
// Missing finally.
EXPECT_FAILURE_INLINE(sigs.v_i(), kExprTryCatchFinally, WASM_CATCH(0),
kExprEnd);
// Double finally.
EXPECT_FAILURE_INLINE(sigs.v_i(), kExprTryCatchFinally, WASM_CATCH(0),
kExprFinally, kExprFinally, kExprEnd);
// Finally before catch.
EXPECT_FAILURE_INLINE(sigs.v_i(), kExprTryCatchFinally, kExprFinally,
WASM_CATCH(0), kExprEnd);
// Missing both try and finally.
EXPECT_FAILURE_INLINE(sigs.v_i(), kExprTryCatchFinally, kExprEnd);
// Missing end.
EXPECT_FAILURE_INLINE(sigs.v_i(), kExprTryCatchFinally, WASM_CATCH(0),
kExprFinally);
}
class WasmOpcodeLengthTest : public TestWithZone {
......@@ -2100,11 +2044,8 @@ TEST_F(WasmOpcodeLengthTest, Statements) {
EXPECT_LENGTH(3, kExprBr);
EXPECT_LENGTH(3, kExprBrIf);
EXPECT_LENGTH(1, kExprThrow);
EXPECT_LENGTH(1, kExprTryCatch);
EXPECT_LENGTH(1, kExprTryFinally);
EXPECT_LENGTH(1, kExprTryCatchFinally);
EXPECT_LENGTH(1, kExprTry);
EXPECT_LENGTH(2, kExprCatch);
EXPECT_LENGTH(1, kExprFinally);
}
TEST_F(WasmOpcodeLengthTest, MiscExpressions) {
......@@ -2348,11 +2289,8 @@ TEST_F(WasmOpcodeArityTest, Control) {
}
EXPECT_ARITY(0, kExprThrow);
EXPECT_ARITY(0, kExprTryCatch);
EXPECT_ARITY(0, kExprTryFinally);
EXPECT_ARITY(0, kExprTryCatchFinally);
EXPECT_ARITY(0, kExprTry);
EXPECT_ARITY(1, kExprCatch, 2);
EXPECT_ARITY(0, kExprFinally);
}
TEST_F(WasmOpcodeArityTest, Misc) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment