OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 3567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3578 * Returns true if JavaScript execution is currently terminating | 3578 * Returns true if JavaScript execution is currently terminating |
3579 * because of a call to TerminateExecution. In that case there are | 3579 * because of a call to TerminateExecution. In that case there are |
3580 * still JavaScript frames on the stack and the termination | 3580 * still JavaScript frames on the stack and the termination |
3581 * exception is still active. | 3581 * exception is still active. |
3582 * | 3582 * |
3583 * \param isolate The isolate in which to check. | 3583 * \param isolate The isolate in which to check. |
3584 */ | 3584 */ |
3585 static bool IsExecutionTerminating(Isolate* isolate = NULL); | 3585 static bool IsExecutionTerminating(Isolate* isolate = NULL); |
3586 | 3586 |
3587 /** | 3587 /** |
| 3588 * Resume execution capability in the given isolate, whose execution |
| 3589 * was previously forcefully terminated using TerminateExecution(). |
| 3590 * |
| 3591 * When execution is forcefully terminated using TerminateExecution(), |
| 3592 * the isolate can not resume execution until all JavaScript frames |
| 3593 * have propagated the uncatchable exception which is generated. This |
| 3594 * method allows the program embedding the engine to handle the |
| 3595 * termination event and resume execution capability, even if |
| 3596 * JavaScript frames remain on the stack. |
| 3597 * |
| 3598 * This method can be used by any thread even if that thread has not |
| 3599 * acquired the V8 lock with a Locker object. |
| 3600 * |
| 3601 * \param isolate The isolate in which to resume execution capability. |
| 3602 */ |
| 3603 static void CancelTerminateExecution(Isolate* isolate); |
| 3604 |
| 3605 /** |
3588 * Releases any resources used by v8 and stops any utility threads | 3606 * Releases any resources used by v8 and stops any utility threads |
3589 * that may be running. Note that disposing v8 is permanent, it | 3607 * that may be running. Note that disposing v8 is permanent, it |
3590 * cannot be reinitialized. | 3608 * cannot be reinitialized. |
3591 * | 3609 * |
3592 * It should generally not be necessary to dispose v8 before exiting | 3610 * It should generally not be necessary to dispose v8 before exiting |
3593 * a process, this should happen automatically. It is only necessary | 3611 * a process, this should happen automatically. It is only necessary |
3594 * to use if the process needs the resources taken up by v8. | 3612 * to use if the process needs the resources taken up by v8. |
3595 */ | 3613 */ |
3596 static bool Dispose(); | 3614 static bool Dispose(); |
3597 | 3615 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3687 * Unregisters and deletes this try/catch block. | 3705 * Unregisters and deletes this try/catch block. |
3688 */ | 3706 */ |
3689 ~TryCatch(); | 3707 ~TryCatch(); |
3690 | 3708 |
3691 /** | 3709 /** |
3692 * Returns true if an exception has been caught by this try/catch block. | 3710 * Returns true if an exception has been caught by this try/catch block. |
3693 */ | 3711 */ |
3694 bool HasCaught() const; | 3712 bool HasCaught() const; |
3695 | 3713 |
3696 /** | 3714 /** |
3697 * For certain types of exceptions, it makes no sense to continue | 3715 * For certain types of exceptions, it makes no sense to continue execution. |
3698 * execution. | |
3699 * | 3716 * |
3700 * Currently, the only type of exception that can be caught by a | 3717 * If CanContinue returns false, the correct action is to perform any C++ |
3701 * TryCatch handler and for which it does not make sense to continue | 3718 * cleanup needed and then return. If CanContinue returns false and |
3702 * is termination exception. Such exceptions are thrown when the | 3719 * HasTerminated returns true, it is possible to call |
3703 * TerminateExecution methods are called to terminate a long-running | 3720 * CancelTerminateExecution in order to continue calling into the engine. |
3704 * script. | |
3705 * | |
3706 * If CanContinue returns false, the correct action is to perform | |
3707 * any C++ cleanup needed and then return. | |
3708 */ | 3721 */ |
3709 bool CanContinue() const; | 3722 bool CanContinue() const; |
3710 | 3723 |
3711 /** | 3724 /** |
| 3725 * Returns true if an exception has been caught due to script execution |
| 3726 * being terminated. |
| 3727 * |
| 3728 * There is no JavaScript representation of an execution termination |
| 3729 * exception. Such exceptions are thrown when the TerminateExecution |
| 3730 * methods are called to terminate a long-running script. |
| 3731 * |
| 3732 * If such an exception has been thrown, HasTerminated will return true, |
| 3733 * indicating that it is possible to call CancelTerminateExecution in order |
| 3734 * to continue calling into the engine. |
| 3735 */ |
| 3736 bool HasTerminated() const; |
| 3737 |
| 3738 /** |
3712 * Throws the exception caught by this TryCatch in a way that avoids | 3739 * Throws the exception caught by this TryCatch in a way that avoids |
3713 * it being caught again by this same TryCatch. As with ThrowException | 3740 * it being caught again by this same TryCatch. As with ThrowException |
3714 * it is illegal to execute any JavaScript operations after calling | 3741 * it is illegal to execute any JavaScript operations after calling |
3715 * ReThrow; the caller must return immediately to where the exception | 3742 * ReThrow; the caller must return immediately to where the exception |
3716 * is caught. | 3743 * is caught. |
3717 */ | 3744 */ |
3718 Handle<Value> ReThrow(); | 3745 Handle<Value> ReThrow(); |
3719 | 3746 |
3720 /** | 3747 /** |
3721 * Returns the exception caught by this try/catch block. If no exception has | 3748 * Returns the exception caught by this try/catch block. If no exception has |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3776 void operator delete(void*, size_t); | 3803 void operator delete(void*, size_t); |
3777 | 3804 |
3778 v8::internal::Isolate* isolate_; | 3805 v8::internal::Isolate* isolate_; |
3779 void* next_; | 3806 void* next_; |
3780 void* exception_; | 3807 void* exception_; |
3781 void* message_; | 3808 void* message_; |
3782 bool is_verbose_ : 1; | 3809 bool is_verbose_ : 1; |
3783 bool can_continue_ : 1; | 3810 bool can_continue_ : 1; |
3784 bool capture_message_ : 1; | 3811 bool capture_message_ : 1; |
3785 bool rethrow_ : 1; | 3812 bool rethrow_ : 1; |
| 3813 bool has_terminated_ : 1; |
3786 | 3814 |
3787 friend class v8::internal::Isolate; | 3815 friend class v8::internal::Isolate; |
3788 }; | 3816 }; |
3789 | 3817 |
3790 | 3818 |
3791 // --- Context --- | 3819 // --- Context --- |
3792 | 3820 |
3793 | 3821 |
3794 /** | 3822 /** |
3795 * Ignore | 3823 * Ignore |
(...skipping 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5021 | 5049 |
5022 | 5050 |
5023 } // namespace v8 | 5051 } // namespace v8 |
5024 | 5052 |
5025 | 5053 |
5026 #undef V8EXPORT | 5054 #undef V8EXPORT |
5027 #undef TYPE_CHECK | 5055 #undef TYPE_CHECK |
5028 | 5056 |
5029 | 5057 |
5030 #endif // V8_H_ | 5058 #endif // V8_H_ |
OLD | NEW |