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 3461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3472 * Returns true if JavaScript execution is currently terminating | 3472 * Returns true if JavaScript execution is currently terminating |
3473 * because of a call to TerminateExecution. In that case there are | 3473 * because of a call to TerminateExecution. In that case there are |
3474 * still JavaScript frames on the stack and the termination | 3474 * still JavaScript frames on the stack and the termination |
3475 * exception is still active. | 3475 * exception is still active. |
3476 * | 3476 * |
3477 * \param isolate The isolate in which to check. | 3477 * \param isolate The isolate in which to check. |
3478 */ | 3478 */ |
3479 static bool IsExecutionTerminating(Isolate* isolate = NULL); | 3479 static bool IsExecutionTerminating(Isolate* isolate = NULL); |
3480 | 3480 |
3481 /** | 3481 /** |
3482 * Resume execution capability in the given isolate, whose execution | |
3483 * was previously forcefully terminated using TerminateExecution(). | |
3484 * | |
3485 * When execution is forcefully terminated using TerminateExecution(), | |
3486 * the isolate can not resume execution until all JavaScript frames | |
3487 * have propagated the uncatchable exception which is generated. This | |
3488 * method allows the program embedding the engine to handle the | |
3489 * termination event and resume execution capability, even if | |
3490 * JavaScript frames remain on the stack. | |
3491 * | |
3492 * This method can be used by any thread even if that thread has not | |
3493 * acquired the V8 lock with a Locker object. | |
3494 * | |
3495 * \param isolate The isolate in which to resume execution capability. | |
3496 */ | |
3497 static void ResumeExecution(Isolate* isolate); | |
3498 | |
3499 /** | |
3500 * Releases any resources used by v8 and stops any utility threads | 3482 * Releases any resources used by v8 and stops any utility threads |
3501 * that may be running. Note that disposing v8 is permanent, it | 3483 * that may be running. Note that disposing v8 is permanent, it |
3502 * cannot be reinitialized. | 3484 * cannot be reinitialized. |
3503 * | 3485 * |
3504 * It should generally not be necessary to dispose v8 before exiting | 3486 * It should generally not be necessary to dispose v8 before exiting |
3505 * a process, this should happen automatically. It is only necessary | 3487 * a process, this should happen automatically. It is only necessary |
3506 * to use if the process needs the resources taken up by v8. | 3488 * to use if the process needs the resources taken up by v8. |
3507 */ | 3489 */ |
3508 static bool Dispose(); | 3490 static bool Dispose(); |
3509 | 3491 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3611 | 3593 |
3612 /** | 3594 /** |
3613 * Returns true if an exception has been caught by this try/catch block. | 3595 * Returns true if an exception has been caught by this try/catch block. |
3614 */ | 3596 */ |
3615 bool HasCaught() const; | 3597 bool HasCaught() const; |
3616 | 3598 |
3617 /** | 3599 /** |
3618 * For certain types of exceptions, it makes no sense to continue | 3600 * For certain types of exceptions, it makes no sense to continue |
3619 * execution. | 3601 * execution. |
3620 * | 3602 * |
| 3603 * Currently, the only type of exception that can be caught by a |
| 3604 * TryCatch handler and for which it does not make sense to continue |
| 3605 * is termination exception. Such exceptions are thrown when the |
| 3606 * TerminateExecution methods are called to terminate a long-running |
| 3607 * script. |
| 3608 * |
3621 * If CanContinue returns false, the correct action is to perform | 3609 * If CanContinue returns false, the correct action is to perform |
3622 * any C++ cleanup needed and then return. If CanContinue returns | 3610 * any C++ cleanup needed and then return. |
3623 * false and HasTerminated returns true, it is possible to call | |
3624 * ResumeExecution in order to continue calling into the engine. | |
3625 */ | 3611 */ |
3626 bool CanContinue() const; | 3612 bool CanContinue() const; |
3627 | 3613 |
3628 /** | 3614 /** |
3629 * Returns true if an exception has been caught due to script execution | |
3630 * being terminated. | |
3631 * | |
3632 * There is no JavaScript representation of an execution termination | |
3633 * exception. Such exceptions are thrown when the TerminateExecution | |
3634 * methods are called to terminate a long-running script. | |
3635 * | |
3636 * If such an exception has been thrown, HasTerminated will return | |
3637 * true, indicating that it is possible to call ResumeExecution in | |
3638 * order to continue calling into the engine. | |
3639 */ | |
3640 bool HasTerminated() const; | |
3641 | |
3642 /** | |
3643 * Throws the exception caught by this TryCatch in a way that avoids | 3615 * Throws the exception caught by this TryCatch in a way that avoids |
3644 * it being caught again by this same TryCatch. As with ThrowException | 3616 * it being caught again by this same TryCatch. As with ThrowException |
3645 * it is illegal to execute any JavaScript operations after calling | 3617 * it is illegal to execute any JavaScript operations after calling |
3646 * ReThrow; the caller must return immediately to where the exception | 3618 * ReThrow; the caller must return immediately to where the exception |
3647 * is caught. | 3619 * is caught. |
3648 */ | 3620 */ |
3649 Handle<Value> ReThrow(); | 3621 Handle<Value> ReThrow(); |
3650 | 3622 |
3651 /** | 3623 /** |
3652 * Returns the exception caught by this try/catch block. If no exception has | 3624 * 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... |
3707 void operator delete(void*, size_t); | 3679 void operator delete(void*, size_t); |
3708 | 3680 |
3709 v8::internal::Isolate* isolate_; | 3681 v8::internal::Isolate* isolate_; |
3710 void* next_; | 3682 void* next_; |
3711 void* exception_; | 3683 void* exception_; |
3712 void* message_; | 3684 void* message_; |
3713 bool is_verbose_ : 1; | 3685 bool is_verbose_ : 1; |
3714 bool can_continue_ : 1; | 3686 bool can_continue_ : 1; |
3715 bool capture_message_ : 1; | 3687 bool capture_message_ : 1; |
3716 bool rethrow_ : 1; | 3688 bool rethrow_ : 1; |
3717 bool has_terminated_ : 1; | |
3718 | 3689 |
3719 friend class v8::internal::Isolate; | 3690 friend class v8::internal::Isolate; |
3720 }; | 3691 }; |
3721 | 3692 |
3722 | 3693 |
3723 // --- Context --- | 3694 // --- Context --- |
3724 | 3695 |
3725 | 3696 |
3726 /** | 3697 /** |
3727 * Ignore | 3698 * Ignore |
(...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4892 | 4863 |
4893 | 4864 |
4894 } // namespace v8 | 4865 } // namespace v8 |
4895 | 4866 |
4896 | 4867 |
4897 #undef V8EXPORT | 4868 #undef V8EXPORT |
4898 #undef TYPE_CHECK | 4869 #undef TYPE_CHECK |
4899 | 4870 |
4900 | 4871 |
4901 #endif // V8_H_ | 4872 #endif // V8_H_ |
OLD | NEW |