diff options
author | Michaël Zasso <targos@protonmail.com> | 2017-03-21 10:16:54 +0100 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2017-03-25 09:44:10 +0100 |
commit | c459d8ea5d402c702948c860d9497b2230ff7e8a (patch) | |
tree | 56c282fc4d40e5cb613b47cf7be3ea0526ed5b6f /deps/v8/test/cctest/wasm/test-wasm-trap-position.cc | |
parent | e0bc5a7361b1d29c3ed034155fd779ce6f44fb13 (diff) | |
download | node-new-c459d8ea5d402c702948c860d9497b2230ff7e8a.tar.gz |
deps: update V8 to 5.7.492.69
PR-URL: https://github.com/nodejs/node/pull/11752
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
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.cc | 54 |
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); } |