summaryrefslogtreecommitdiff
path: root/deps/v8/test/cctest/test-js-to-wasm.cc
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2021-06-08 14:04:59 +0200
committerMichaël Zasso <targos@protonmail.com>2021-06-10 11:10:13 +0200
commita7cbf19a82c75e9a65e90fb8ba4947e2fc52ef39 (patch)
treedadfaa9c63c5d8db997b7c7aacc313b04131157c /deps/v8/test/cctest/test-js-to-wasm.cc
parent8834ec9f5c522f7d800d85b245a9806418515b7c (diff)
downloadnode-new-a7cbf19a82c75e9a65e90fb8ba4947e2fc52ef39.tar.gz
deps: update V8 to 9.1.269.36
PR-URL: https://github.com/nodejs/node/pull/38273 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Mary Marchini <oss@mmarchini.me>
Diffstat (limited to 'deps/v8/test/cctest/test-js-to-wasm.cc')
-rw-r--r--deps/v8/test/cctest/test-js-to-wasm.cc40
1 files changed, 28 insertions, 12 deletions
diff --git a/deps/v8/test/cctest/test-js-to-wasm.cc b/deps/v8/test/cctest/test-js-to-wasm.cc
index 4d61e944dc..d0f5122a32 100644
--- a/deps/v8/test/cctest/test-js-to-wasm.cc
+++ b/deps/v8/test/cctest/test-js-to-wasm.cc
@@ -68,6 +68,9 @@ struct ExportedFunction {
DECLARE_EXPORTED_FUNCTION(nop, sigs.v_v(), WASM_CODE({WASM_NOP}))
+DECLARE_EXPORTED_FUNCTION(unreachable, sigs.v_v(),
+ WASM_CODE({WASM_UNREACHABLE}))
+
DECLARE_EXPORTED_FUNCTION(i32_square, sigs.i_i(),
WASM_CODE({WASM_LOCAL_GET(0), WASM_LOCAL_GET(0),
kExprI32Mul}))
@@ -457,9 +460,9 @@ class FastJSWasmCallTester {
";"
"function test() {"
" try {"
- " return " +
+ " return %ObserveNode(" +
exported_function_name +
- "(arg);"
+ "(arg));"
" } catch (e) {"
" return 0;"
" }"
@@ -485,13 +488,19 @@ class FastJSWasmCallTester {
// Executes a test function with a try/catch calling a Wasm function returning
// void.
- void CallAndCheckWithTryCatch_void(const std::string& exported_function_name,
- const v8::Local<v8::Value> arg0,
- const v8::Local<v8::Value> arg1) {
+ void CallAndCheckWithTryCatch_void(
+ const std::string& exported_function_name,
+ const std::vector<v8::Local<v8::Value>>& args) {
LocalContext env;
- CHECK((*env)->Global()->Set(env.local(), v8_str("arg0"), arg0).FromJust());
- CHECK((*env)->Global()->Set(env.local(), v8_str("arg1"), arg1).FromJust());
+ for (size_t i = 0; i < args.size(); i++) {
+ CHECK((*env)
+ ->Global()
+ ->Set(env.local(), v8_str(("arg" + std::to_string(i)).c_str()),
+ args[i])
+ .FromJust());
+ }
+ std::string js_args = ArgsToString(args.size());
std::string js_code =
"const importObj = {"
" env: {"
@@ -509,9 +518,9 @@ class FastJSWasmCallTester {
";"
"function test() {"
" try {"
- " " +
- exported_function_name +
- "(arg0, arg1);"
+ " %ObserveNode(" +
+ exported_function_name + "(" + js_args +
+ "));"
" return 1;"
" } catch (e) {"
" return 0;"
@@ -928,6 +937,13 @@ TEST(TestFastJSWasmCall_EagerDeopt) {
// Exception handling tests
+TEST(TestFastJSWasmCall_Unreachable) {
+ v8::HandleScope scope(CcTest::isolate());
+ FastJSWasmCallTester tester;
+ tester.AddExportedFunction(k_unreachable);
+ tester.CallAndCheckWithTryCatch_void("unreachable", {});
+}
+
TEST(TestFastJSWasmCall_Trap_i32) {
v8::HandleScope scope(CcTest::isolate());
FastJSWasmCallTester tester;
@@ -960,8 +976,8 @@ TEST(TestFastJSWasmCall_Trap_void) {
v8::HandleScope scope(CcTest::isolate());
FastJSWasmCallTester tester;
tester.AddExportedFunction(k_store_i32);
- tester.CallAndCheckWithTryCatch_void("store_i32", v8_int(0x7fffffff),
- v8_int(42));
+ tester.CallAndCheckWithTryCatch_void("store_i32",
+ {v8_int(0x7fffffff), v8_int(42)});
}
// BigInt