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 | 9 #ifdef V8_USE_ADDRESS_SANITIZER |
10 #include <sanitizer/asan_interface.h> | 10 #include <sanitizer/asan_interface.h> |
(...skipping 1814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1825 // for reuse. capture_message_ needs to be disabled so that DoThrow() | 1825 // for reuse. capture_message_ needs to be disabled so that DoThrow() |
1826 // does not create a new message. | 1826 // does not create a new message. |
1827 isolate_->thread_local_top()->rethrowing_message_ = true; | 1827 isolate_->thread_local_top()->rethrowing_message_ = true; |
1828 isolate_->RestorePendingMessageFromTryCatch(this); | 1828 isolate_->RestorePendingMessageFromTryCatch(this); |
1829 } | 1829 } |
1830 isolate_->UnregisterTryCatchHandler(this); | 1830 isolate_->UnregisterTryCatchHandler(this); |
1831 v8::internal::SimulatorStack::UnregisterCTryCatch(); | 1831 v8::internal::SimulatorStack::UnregisterCTryCatch(); |
1832 reinterpret_cast<Isolate*>(isolate_)->ThrowException(exc); | 1832 reinterpret_cast<Isolate*>(isolate_)->ThrowException(exc); |
1833 ASSERT(!isolate_->thread_local_top()->rethrowing_message_); | 1833 ASSERT(!isolate_->thread_local_top()->rethrowing_message_); |
1834 } else { | 1834 } else { |
| 1835 if (HasCaught() && isolate_->has_scheduled_exception()) { |
| 1836 // If an exception was caught but is still scheduled because no API call |
| 1837 // promoted it, then it is canceled to prevent it from being propagated. |
| 1838 // Note that this will not cancel termination exceptions. |
| 1839 isolate_->CancelScheduledExceptionFromTryCatch(this); |
| 1840 } |
1835 isolate_->UnregisterTryCatchHandler(this); | 1841 isolate_->UnregisterTryCatchHandler(this); |
1836 v8::internal::SimulatorStack::UnregisterCTryCatch(); | 1842 v8::internal::SimulatorStack::UnregisterCTryCatch(); |
1837 } | 1843 } |
1838 } | 1844 } |
1839 | 1845 |
1840 | 1846 |
1841 bool v8::TryCatch::HasCaught() const { | 1847 bool v8::TryCatch::HasCaught() const { |
1842 return !reinterpret_cast<i::Object*>(exception_)->IsTheHole(); | 1848 return !reinterpret_cast<i::Object*>(exception_)->IsTheHole(); |
1843 } | 1849 } |
1844 | 1850 |
(...skipping 5715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7560 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7566 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7561 Address callback_address = | 7567 Address callback_address = |
7562 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7568 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7563 VMState<EXTERNAL> state(isolate); | 7569 VMState<EXTERNAL> state(isolate); |
7564 ExternalCallbackScope call_scope(isolate, callback_address); | 7570 ExternalCallbackScope call_scope(isolate, callback_address); |
7565 callback(info); | 7571 callback(info); |
7566 } | 7572 } |
7567 | 7573 |
7568 | 7574 |
7569 } } // namespace v8::internal | 7575 } } // namespace v8::internal |
OLD | NEW |