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