| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( | 76 v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( |
| 77 CompileRun("(function callFn(fn) { fn(); })")))); | 77 CompileRun("(function callFn(fn) { fn(); })")))); |
| 78 | 78 |
| 79 Isolate* isolate = js_wasm_wrapper->GetIsolate(); | 79 Isolate* isolate = js_wasm_wrapper->GetIsolate(); |
| 80 isolate->SetCaptureStackTraceForUncaughtExceptions(true, 10, | 80 isolate->SetCaptureStackTraceForUncaughtExceptions(true, 10, |
| 81 v8::StackTrace::kOverview); | 81 v8::StackTrace::kOverview); |
| 82 Handle<Object> global(isolate->context()->global_object(), isolate); | 82 Handle<Object> global(isolate->context()->global_object(), isolate); |
| 83 MaybeHandle<Object> maybe_exc; | 83 MaybeHandle<Object> maybe_exc; |
| 84 Handle<Object> args[] = {js_wasm_wrapper}; | 84 Handle<Object> args[] = {js_wasm_wrapper}; |
| 85 MaybeHandle<Object> returnObjMaybe = | 85 MaybeHandle<Object> returnObjMaybe = |
| 86 Execution::TryCall(isolate, js_trampoline, global, 1, args, &maybe_exc); | 86 Execution::TryCall(isolate, js_trampoline, global, 1, args, |
| 87 Execution::MessageHandling::kReport, &maybe_exc); |
| 87 CHECK(returnObjMaybe.is_null()); | 88 CHECK(returnObjMaybe.is_null()); |
| 88 | 89 |
| 89 // Line and column are 1-based, so add 1 for the expected wasm output. | 90 // Line and column are 1-based, so add 1 for the expected wasm output. |
| 90 ExceptionInfo expected_exceptions[] = { | 91 ExceptionInfo expected_exceptions[] = { |
| 91 {"main", static_cast<int>(wasm_index) + 1, 2}, // -- | 92 {"main", static_cast<int>(wasm_index) + 1, 2}, // -- |
| 92 {"callFn", 1, 24} // -- | 93 {"callFn", 1, 24} // -- |
| 93 }; | 94 }; |
| 94 CheckExceptionInfos(maybe_exc.ToHandleChecked(), expected_exceptions); | 95 CheckExceptionInfos(maybe_exc.ToHandleChecked(), expected_exceptions); |
| 95 } | 96 } |
| 96 | 97 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 117 v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( | 118 v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( |
| 118 CompileRun("(function callFn(fn) { fn(); })")))); | 119 CompileRun("(function callFn(fn) { fn(); })")))); |
| 119 | 120 |
| 120 Isolate* isolate = js_wasm_wrapper->GetIsolate(); | 121 Isolate* isolate = js_wasm_wrapper->GetIsolate(); |
| 121 isolate->SetCaptureStackTraceForUncaughtExceptions(true, 10, | 122 isolate->SetCaptureStackTraceForUncaughtExceptions(true, 10, |
| 122 v8::StackTrace::kOverview); | 123 v8::StackTrace::kOverview); |
| 123 Handle<Object> global(isolate->context()->global_object(), isolate); | 124 Handle<Object> global(isolate->context()->global_object(), isolate); |
| 124 MaybeHandle<Object> maybe_exc; | 125 MaybeHandle<Object> maybe_exc; |
| 125 Handle<Object> args[] = {js_wasm_wrapper}; | 126 Handle<Object> args[] = {js_wasm_wrapper}; |
| 126 MaybeHandle<Object> returnObjMaybe = | 127 MaybeHandle<Object> returnObjMaybe = |
| 127 Execution::TryCall(isolate, js_trampoline, global, 1, args, &maybe_exc); | 128 Execution::TryCall(isolate, js_trampoline, global, 1, args, |
| 129 Execution::MessageHandling::kReport, &maybe_exc); |
| 128 CHECK(returnObjMaybe.is_null()); | 130 CHECK(returnObjMaybe.is_null()); |
| 129 | 131 |
| 130 // Line and column are 1-based, so add 1 for the expected wasm output. | 132 // Line and column are 1-based, so add 1 for the expected wasm output. |
| 131 ExceptionInfo expected_exceptions[] = { | 133 ExceptionInfo expected_exceptions[] = { |
| 132 {"main", static_cast<int>(wasm_index_1) + 1, 8}, // -- | 134 {"main", static_cast<int>(wasm_index_1) + 1, 8}, // -- |
| 133 {"call_main", static_cast<int>(wasm_index_2) + 1, 3}, // -- | 135 {"call_main", static_cast<int>(wasm_index_2) + 1, 3}, // -- |
| 134 {"callFn", 1, 24} // -- | 136 {"callFn", 1, 24} // -- |
| 135 }; | 137 }; |
| 136 CheckExceptionInfos(maybe_exc.ToHandleChecked(), expected_exceptions); | 138 CheckExceptionInfos(maybe_exc.ToHandleChecked(), expected_exceptions); |
| 137 } | 139 } |
| OLD | NEW |