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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 * The v8 JavaScript engine. | 96 * The v8 JavaScript engine. |
97 */ | 97 */ |
98 namespace v8 { | 98 namespace v8 { |
99 | 99 |
100 class AccessorInfo; | 100 class AccessorInfo; |
101 class AccessorSignature; | 101 class AccessorSignature; |
102 class Array; | 102 class Array; |
103 class Boolean; | 103 class Boolean; |
104 class BooleanObject; | 104 class BooleanObject; |
105 class Context; | 105 class Context; |
106 class CpuProfiler; | |
107 class Data; | 106 class Data; |
108 class Date; | 107 class Date; |
109 class DeclaredAccessorDescriptor; | 108 class DeclaredAccessorDescriptor; |
110 class External; | 109 class External; |
111 class Function; | 110 class Function; |
112 class FunctionTemplate; | 111 class FunctionTemplate; |
113 class HeapProfiler; | |
114 class ImplementationUtilities; | 112 class ImplementationUtilities; |
115 class Int32; | 113 class Int32; |
116 class Integer; | 114 class Integer; |
117 class Isolate; | 115 class Isolate; |
118 class Number; | 116 class Number; |
119 class NumberObject; | 117 class NumberObject; |
120 class Object; | 118 class Object; |
121 class ObjectOperationDescriptor; | 119 class ObjectOperationDescriptor; |
122 class ObjectTemplate; | 120 class ObjectTemplate; |
123 class Primitive; | 121 class Primitive; |
(...skipping 2893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3017 * global garbage collections more often than it would otherwise in an attempt | 3015 * global garbage collections more often than it would otherwise in an attempt |
3018 * to garbage collect the JavaScript objects that keep the externally | 3016 * to garbage collect the JavaScript objects that keep the externally |
3019 * allocated memory alive. | 3017 * allocated memory alive. |
3020 * | 3018 * |
3021 * \param change_in_bytes the change in externally allocated memory that is | 3019 * \param change_in_bytes the change in externally allocated memory that is |
3022 * kept alive by JavaScript objects. | 3020 * kept alive by JavaScript objects. |
3023 * \returns the adjusted value. | 3021 * \returns the adjusted value. |
3024 */ | 3022 */ |
3025 intptr_t AdjustAmountOfExternalAllocatedMemory(intptr_t change_in_bytes); | 3023 intptr_t AdjustAmountOfExternalAllocatedMemory(intptr_t change_in_bytes); |
3026 | 3024 |
3027 /** | |
3028 * Returns heap profiler for this isolate. Will return NULL until the isolate | |
3029 * is initialized. | |
3030 */ | |
3031 HeapProfiler* GetHeapProfiler(); | |
3032 | |
3033 /** | |
3034 * Returns CPU profiler for this isolate. Will return NULL until the isolate | |
3035 * is initialized. | |
3036 */ | |
3037 CpuProfiler* GetCpuProfiler(); | |
3038 | |
3039 private: | 3025 private: |
3040 Isolate(); | 3026 Isolate(); |
3041 Isolate(const Isolate&); | 3027 Isolate(const Isolate&); |
3042 ~Isolate(); | 3028 ~Isolate(); |
3043 Isolate& operator=(const Isolate&); | 3029 Isolate& operator=(const Isolate&); |
3044 void* operator new(size_t size); | 3030 void* operator new(size_t size); |
3045 void operator delete(void*, size_t); | 3031 void operator delete(void*, size_t); |
3046 }; | 3032 }; |
3047 | 3033 |
3048 | 3034 |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3595 * Returns true if JavaScript execution is currently terminating | 3581 * Returns true if JavaScript execution is currently terminating |
3596 * because of a call to TerminateExecution. In that case there are | 3582 * because of a call to TerminateExecution. In that case there are |
3597 * still JavaScript frames on the stack and the termination | 3583 * still JavaScript frames on the stack and the termination |
3598 * exception is still active. | 3584 * exception is still active. |
3599 * | 3585 * |
3600 * \param isolate The isolate in which to check. | 3586 * \param isolate The isolate in which to check. |
3601 */ | 3587 */ |
3602 static bool IsExecutionTerminating(Isolate* isolate = NULL); | 3588 static bool IsExecutionTerminating(Isolate* isolate = NULL); |
3603 | 3589 |
3604 /** | 3590 /** |
3605 * Resume execution capability in the given isolate, whose execution | |
3606 * was previously forcefully terminated using TerminateExecution(). | |
3607 * | |
3608 * When execution is forcefully terminated using TerminateExecution(), | |
3609 * the isolate can not resume execution until all JavaScript frames | |
3610 * have propagated the uncatchable exception which is generated. This | |
3611 * method allows the program embedding the engine to handle the | |
3612 * termination event and resume execution capability, even if | |
3613 * JavaScript frames remain on the stack. | |
3614 * | |
3615 * This method can be used by any thread even if that thread has not | |
3616 * acquired the V8 lock with a Locker object. | |
3617 * | |
3618 * \param isolate The isolate in which to resume execution capability. | |
3619 */ | |
3620 static void CancelTerminateExecution(Isolate* isolate); | |
3621 | |
3622 /** | |
3623 * Releases any resources used by v8 and stops any utility threads | 3591 * Releases any resources used by v8 and stops any utility threads |
3624 * that may be running. Note that disposing v8 is permanent, it | 3592 * that may be running. Note that disposing v8 is permanent, it |
3625 * cannot be reinitialized. | 3593 * cannot be reinitialized. |
3626 * | 3594 * |
3627 * It should generally not be necessary to dispose v8 before exiting | 3595 * It should generally not be necessary to dispose v8 before exiting |
3628 * a process, this should happen automatically. It is only necessary | 3596 * a process, this should happen automatically. It is only necessary |
3629 * to use if the process needs the resources taken up by v8. | 3597 * to use if the process needs the resources taken up by v8. |
3630 */ | 3598 */ |
3631 static bool Dispose(); | 3599 static bool Dispose(); |
3632 | 3600 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3722 * Unregisters and deletes this try/catch block. | 3690 * Unregisters and deletes this try/catch block. |
3723 */ | 3691 */ |
3724 ~TryCatch(); | 3692 ~TryCatch(); |
3725 | 3693 |
3726 /** | 3694 /** |
3727 * Returns true if an exception has been caught by this try/catch block. | 3695 * Returns true if an exception has been caught by this try/catch block. |
3728 */ | 3696 */ |
3729 bool HasCaught() const; | 3697 bool HasCaught() const; |
3730 | 3698 |
3731 /** | 3699 /** |
3732 * For certain types of exceptions, it makes no sense to continue execution. | 3700 * For certain types of exceptions, it makes no sense to continue |
| 3701 * execution. |
3733 * | 3702 * |
3734 * If CanContinue returns false, the correct action is to perform any C++ | 3703 * Currently, the only type of exception that can be caught by a |
3735 * cleanup needed and then return. If CanContinue returns false and | 3704 * TryCatch handler and for which it does not make sense to continue |
3736 * HasTerminated returns true, it is possible to call | 3705 * is termination exception. Such exceptions are thrown when the |
3737 * CancelTerminateExecution in order to continue calling into the engine. | 3706 * TerminateExecution methods are called to terminate a long-running |
| 3707 * script. |
| 3708 * |
| 3709 * If CanContinue returns false, the correct action is to perform |
| 3710 * any C++ cleanup needed and then return. |
3738 */ | 3711 */ |
3739 bool CanContinue() const; | 3712 bool CanContinue() const; |
3740 | 3713 |
3741 /** | 3714 /** |
3742 * Returns true if an exception has been caught due to script execution | |
3743 * being terminated. | |
3744 * | |
3745 * There is no JavaScript representation of an execution termination | |
3746 * exception. Such exceptions are thrown when the TerminateExecution | |
3747 * methods are called to terminate a long-running script. | |
3748 * | |
3749 * If such an exception has been thrown, HasTerminated will return true, | |
3750 * indicating that it is possible to call CancelTerminateExecution in order | |
3751 * to continue calling into the engine. | |
3752 */ | |
3753 bool HasTerminated() const; | |
3754 | |
3755 /** | |
3756 * Throws the exception caught by this TryCatch in a way that avoids | 3715 * Throws the exception caught by this TryCatch in a way that avoids |
3757 * it being caught again by this same TryCatch. As with ThrowException | 3716 * it being caught again by this same TryCatch. As with ThrowException |
3758 * it is illegal to execute any JavaScript operations after calling | 3717 * it is illegal to execute any JavaScript operations after calling |
3759 * ReThrow; the caller must return immediately to where the exception | 3718 * ReThrow; the caller must return immediately to where the exception |
3760 * is caught. | 3719 * is caught. |
3761 */ | 3720 */ |
3762 Handle<Value> ReThrow(); | 3721 Handle<Value> ReThrow(); |
3763 | 3722 |
3764 /** | 3723 /** |
3765 * Returns the exception caught by this try/catch block. If no exception has | 3724 * 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... |
3820 void operator delete(void*, size_t); | 3779 void operator delete(void*, size_t); |
3821 | 3780 |
3822 v8::internal::Isolate* isolate_; | 3781 v8::internal::Isolate* isolate_; |
3823 void* next_; | 3782 void* next_; |
3824 void* exception_; | 3783 void* exception_; |
3825 void* message_; | 3784 void* message_; |
3826 bool is_verbose_ : 1; | 3785 bool is_verbose_ : 1; |
3827 bool can_continue_ : 1; | 3786 bool can_continue_ : 1; |
3828 bool capture_message_ : 1; | 3787 bool capture_message_ : 1; |
3829 bool rethrow_ : 1; | 3788 bool rethrow_ : 1; |
3830 bool has_terminated_ : 1; | |
3831 | 3789 |
3832 friend class v8::internal::Isolate; | 3790 friend class v8::internal::Isolate; |
3833 }; | 3791 }; |
3834 | 3792 |
3835 | 3793 |
3836 // --- Context --- | 3794 // --- Context --- |
3837 | 3795 |
3838 | 3796 |
3839 /** | 3797 /** |
3840 * Ignore | 3798 * Ignore |
(...skipping 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5066 | 5024 |
5067 | 5025 |
5068 } // namespace v8 | 5026 } // namespace v8 |
5069 | 5027 |
5070 | 5028 |
5071 #undef V8EXPORT | 5029 #undef V8EXPORT |
5072 #undef TYPE_CHECK | 5030 #undef TYPE_CHECK |
5073 | 5031 |
5074 | 5032 |
5075 #endif // V8_H_ | 5033 #endif // V8_H_ |
OLD | NEW |