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 #ifndef V8_ISOLATE_H_ | 5 #ifndef V8_ISOLATE_H_ |
6 #define V8_ISOLATE_H_ | 6 #define V8_ISOLATE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <queue> | 9 #include <queue> |
10 | 10 |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 // This method is called by the api after operations that may throw | 667 // This method is called by the api after operations that may throw |
668 // exceptions. If an exception was thrown and not handled by an external | 668 // exceptions. If an exception was thrown and not handled by an external |
669 // handler the exception is scheduled to be rethrown when we return to running | 669 // handler the exception is scheduled to be rethrown when we return to running |
670 // JavaScript code. If an exception is scheduled true is returned. | 670 // JavaScript code. If an exception is scheduled true is returned. |
671 bool OptionalRescheduleException(bool is_bottom_call); | 671 bool OptionalRescheduleException(bool is_bottom_call); |
672 | 672 |
673 // Push and pop a promise and the current try-catch handler. | 673 // Push and pop a promise and the current try-catch handler. |
674 void PushPromise(Handle<JSObject> promise); | 674 void PushPromise(Handle<JSObject> promise); |
675 void PopPromise(); | 675 void PopPromise(); |
676 Handle<Object> GetPromiseOnStackOnThrow(); | 676 Handle<Object> GetPromiseOnStackOnThrow(); |
| 677 bool PromiseHasUserDefinedRejectHandler(Handle<JSObject> promise); |
677 | 678 |
678 class ExceptionScope { | 679 class ExceptionScope { |
679 public: | 680 public: |
680 // Scope currently can only be used for regular exceptions, | 681 // Scope currently can only be used for regular exceptions, |
681 // not termination exception. | 682 // not termination exception. |
682 inline explicit ExceptionScope(Isolate* isolate); | 683 inline explicit ExceptionScope(Isolate* isolate); |
683 inline ~ExceptionScope(); | 684 inline ~ExceptionScope(); |
684 | 685 |
685 private: | 686 private: |
686 Isolate* isolate_; | 687 Isolate* isolate_; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 // clears and returns the current pending exception. | 745 // clears and returns the current pending exception. |
745 Object* UnwindAndFindHandler(); | 746 Object* UnwindAndFindHandler(); |
746 | 747 |
747 // Tries to predict whether an exception will be caught. Note that this can | 748 // Tries to predict whether an exception will be caught. Note that this can |
748 // only produce an estimate, because it is undecidable whether a finally | 749 // only produce an estimate, because it is undecidable whether a finally |
749 // clause will consume or re-throw an exception. | 750 // clause will consume or re-throw an exception. |
750 enum CatchType { | 751 enum CatchType { |
751 NOT_CAUGHT, | 752 NOT_CAUGHT, |
752 CAUGHT_BY_JAVASCRIPT, | 753 CAUGHT_BY_JAVASCRIPT, |
753 CAUGHT_BY_EXTERNAL, | 754 CAUGHT_BY_EXTERNAL, |
754 CAUGHT_BY_DESUGARING | 755 CAUGHT_BY_DESUGARING, |
| 756 CAUGHT_BY_PROMISE, |
| 757 CAUGHT_BY_ASYNC_AWAIT |
755 }; | 758 }; |
756 CatchType PredictExceptionCatcher(); | 759 CatchType PredictExceptionCatcher(); |
757 | 760 |
758 void ScheduleThrow(Object* exception); | 761 void ScheduleThrow(Object* exception); |
759 // Re-set pending message, script and positions reported to the TryCatch | 762 // Re-set pending message, script and positions reported to the TryCatch |
760 // back to the TLS for re-use when rethrowing. | 763 // back to the TLS for re-use when rethrowing. |
761 void RestorePendingMessageFromTryCatch(v8::TryCatch* handler); | 764 void RestorePendingMessageFromTryCatch(v8::TryCatch* handler); |
762 // Un-schedule an exception that was caught by a TryCatch handler. | 765 // Un-schedule an exception that was caught by a TryCatch handler. |
763 void CancelScheduledExceptionFromTryCatch(v8::TryCatch* handler); | 766 void CancelScheduledExceptionFromTryCatch(v8::TryCatch* handler); |
764 void ReportPendingMessages(); | 767 void ReportPendingMessages(); |
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1671 | 1674 |
1672 EmbeddedVector<char, 128> filename_; | 1675 EmbeddedVector<char, 128> filename_; |
1673 FILE* file_; | 1676 FILE* file_; |
1674 int scope_depth_; | 1677 int scope_depth_; |
1675 }; | 1678 }; |
1676 | 1679 |
1677 } // namespace internal | 1680 } // namespace internal |
1678 } // namespace v8 | 1681 } // namespace v8 |
1679 | 1682 |
1680 #endif // V8_ISOLATE_H_ | 1683 #endif // V8_ISOLATE_H_ |
OLD | NEW |