| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( | 97 v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( |
| 98 CompileRun("(function callFn(fn) { fn(); })")))); | 98 CompileRun("(function callFn(fn) { fn(); })")))); |
| 99 | 99 |
| 100 Isolate* isolate = js_wasm_wrapper->GetIsolate(); | 100 Isolate* isolate = js_wasm_wrapper->GetIsolate(); |
| 101 isolate->SetCaptureStackTraceForUncaughtExceptions(true, 10, | 101 isolate->SetCaptureStackTraceForUncaughtExceptions(true, 10, |
| 102 v8::StackTrace::kOverview); | 102 v8::StackTrace::kOverview); |
| 103 Handle<Object> global(isolate->context()->global_object(), isolate); | 103 Handle<Object> global(isolate->context()->global_object(), isolate); |
| 104 MaybeHandle<Object> maybe_exc; | 104 MaybeHandle<Object> maybe_exc; |
| 105 Handle<Object> args[] = {js_wasm_wrapper}; | 105 Handle<Object> args[] = {js_wasm_wrapper}; |
| 106 MaybeHandle<Object> returnObjMaybe = | 106 MaybeHandle<Object> returnObjMaybe = |
| 107 Execution::TryCall(isolate, js_trampoline, global, 1, args, &maybe_exc); | 107 Execution::TryCall(isolate, js_trampoline, global, 1, args, |
| 108 Execution::MessageHandling::kReport, &maybe_exc); |
| 108 CHECK(returnObjMaybe.is_null()); | 109 CHECK(returnObjMaybe.is_null()); |
| 109 | 110 |
| 110 // Line and column are 1-based, so add 1 for the expected wasm output. | 111 // Line and column are 1-based, so add 1 for the expected wasm output. |
| 111 ExceptionInfo expected_exceptions[] = { | 112 ExceptionInfo expected_exceptions[] = { |
| 112 {"a", 3, 8}, // - | 113 {"a", 3, 8}, // - |
| 113 {"js", 4, 2}, // - | 114 {"js", 4, 2}, // - |
| 114 {"main", static_cast<int>(wasm_index_1) + 1, 3}, // - | 115 {"main", static_cast<int>(wasm_index_1) + 1, 3}, // - |
| 115 {"call_main", static_cast<int>(wasm_index_2) + 1, 2}, // - | 116 {"call_main", static_cast<int>(wasm_index_2) + 1, 2}, // - |
| 116 {"callFn", 1, 24} // - | 117 {"callFn", 1, 24} // - |
| 117 }; | 118 }; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 138 v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( | 139 v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( |
| 139 CompileRun("(function callFn(fn) { fn(); })")))); | 140 CompileRun("(function callFn(fn) { fn(); })")))); |
| 140 | 141 |
| 141 Isolate* isolate = js_wasm_wrapper->GetIsolate(); | 142 Isolate* isolate = js_wasm_wrapper->GetIsolate(); |
| 142 isolate->SetCaptureStackTraceForUncaughtExceptions(true, 10, | 143 isolate->SetCaptureStackTraceForUncaughtExceptions(true, 10, |
| 143 v8::StackTrace::kOverview); | 144 v8::StackTrace::kOverview); |
| 144 Handle<Object> global(isolate->context()->global_object(), isolate); | 145 Handle<Object> global(isolate->context()->global_object(), isolate); |
| 145 MaybeHandle<Object> maybe_exc; | 146 MaybeHandle<Object> maybe_exc; |
| 146 Handle<Object> args[] = {js_wasm_wrapper}; | 147 Handle<Object> args[] = {js_wasm_wrapper}; |
| 147 MaybeHandle<Object> maybe_return_obj = | 148 MaybeHandle<Object> maybe_return_obj = |
| 148 Execution::TryCall(isolate, js_trampoline, global, 1, args, &maybe_exc); | 149 Execution::TryCall(isolate, js_trampoline, global, 1, args, |
| 150 Execution::MessageHandling::kReport, &maybe_exc); |
| 149 CHECK(maybe_return_obj.is_null()); | 151 CHECK(maybe_return_obj.is_null()); |
| 150 | 152 |
| 151 // Line and column are 1-based, so add 1 for the expected wasm output. | 153 // Line and column are 1-based, so add 1 for the expected wasm output. |
| 152 ExceptionInfo expected_exceptions[] = { | 154 ExceptionInfo expected_exceptions[] = { |
| 153 {"main", static_cast<int>(wasm_index_1) + 1, 2}, // - | 155 {"main", static_cast<int>(wasm_index_1) + 1, 2}, // - |
| 154 {"call_main", static_cast<int>(wasm_index_2) + 1, 2}, // - | 156 {"call_main", static_cast<int>(wasm_index_2) + 1, 2}, // - |
| 155 {"callFn", 1, 24} //- | 157 {"callFn", 1, 24} //- |
| 156 }; | 158 }; |
| 157 CheckExceptionInfos(maybe_exc.ToHandleChecked(), expected_exceptions); | 159 CheckExceptionInfos(maybe_exc.ToHandleChecked(), expected_exceptions); |
| 158 } | 160 } |
| OLD | NEW |