Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(284)

Side by Side Diff: include/v8.h

Issue 14401008: Add methods to allow resuming execution after calling TerminateExecution(). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « AUTHORS ('k') | src/api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3658 matching lines...) Expand 10 before | Expand all | Expand 10 after
3669 * Returns true if JavaScript execution is currently terminating 3669 * Returns true if JavaScript execution is currently terminating
3670 * because of a call to TerminateExecution. In that case there are 3670 * because of a call to TerminateExecution. In that case there are
3671 * still JavaScript frames on the stack and the termination 3671 * still JavaScript frames on the stack and the termination
3672 * exception is still active. 3672 * exception is still active.
3673 * 3673 *
3674 * \param isolate The isolate in which to check. 3674 * \param isolate The isolate in which to check.
3675 */ 3675 */
3676 static bool IsExecutionTerminating(Isolate* isolate = NULL); 3676 static bool IsExecutionTerminating(Isolate* isolate = NULL);
3677 3677
3678 /** 3678 /**
3679 * Resume execution capability in the given isolate, whose execution
3680 * was previously forcefully terminated using TerminateExecution().
3681 *
3682 * When execution is forcefully terminated using TerminateExecution(),
3683 * the isolate can not resume execution until all JavaScript frames
3684 * have propagated the uncatchable exception which is generated. This
3685 * method allows the program embedding the engine to handle the
3686 * termination event and resume execution capability, even if
3687 * JavaScript frames remain on the stack.
3688 *
3689 * This method can be used by any thread even if that thread has not
3690 * acquired the V8 lock with a Locker object.
3691 *
3692 * \param isolate The isolate in which to resume execution capability.
3693 */
3694 static void CancelTerminateExecution(Isolate* isolate);
3695
3696 /**
3679 * Releases any resources used by v8 and stops any utility threads 3697 * Releases any resources used by v8 and stops any utility threads
3680 * that may be running. Note that disposing v8 is permanent, it 3698 * that may be running. Note that disposing v8 is permanent, it
3681 * cannot be reinitialized. 3699 * cannot be reinitialized.
3682 * 3700 *
3683 * It should generally not be necessary to dispose v8 before exiting 3701 * It should generally not be necessary to dispose v8 before exiting
3684 * a process, this should happen automatically. It is only necessary 3702 * a process, this should happen automatically. It is only necessary
3685 * to use if the process needs the resources taken up by v8. 3703 * to use if the process needs the resources taken up by v8.
3686 */ 3704 */
3687 static bool Dispose(); 3705 static bool Dispose();
3688 3706
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
3778 * Unregisters and deletes this try/catch block. 3796 * Unregisters and deletes this try/catch block.
3779 */ 3797 */
3780 ~TryCatch(); 3798 ~TryCatch();
3781 3799
3782 /** 3800 /**
3783 * Returns true if an exception has been caught by this try/catch block. 3801 * Returns true if an exception has been caught by this try/catch block.
3784 */ 3802 */
3785 bool HasCaught() const; 3803 bool HasCaught() const;
3786 3804
3787 /** 3805 /**
3788 * For certain types of exceptions, it makes no sense to continue 3806 * For certain types of exceptions, it makes no sense to continue execution.
3789 * execution.
3790 * 3807 *
3791 * Currently, the only type of exception that can be caught by a 3808 * If CanContinue returns false, the correct action is to perform any C++
3792 * TryCatch handler and for which it does not make sense to continue 3809 * cleanup needed and then return. If CanContinue returns false and
3793 * is termination exception. Such exceptions are thrown when the 3810 * HasTerminated returns true, it is possible to call
3794 * TerminateExecution methods are called to terminate a long-running 3811 * CancelTerminateExecution in order to continue calling into the engine.
3795 * script.
3796 *
3797 * If CanContinue returns false, the correct action is to perform
3798 * any C++ cleanup needed and then return.
3799 */ 3812 */
3800 bool CanContinue() const; 3813 bool CanContinue() const;
3801 3814
3802 /** 3815 /**
3816 * Returns true if an exception has been caught due to script execution
3817 * being terminated.
3818 *
3819 * There is no JavaScript representation of an execution termination
3820 * exception. Such exceptions are thrown when the TerminateExecution
3821 * methods are called to terminate a long-running script.
3822 *
3823 * If such an exception has been thrown, HasTerminated will return true,
3824 * indicating that it is possible to call CancelTerminateExecution in order
3825 * to continue calling into the engine.
3826 */
3827 bool HasTerminated() const;
3828
3829 /**
3803 * Throws the exception caught by this TryCatch in a way that avoids 3830 * Throws the exception caught by this TryCatch in a way that avoids
3804 * it being caught again by this same TryCatch. As with ThrowException 3831 * it being caught again by this same TryCatch. As with ThrowException
3805 * it is illegal to execute any JavaScript operations after calling 3832 * it is illegal to execute any JavaScript operations after calling
3806 * ReThrow; the caller must return immediately to where the exception 3833 * ReThrow; the caller must return immediately to where the exception
3807 * is caught. 3834 * is caught.
3808 */ 3835 */
3809 Handle<Value> ReThrow(); 3836 Handle<Value> ReThrow();
3810 3837
3811 /** 3838 /**
3812 * Returns the exception caught by this try/catch block. If no exception has 3839 * 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
3867 void operator delete(void*, size_t); 3894 void operator delete(void*, size_t);
3868 3895
3869 v8::internal::Isolate* isolate_; 3896 v8::internal::Isolate* isolate_;
3870 void* next_; 3897 void* next_;
3871 void* exception_; 3898 void* exception_;
3872 void* message_; 3899 void* message_;
3873 bool is_verbose_ : 1; 3900 bool is_verbose_ : 1;
3874 bool can_continue_ : 1; 3901 bool can_continue_ : 1;
3875 bool capture_message_ : 1; 3902 bool capture_message_ : 1;
3876 bool rethrow_ : 1; 3903 bool rethrow_ : 1;
3904 bool has_terminated_ : 1;
3877 3905
3878 friend class v8::internal::Isolate; 3906 friend class v8::internal::Isolate;
3879 }; 3907 };
3880 3908
3881 3909
3882 // --- Context --- 3910 // --- Context ---
3883 3911
3884 3912
3885 /** 3913 /**
3886 * Ignore 3914 * Ignore
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after
5137 5165
5138 5166
5139 } // namespace v8 5167 } // namespace v8
5140 5168
5141 5169
5142 #undef V8EXPORT 5170 #undef V8EXPORT
5143 #undef TYPE_CHECK 5171 #undef TYPE_CHECK
5144 5172
5145 5173
5146 #endif // V8_H_ 5174 #endif // V8_H_
OLDNEW
« no previous file with comments | « AUTHORS ('k') | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698