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/wasm-run-utils.h" | 9 #include "test/cctest/wasm/wasm-run-utils.h" |
10 #include "test/common/wasm/test-signatures.h" | 10 #include "test/common/wasm/test-signatures.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 Isolate* isolate = js_wasm_wrapper->GetIsolate(); | 103 Isolate* isolate = js_wasm_wrapper->GetIsolate(); |
104 isolate->SetCaptureStackTraceForUncaughtExceptions(true, 10, | 104 isolate->SetCaptureStackTraceForUncaughtExceptions(true, 10, |
105 v8::StackTrace::kOverview); | 105 v8::StackTrace::kOverview); |
106 Handle<Object> global(isolate->context()->global_object(), isolate); | 106 Handle<Object> global(isolate->context()->global_object(), isolate); |
107 MaybeHandle<Object> maybe_exc; | 107 MaybeHandle<Object> maybe_exc; |
108 Handle<Object> args[] = {js_wasm_wrapper}; | 108 Handle<Object> args[] = {js_wasm_wrapper}; |
109 MaybeHandle<Object> returnObjMaybe = | 109 MaybeHandle<Object> returnObjMaybe = |
110 Execution::TryCall(isolate, js_trampoline, global, 1, args, &maybe_exc); | 110 Execution::TryCall(isolate, js_trampoline, global, 1, args, &maybe_exc); |
111 CHECK(returnObjMaybe.is_null()); | 111 CHECK(returnObjMaybe.is_null()); |
112 | 112 |
113 // The column is 1-based, so add 1 to the actual byte offset. | 113 // Line and column are 1-based, so add 1 for the expected wasm output. |
114 ExceptionInfo expected_exceptions[] = { | 114 ExceptionInfo expected_exceptions[] = { |
115 {"a", 3, 8}, // - | 115 {"a", 3, 8}, // - |
116 {"js", 4, 2}, // - | 116 {"js", 4, 2}, // - |
117 {"<WASM UNNAMED>", static_cast<int>(wasm_index), 3}, // - | 117 {"<WASM UNNAMED>", static_cast<int>(wasm_index) + 1, 3}, // - |
118 {"<WASM UNNAMED>", static_cast<int>(wasm_index_2), 2}, // - | 118 {"<WASM UNNAMED>", static_cast<int>(wasm_index_2) + 1, 2}, // - |
119 {"callFn", 1, 24} // - | 119 {"callFn", 1, 24} // - |
120 }; | 120 }; |
121 CheckExceptionInfos(maybe_exc.ToHandleChecked(), expected_exceptions); | 121 CheckExceptionInfos(maybe_exc.ToHandleChecked(), expected_exceptions); |
122 } | 122 } |
123 | 123 |
124 // Trigger a trap in WASM, stack should be JS -> WASM -> WASM. | 124 // Trigger a trap in WASM, stack should be JS -> WASM -> WASM. |
125 TEST(CollectDetailedWasmStack_WasmError) { | 125 TEST(CollectDetailedWasmStack_WasmError) { |
126 TestSignatures sigs; | 126 TestSignatures sigs; |
127 TestingModule module; | 127 TestingModule module; |
128 | 128 |
129 WasmFunctionCompiler comp1(sigs.i_v(), &module, | 129 WasmFunctionCompiler comp1(sigs.i_v(), &module, |
(...skipping 17 matching lines...) Expand all Loading... |
147 Isolate* isolate = js_wasm_wrapper->GetIsolate(); | 147 Isolate* isolate = js_wasm_wrapper->GetIsolate(); |
148 isolate->SetCaptureStackTraceForUncaughtExceptions(true, 10, | 148 isolate->SetCaptureStackTraceForUncaughtExceptions(true, 10, |
149 v8::StackTrace::kOverview); | 149 v8::StackTrace::kOverview); |
150 Handle<Object> global(isolate->context()->global_object(), isolate); | 150 Handle<Object> global(isolate->context()->global_object(), isolate); |
151 MaybeHandle<Object> maybe_exc; | 151 MaybeHandle<Object> maybe_exc; |
152 Handle<Object> args[] = {js_wasm_wrapper}; | 152 Handle<Object> args[] = {js_wasm_wrapper}; |
153 MaybeHandle<Object> maybe_return_obj = | 153 MaybeHandle<Object> maybe_return_obj = |
154 Execution::TryCall(isolate, js_trampoline, global, 1, args, &maybe_exc); | 154 Execution::TryCall(isolate, js_trampoline, global, 1, args, &maybe_exc); |
155 CHECK(maybe_return_obj.is_null()); | 155 CHECK(maybe_return_obj.is_null()); |
156 | 156 |
157 // The column is 1-based, so add 1 to the actual byte offset. | 157 // Line and column are 1-based, so add 1 for the expected wasm output. |
158 ExceptionInfo expected_exceptions[] = { | 158 ExceptionInfo expected_exceptions[] = { |
159 {"<WASM UNNAMED>", static_cast<int>(wasm_index), 2}, // - | 159 {"<WASM UNNAMED>", static_cast<int>(wasm_index) + 1, 2}, // - |
160 {"<WASM UNNAMED>", static_cast<int>(wasm_index_2), 2}, // - | 160 {"<WASM UNNAMED>", static_cast<int>(wasm_index_2) + 1, 2}, // - |
161 {"callFn", 1, 24} //- | 161 {"callFn", 1, 24} //- |
162 }; | 162 }; |
163 CheckExceptionInfos(maybe_exc.ToHandleChecked(), expected_exceptions); | 163 CheckExceptionInfos(maybe_exc.ToHandleChecked(), expected_exceptions); |
164 } | 164 } |
OLD | NEW |