summaryrefslogtreecommitdiff
path: root/deps/v8/test/cctest/wasm/test-wasm-trap-position.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/test/cctest/wasm/test-wasm-trap-position.cc')
-rw-r--r--deps/v8/test/cctest/wasm/test-wasm-trap-position.cc54
1 files changed, 27 insertions, 27 deletions
diff --git a/deps/v8/test/cctest/wasm/test-wasm-trap-position.cc b/deps/v8/test/cctest/wasm/test-wasm-trap-position.cc
index bd4e82dc4c..0418d46bab 100644
--- a/deps/v8/test/cctest/wasm/test-wasm-trap-position.cc
+++ b/deps/v8/test/cctest/wasm/test-wasm-trap-position.cc
@@ -62,17 +62,15 @@ void CheckExceptionInfos(Handle<Object> exc,
// Trigger a trap for executing unreachable.
TEST(Unreachable) {
+ WasmRunner<void> r(kExecuteCompiled);
TestSignatures sigs;
- TestingModule module;
-
- WasmFunctionCompiler comp1(sigs.v_v(), &module,
- ArrayVector("exec_unreachable"));
// Set the execution context, such that a runtime error can be thrown.
- comp1.SetModuleContext();
- BUILD(comp1, WASM_UNREACHABLE);
- uint32_t wasm_index = comp1.CompileAndAdd();
+ r.SetModuleContext();
+
+ BUILD(r, WASM_UNREACHABLE);
+ uint32_t wasm_index = r.function()->func_index;
- Handle<JSFunction> js_wasm_wrapper = module.WrapCode(wasm_index);
+ Handle<JSFunction> js_wasm_wrapper = r.module().WrapCode(wasm_index);
Handle<JSFunction> js_trampoline = Handle<JSFunction>::cast(
v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast(
@@ -85,36 +83,37 @@ TEST(Unreachable) {
MaybeHandle<Object> maybe_exc;
Handle<Object> args[] = {js_wasm_wrapper};
MaybeHandle<Object> returnObjMaybe =
- Execution::TryCall(isolate, js_trampoline, global, 1, args, &maybe_exc);
+ Execution::TryCall(isolate, js_trampoline, global, 1, args,
+ Execution::MessageHandling::kReport, &maybe_exc);
CHECK(returnObjMaybe.is_null());
// Line and column are 1-based, so add 1 for the expected wasm output.
ExceptionInfo expected_exceptions[] = {
- {"<WASM UNNAMED>", static_cast<int>(wasm_index) + 1, 2}, // --
- {"callFn", 1, 24} // --
+ {"main", static_cast<int>(wasm_index) + 1, 2}, // --
+ {"callFn", 1, 24} // --
};
CheckExceptionInfos(maybe_exc.ToHandleChecked(), expected_exceptions);
}
// Trigger a trap for loading from out-of-bounds.
TEST(IllegalLoad) {
+ WasmRunner<void> r(kExecuteCompiled);
TestSignatures sigs;
- TestingModule module;
-
- WasmFunctionCompiler comp1(sigs.v_v(), &module, ArrayVector("mem_oob"));
// Set the execution context, such that a runtime error can be thrown.
- comp1.SetModuleContext();
- BUILD(comp1, WASM_IF(WASM_ONE, WASM_SEQ(WASM_LOAD_MEM(MachineType::Int32(),
- WASM_I32V_1(-3)),
- WASM_DROP)));
- uint32_t wasm_index = comp1.CompileAndAdd();
+ r.SetModuleContext();
+ r.module().AddMemory(0L);
+
+ BUILD(r, WASM_IF(WASM_ONE, WASM_SEQ(WASM_LOAD_MEM(MachineType::Int32(),
+ WASM_I32V_1(-3)),
+ WASM_DROP)));
+ uint32_t wasm_index_1 = r.function()->func_index;
- WasmFunctionCompiler comp2(sigs.v_v(), &module, ArrayVector("call_mem_oob"));
+ WasmFunctionCompiler& f2 = r.NewFunction<void>("call_main");
// Insert a NOP such that the position of the call is not one.
- BUILD(comp2, WASM_NOP, WASM_CALL_FUNCTION0(wasm_index));
- uint32_t wasm_index_2 = comp2.CompileAndAdd();
+ BUILD(f2, WASM_NOP, WASM_CALL_FUNCTION0(wasm_index_1));
+ uint32_t wasm_index_2 = f2.function_index();
- Handle<JSFunction> js_wasm_wrapper = module.WrapCode(wasm_index_2);
+ Handle<JSFunction> js_wasm_wrapper = r.module().WrapCode(wasm_index_2);
Handle<JSFunction> js_trampoline = Handle<JSFunction>::cast(
v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast(
@@ -127,14 +126,15 @@ TEST(IllegalLoad) {
MaybeHandle<Object> maybe_exc;
Handle<Object> args[] = {js_wasm_wrapper};
MaybeHandle<Object> returnObjMaybe =
- Execution::TryCall(isolate, js_trampoline, global, 1, args, &maybe_exc);
+ Execution::TryCall(isolate, js_trampoline, global, 1, args,
+ Execution::MessageHandling::kReport, &maybe_exc);
CHECK(returnObjMaybe.is_null());
// Line and column are 1-based, so add 1 for the expected wasm output.
ExceptionInfo expected_exceptions[] = {
- {"<WASM UNNAMED>", static_cast<int>(wasm_index) + 1, 8}, // --
- {"<WASM UNNAMED>", static_cast<int>(wasm_index_2) + 1, 3}, // --
- {"callFn", 1, 24} // --
+ {"main", static_cast<int>(wasm_index_1) + 1, 8}, // --
+ {"call_main", static_cast<int>(wasm_index_2) + 1, 3}, // --
+ {"callFn", 1, 24} // --
};
CheckExceptionInfos(maybe_exc.ToHandleChecked(), expected_exceptions);
}