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 1833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1844 // for reuse. capture_message_ needs to be disabled so that DoThrow() | 1844 // for reuse. capture_message_ needs to be disabled so that DoThrow() |
1845 // does not create a new message. | 1845 // does not create a new message. |
1846 isolate_->thread_local_top()->rethrowing_message_ = true; | 1846 isolate_->thread_local_top()->rethrowing_message_ = true; |
1847 isolate_->RestorePendingMessageFromTryCatch(this); | 1847 isolate_->RestorePendingMessageFromTryCatch(this); |
1848 } | 1848 } |
1849 isolate_->UnregisterTryCatchHandler(this); | 1849 isolate_->UnregisterTryCatchHandler(this); |
1850 v8::internal::SimulatorStack::UnregisterCTryCatch(); | 1850 v8::internal::SimulatorStack::UnregisterCTryCatch(); |
1851 reinterpret_cast<Isolate*>(isolate_)->ThrowException(exc); | 1851 reinterpret_cast<Isolate*>(isolate_)->ThrowException(exc); |
1852 ASSERT(!isolate_->thread_local_top()->rethrowing_message_); | 1852 ASSERT(!isolate_->thread_local_top()->rethrowing_message_); |
1853 } else { | 1853 } else { |
| 1854 if (HasCaught() && isolate_->has_scheduled_exception()) { |
| 1855 // If an exception was caught but is still scheduled because no API call |
| 1856 // promoted it, then it is canceled to prevent it from being propagated. |
| 1857 // Note that this will not cancel termination exceptions. |
| 1858 isolate_->CancelScheduledExceptionFromTryCatch(this); |
| 1859 } |
1854 isolate_->UnregisterTryCatchHandler(this); | 1860 isolate_->UnregisterTryCatchHandler(this); |
1855 v8::internal::SimulatorStack::UnregisterCTryCatch(); | 1861 v8::internal::SimulatorStack::UnregisterCTryCatch(); |
1856 } | 1862 } |
1857 } | 1863 } |
1858 | 1864 |
1859 | 1865 |
1860 bool v8::TryCatch::HasCaught() const { | 1866 bool v8::TryCatch::HasCaught() const { |
1861 return !reinterpret_cast<i::Object*>(exception_)->IsTheHole(); | 1867 return !reinterpret_cast<i::Object*>(exception_)->IsTheHole(); |
1862 } | 1868 } |
1863 | 1869 |
(...skipping 5733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7597 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7603 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7598 Address callback_address = | 7604 Address callback_address = |
7599 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7605 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7600 VMState<EXTERNAL> state(isolate); | 7606 VMState<EXTERNAL> state(isolate); |
7601 ExternalCallbackScope call_scope(isolate, callback_address); | 7607 ExternalCallbackScope call_scope(isolate, callback_address); |
7602 callback(info); | 7608 callback(info); |
7603 } | 7609 } |
7604 | 7610 |
7605 | 7611 |
7606 } } // namespace v8::internal | 7612 } } // namespace v8::internal |
OLD | NEW |