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 "api.h" | 5 #include "api.h" |
6 | 6 |
7 #include <string.h> // For memcpy, strlen. | 7 #include <string.h> // For memcpy, strlen. |
8 #include <cmath> // For isnan. | 8 #include <cmath> // For isnan. |
| 9 #ifdef V8_USE_ADDRESS_SANITIZER |
| 10 #include <sanitizer/asan_interface.h> |
| 11 #endif // V8_USE_ADDRESS_SANITIZER |
9 #include "../include/v8-debug.h" | 12 #include "../include/v8-debug.h" |
10 #include "../include/v8-profiler.h" | 13 #include "../include/v8-profiler.h" |
11 #include "../include/v8-testing.h" | 14 #include "../include/v8-testing.h" |
12 #include "assert-scope.h" | 15 #include "assert-scope.h" |
13 #include "bootstrapper.h" | 16 #include "bootstrapper.h" |
14 #include "code-stubs.h" | 17 #include "code-stubs.h" |
15 #include "compiler.h" | 18 #include "compiler.h" |
16 #include "conversions-inl.h" | 19 #include "conversions-inl.h" |
17 #include "counters.h" | 20 #include "counters.h" |
18 #include "cpu-profiler.h" | 21 #include "cpu-profiler.h" |
(...skipping 1793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1812 } | 1815 } |
1813 isolate_->UnregisterTryCatchHandler(this); | 1816 isolate_->UnregisterTryCatchHandler(this); |
1814 reinterpret_cast<Isolate*>(isolate_)->ThrowException(exc); | 1817 reinterpret_cast<Isolate*>(isolate_)->ThrowException(exc); |
1815 ASSERT(!isolate_->thread_local_top()->rethrowing_message_); | 1818 ASSERT(!isolate_->thread_local_top()->rethrowing_message_); |
1816 } else { | 1819 } else { |
1817 isolate_->UnregisterTryCatchHandler(this); | 1820 isolate_->UnregisterTryCatchHandler(this); |
1818 } | 1821 } |
1819 } | 1822 } |
1820 | 1823 |
1821 | 1824 |
| 1825 v8::TryCatch* v8::TryCatch::DesanitizedThis() { |
| 1826 #ifdef V8_USE_ADDRESS_SANITIZER |
| 1827 return TRY_CATCH_FROM_ADDRESS( |
| 1828 __asan_addr_is_in_fake_stack(asan_fake_stack_handle_, this, NULL, NULL)); |
| 1829 #else |
| 1830 return this; |
| 1831 #endif |
| 1832 } |
| 1833 |
| 1834 |
1822 bool v8::TryCatch::HasCaught() const { | 1835 bool v8::TryCatch::HasCaught() const { |
1823 return !reinterpret_cast<i::Object*>(exception_)->IsTheHole(); | 1836 return !reinterpret_cast<i::Object*>(exception_)->IsTheHole(); |
1824 } | 1837 } |
1825 | 1838 |
1826 | 1839 |
1827 bool v8::TryCatch::CanContinue() const { | 1840 bool v8::TryCatch::CanContinue() const { |
1828 return can_continue_; | 1841 return can_continue_; |
1829 } | 1842 } |
1830 | 1843 |
1831 | 1844 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1886 | 1899 |
1887 | 1900 |
1888 void v8::TryCatch::Reset() { | 1901 void v8::TryCatch::Reset() { |
1889 ASSERT(isolate_ == i::Isolate::Current()); | 1902 ASSERT(isolate_ == i::Isolate::Current()); |
1890 i::Object* the_hole = isolate_->heap()->the_hole_value(); | 1903 i::Object* the_hole = isolate_->heap()->the_hole_value(); |
1891 exception_ = the_hole; | 1904 exception_ = the_hole; |
1892 message_obj_ = the_hole; | 1905 message_obj_ = the_hole; |
1893 message_script_ = the_hole; | 1906 message_script_ = the_hole; |
1894 message_start_pos_ = 0; | 1907 message_start_pos_ = 0; |
1895 message_end_pos_ = 0; | 1908 message_end_pos_ = 0; |
| 1909 #ifdef V8_USE_ADDRESS_SANITIZER |
| 1910 asan_fake_stack_handle_ = __asan_get_current_fake_stack(); |
| 1911 #else |
| 1912 asan_fake_stack_handle_ = NULL; |
| 1913 #endif |
1896 } | 1914 } |
1897 | 1915 |
1898 | 1916 |
1899 void v8::TryCatch::SetVerbose(bool value) { | 1917 void v8::TryCatch::SetVerbose(bool value) { |
1900 is_verbose_ = value; | 1918 is_verbose_ = value; |
1901 } | 1919 } |
1902 | 1920 |
1903 | 1921 |
1904 void v8::TryCatch::SetCaptureMessage(bool value) { | 1922 void v8::TryCatch::SetCaptureMessage(bool value) { |
1905 capture_message_ = value; | 1923 capture_message_ = value; |
(...skipping 5657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7563 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7581 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7564 Address callback_address = | 7582 Address callback_address = |
7565 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7583 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7566 VMState<EXTERNAL> state(isolate); | 7584 VMState<EXTERNAL> state(isolate); |
7567 ExternalCallbackScope call_scope(isolate, callback_address); | 7585 ExternalCallbackScope call_scope(isolate, callback_address); |
7568 callback(info); | 7586 callback(info); |
7569 } | 7587 } |
7570 | 7588 |
7571 | 7589 |
7572 } } // namespace v8::internal | 7590 } } // namespace v8::internal |
OLD | NEW |