OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/api.h" | 5 #include "src/api.h" |
6 | 6 |
7 #include <string.h> // For memcpy, strlen. | 7 #include <string.h> // For memcpy, strlen. |
8 #ifdef V8_USE_ADDRESS_SANITIZER | 8 #ifdef V8_USE_ADDRESS_SANITIZER |
9 #include <sanitizer/asan_interface.h> | 9 #include <sanitizer/asan_interface.h> |
10 #endif // V8_USE_ADDRESS_SANITIZER | 10 #endif // V8_USE_ADDRESS_SANITIZER |
(...skipping 1830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1841 | 1841 |
1842 v8::TryCatch::TryCatch() | 1842 v8::TryCatch::TryCatch() |
1843 : isolate_(i::Isolate::Current()), | 1843 : isolate_(i::Isolate::Current()), |
1844 next_(isolate_->try_catch_handler()), | 1844 next_(isolate_->try_catch_handler()), |
1845 is_verbose_(false), | 1845 is_verbose_(false), |
1846 can_continue_(true), | 1846 can_continue_(true), |
1847 capture_message_(true), | 1847 capture_message_(true), |
1848 rethrow_(false), | 1848 rethrow_(false), |
1849 has_terminated_(false) { | 1849 has_terminated_(false) { |
1850 Reset(); | 1850 Reset(); |
1851 js_stack_comparable_address_ = this; | |
1852 #ifdef V8_USE_ADDRESS_SANITIZER | |
1853 void* asan_fake_stack_handle = __asan_get_current_fake_stack(); | |
1854 if (asan_fake_stack_handle != NULL) { | |
1855 js_stack_comparable_address_ = __asan_addr_is_in_fake_stack( | |
1856 asan_fake_stack_handle, js_stack_comparable_address_, NULL, NULL); | |
1857 CHECK(js_stack_comparable_address_ != NULL); | |
1858 } | |
1859 #endif | |
1860 // Special handling for simulators which have a separate JS stack. | 1851 // Special handling for simulators which have a separate JS stack. |
1861 js_stack_comparable_address_ = reinterpret_cast<void*>( | 1852 js_stack_comparable_address_ = |
1862 v8::internal::SimulatorStack::RegisterCTryCatch( | 1853 reinterpret_cast<void*>(v8::internal::SimulatorStack::RegisterCTryCatch( |
1863 reinterpret_cast<uintptr_t>(js_stack_comparable_address_))); | 1854 GetCurrentStackPosition())); |
1864 isolate_->RegisterTryCatchHandler(this); | 1855 isolate_->RegisterTryCatchHandler(this); |
1865 } | 1856 } |
1866 | 1857 |
1867 | 1858 |
1868 v8::TryCatch::~TryCatch() { | 1859 v8::TryCatch::~TryCatch() { |
1869 ASSERT(isolate_ == i::Isolate::Current()); | 1860 ASSERT(isolate_ == i::Isolate::Current()); |
1870 if (rethrow_) { | 1861 if (rethrow_) { |
1871 v8::Isolate* isolate = reinterpret_cast<Isolate*>(isolate_); | 1862 v8::Isolate* isolate = reinterpret_cast<Isolate*>(isolate_); |
1872 v8::HandleScope scope(isolate); | 1863 v8::HandleScope scope(isolate); |
1873 v8::Local<v8::Value> exc = v8::Local<v8::Value>::New(isolate, Exception()); | 1864 v8::Local<v8::Value> exc = v8::Local<v8::Value>::New(isolate, Exception()); |
(...skipping 5784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7658 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7649 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7659 Address callback_address = | 7650 Address callback_address = |
7660 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7651 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7661 VMState<EXTERNAL> state(isolate); | 7652 VMState<EXTERNAL> state(isolate); |
7662 ExternalCallbackScope call_scope(isolate, callback_address); | 7653 ExternalCallbackScope call_scope(isolate, callback_address); |
7663 callback(info); | 7654 callback(info); |
7664 } | 7655 } |
7665 | 7656 |
7666 | 7657 |
7667 } } // namespace v8::internal | 7658 } } // namespace v8::internal |
OLD | NEW |