OLD | NEW |
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/wasm/wasm-macro-gen.h" | 5 #include "src/wasm/wasm-macro-gen.h" |
6 | 6 |
7 #include "test/cctest/cctest.h" | 7 #include "test/cctest/cctest.h" |
8 #include "test/cctest/compiler/value-helper.h" | 8 #include "test/cctest/compiler/value-helper.h" |
9 #include "test/cctest/wasm/test-signatures.h" | 9 #include "test/cctest/wasm/test-signatures.h" |
10 #include "test/cctest/wasm/wasm-run-utils.h" | 10 #include "test/cctest/wasm/wasm-run-utils.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 Isolate* isolate = js_wasm_wrapper->GetIsolate(); | 81 Isolate* isolate = js_wasm_wrapper->GetIsolate(); |
82 isolate->SetCaptureStackTraceForUncaughtExceptions(true, 10, | 82 isolate->SetCaptureStackTraceForUncaughtExceptions(true, 10, |
83 v8::StackTrace::kOverview); | 83 v8::StackTrace::kOverview); |
84 Handle<Object> global(isolate->context()->global_object(), isolate); | 84 Handle<Object> global(isolate->context()->global_object(), isolate); |
85 MaybeHandle<Object> maybe_exc; | 85 MaybeHandle<Object> maybe_exc; |
86 Handle<Object> args[] = {js_wasm_wrapper}; | 86 Handle<Object> args[] = {js_wasm_wrapper}; |
87 MaybeHandle<Object> returnObjMaybe = | 87 MaybeHandle<Object> returnObjMaybe = |
88 Execution::TryCall(isolate, js_trampoline, global, 1, args, &maybe_exc); | 88 Execution::TryCall(isolate, js_trampoline, global, 1, args, &maybe_exc); |
89 CHECK(returnObjMaybe.is_null()); | 89 CHECK(returnObjMaybe.is_null()); |
90 | 90 |
| 91 // The column is 1-based, so add 1 to the actual byte offset. |
91 ExceptionInfo expected_exceptions[] = { | 92 ExceptionInfo expected_exceptions[] = { |
92 {"<WASM UNNAMED>", static_cast<int>(wasm_index), 1}, // -- | 93 {"<WASM UNNAMED>", static_cast<int>(wasm_index), 2}, // -- |
93 {"callFn", 1, 24} // -- | 94 {"callFn", 1, 24} // -- |
94 }; | 95 }; |
95 CheckExceptionInfos(isolate, maybe_exc.ToHandleChecked(), | 96 CheckExceptionInfos(isolate, maybe_exc.ToHandleChecked(), |
96 expected_exceptions); | 97 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) { |
101 TestSignatures sigs; | 102 TestSignatures sigs; |
102 TestingModule module; | 103 TestingModule module; |
(...skipping 19 matching lines...) Expand all Loading... |
122 Isolate* isolate = js_wasm_wrapper->GetIsolate(); | 123 Isolate* isolate = js_wasm_wrapper->GetIsolate(); |
123 isolate->SetCaptureStackTraceForUncaughtExceptions(true, 10, | 124 isolate->SetCaptureStackTraceForUncaughtExceptions(true, 10, |
124 v8::StackTrace::kOverview); | 125 v8::StackTrace::kOverview); |
125 Handle<Object> global(isolate->context()->global_object(), isolate); | 126 Handle<Object> global(isolate->context()->global_object(), isolate); |
126 MaybeHandle<Object> maybe_exc; | 127 MaybeHandle<Object> maybe_exc; |
127 Handle<Object> args[] = {js_wasm_wrapper}; | 128 Handle<Object> args[] = {js_wasm_wrapper}; |
128 MaybeHandle<Object> returnObjMaybe = | 129 MaybeHandle<Object> returnObjMaybe = |
129 Execution::TryCall(isolate, js_trampoline, global, 1, args, &maybe_exc); | 130 Execution::TryCall(isolate, js_trampoline, global, 1, args, &maybe_exc); |
130 CHECK(returnObjMaybe.is_null()); | 131 CHECK(returnObjMaybe.is_null()); |
131 | 132 |
132 // Line number is 1-based, with 0 == kNoLineNumberInfo. | 133 // The column is 1-based, so add 1 to the actual byte offset. |
133 ExceptionInfo expected_exceptions[] = { | 134 ExceptionInfo expected_exceptions[] = { |
134 {"<WASM UNNAMED>", static_cast<int>(wasm_index), 6}, // -- | 135 {"<WASM UNNAMED>", static_cast<int>(wasm_index), 7}, // -- |
135 {"<WASM UNNAMED>", static_cast<int>(wasm_index_2), 2}, // -- | 136 {"<WASM UNNAMED>", static_cast<int>(wasm_index_2), 3}, // -- |
136 {"callFn", 1, 24} // -- | 137 {"callFn", 1, 24} // -- |
137 }; | 138 }; |
138 CheckExceptionInfos(isolate, maybe_exc.ToHandleChecked(), | 139 CheckExceptionInfos(isolate, maybe_exc.ToHandleChecked(), |
139 expected_exceptions); | 140 expected_exceptions); |
140 } | 141 } |
OLD | NEW |