Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: test/cctest/wasm/test-wasm-trap-position.cc

Issue 2371833007: [wasm] Initial signal handler (Closed)
Patch Set: Make sure guard pages get set up when resizing from 0 to more than 0 Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/cctest/cctest.cc ('k') | test/cctest/wasm/wasm-run-utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/assembler-inl.h" 5 #include "src/assembler-inl.h"
6 #include "src/trap-handler/trap-handler.h"
6 #include "src/wasm/wasm-macro-gen.h" 7 #include "src/wasm/wasm-macro-gen.h"
7 #include "test/cctest/cctest.h" 8 #include "test/cctest/cctest.h"
8 #include "test/cctest/compiler/value-helper.h" 9 #include "test/cctest/compiler/value-helper.h"
9 #include "test/cctest/wasm/wasm-run-utils.h" 10 #include "test/cctest/wasm/wasm-run-utils.h"
10 #include "test/common/wasm/test-signatures.h" 11 #include "test/common/wasm/test-signatures.h"
11 12
12 using namespace v8::base; 13 using namespace v8::base;
13 using namespace v8::internal; 14 using namespace v8::internal;
14 using namespace v8::internal::compiler; 15 using namespace v8::internal::compiler;
15 using namespace v8::internal::wasm; 16 using namespace v8::internal::wasm;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // Line and column are 1-based, so add 1 for the expected wasm output. 92 // Line and column are 1-based, so add 1 for the expected wasm output.
92 ExceptionInfo expected_exceptions[] = { 93 ExceptionInfo expected_exceptions[] = {
93 {"main", static_cast<int>(wasm_index) + 1, 2}, // -- 94 {"main", static_cast<int>(wasm_index) + 1, 2}, // --
94 {"callFn", 1, 24} // -- 95 {"callFn", 1, 24} // --
95 }; 96 };
96 CheckExceptionInfos(maybe_exc.ToHandleChecked(), expected_exceptions); 97 CheckExceptionInfos(maybe_exc.ToHandleChecked(), expected_exceptions);
97 } 98 }
98 99
99 // Trigger a trap for loading from out-of-bounds. 100 // Trigger a trap for loading from out-of-bounds.
100 TEST(IllegalLoad) { 101 TEST(IllegalLoad) {
102 if (trap_handler::UseTrapHandler()) {
103 // r.module().AddMemory() does not allocate guard pages, so we skip this
104 // test for now when using trap handlers. The simple out of bounds access
105 // case is covered by mjsunit tests, so we are still getting test coverage.
106 //
107 // TODO(eholk): make this test work with trap handlers.
108 return;
109 }
101 WasmRunner<void> r(kExecuteCompiled); 110 WasmRunner<void> r(kExecuteCompiled);
102 TestSignatures sigs; 111 TestSignatures sigs;
103 // Set the execution context, such that a runtime error can be thrown. 112 // Set the execution context, such that a runtime error can be thrown.
104 r.SetModuleContext(); 113 r.SetModuleContext();
105 r.module().AddMemory(0L); 114 r.module().AddMemory(0L);
106 115
107 BUILD(r, WASM_IF(WASM_ONE, WASM_SEQ(WASM_LOAD_MEM(MachineType::Int32(), 116 BUILD(r, WASM_IF(WASM_ONE, WASM_SEQ(WASM_LOAD_MEM(MachineType::Int32(),
108 WASM_I32V_1(-3)), 117 WASM_I32V_1(-3)),
109 WASM_DROP))); 118 WASM_DROP)));
110 uint32_t wasm_index_1 = r.function()->func_index; 119 uint32_t wasm_index_1 = r.function()->func_index;
(...skipping 21 matching lines...) Expand all
132 CHECK(returnObjMaybe.is_null()); 141 CHECK(returnObjMaybe.is_null());
133 142
134 // Line and column are 1-based, so add 1 for the expected wasm output. 143 // Line and column are 1-based, so add 1 for the expected wasm output.
135 ExceptionInfo expected_exceptions[] = { 144 ExceptionInfo expected_exceptions[] = {
136 {"main", static_cast<int>(wasm_index_1) + 1, 8}, // -- 145 {"main", static_cast<int>(wasm_index_1) + 1, 8}, // --
137 {"call_main", static_cast<int>(wasm_index_2) + 1, 3}, // -- 146 {"call_main", static_cast<int>(wasm_index_2) + 1, 3}, // --
138 {"callFn", 1, 24} // -- 147 {"callFn", 1, 24} // --
139 }; 148 };
140 CheckExceptionInfos(maybe_exc.ToHandleChecked(), expected_exceptions); 149 CheckExceptionInfos(maybe_exc.ToHandleChecked(), expected_exceptions);
141 } 150 }
OLDNEW
« no previous file with comments | « test/cctest/cctest.cc ('k') | test/cctest/wasm/wasm-run-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698