| 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 /** \mainpage V8 API Reference Guide | 5 /** \mainpage V8 API Reference Guide |
| 6 * | 6 * |
| 7 * V8 is Google's open source JavaScript engine. | 7 * V8 is Google's open source JavaScript engine. |
| 8 * | 8 * |
| 9 * This set of documents provides reference material generated from the | 9 * This set of documents provides reference material generated from the |
| 10 * V8 header file, include/v8.h. | 10 * V8 header file, include/v8.h. |
| (...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 * Counts the number of allocated handles. | 875 * Counts the number of allocated handles. |
| 876 */ | 876 */ |
| 877 static int NumberOfHandles(Isolate* isolate); | 877 static int NumberOfHandles(Isolate* isolate); |
| 878 | 878 |
| 879 V8_INLINE Isolate* GetIsolate() const { | 879 V8_INLINE Isolate* GetIsolate() const { |
| 880 return reinterpret_cast<Isolate*>(isolate_); | 880 return reinterpret_cast<Isolate*>(isolate_); |
| 881 } | 881 } |
| 882 | 882 |
| 883 HandleScope(const HandleScope&) = delete; | 883 HandleScope(const HandleScope&) = delete; |
| 884 void operator=(const HandleScope&) = delete; | 884 void operator=(const HandleScope&) = delete; |
| 885 void* operator new(size_t size) = delete; |
| 886 void operator delete(void*, size_t) = delete; |
| 885 | 887 |
| 886 protected: | 888 protected: |
| 887 V8_INLINE HandleScope() {} | 889 V8_INLINE HandleScope() {} |
| 888 | 890 |
| 889 void Initialize(Isolate* isolate); | 891 void Initialize(Isolate* isolate); |
| 890 | 892 |
| 891 static internal::Object** CreateHandle(internal::Isolate* isolate, | 893 static internal::Object** CreateHandle(internal::Isolate* isolate, |
| 892 internal::Object* value); | 894 internal::Object* value); |
| 893 | 895 |
| 894 private: | 896 private: |
| 895 // Uses heap_object to obtain the current Isolate. | 897 // Uses heap_object to obtain the current Isolate. |
| 896 static internal::Object** CreateHandle(internal::HeapObject* heap_object, | 898 static internal::Object** CreateHandle(internal::HeapObject* heap_object, |
| 897 internal::Object* value); | 899 internal::Object* value); |
| 898 | 900 |
| 899 // Make it hard to create heap-allocated or illegal handle scopes by | |
| 900 // disallowing certain operations. | |
| 901 void* operator new(size_t size); | |
| 902 void operator delete(void*, size_t); | |
| 903 | |
| 904 internal::Isolate* isolate_; | 901 internal::Isolate* isolate_; |
| 905 internal::Object** prev_next_; | 902 internal::Object** prev_next_; |
| 906 internal::Object** prev_limit_; | 903 internal::Object** prev_limit_; |
| 907 | 904 |
| 908 // Local::New uses CreateHandle with an Isolate* parameter. | 905 // Local::New uses CreateHandle with an Isolate* parameter. |
| 909 template<class F> friend class Local; | 906 template<class F> friend class Local; |
| 910 | 907 |
| 911 // Object::GetInternalField and Context::GetEmbedderData use CreateHandle with | 908 // Object::GetInternalField and Context::GetEmbedderData use CreateHandle with |
| 912 // a HeapObject* in their shortcuts. | 909 // a HeapObject* in their shortcuts. |
| 913 friend class Object; | 910 friend class Object; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 930 */ | 927 */ |
| 931 template <class T> | 928 template <class T> |
| 932 V8_INLINE Local<T> Escape(Local<T> value) { | 929 V8_INLINE Local<T> Escape(Local<T> value) { |
| 933 internal::Object** slot = | 930 internal::Object** slot = |
| 934 Escape(reinterpret_cast<internal::Object**>(*value)); | 931 Escape(reinterpret_cast<internal::Object**>(*value)); |
| 935 return Local<T>(reinterpret_cast<T*>(slot)); | 932 return Local<T>(reinterpret_cast<T*>(slot)); |
| 936 } | 933 } |
| 937 | 934 |
| 938 EscapableHandleScope(const EscapableHandleScope&) = delete; | 935 EscapableHandleScope(const EscapableHandleScope&) = delete; |
| 939 void operator=(const EscapableHandleScope&) = delete; | 936 void operator=(const EscapableHandleScope&) = delete; |
| 937 void* operator new(size_t size) = delete; |
| 938 void operator delete(void*, size_t) = delete; |
| 940 | 939 |
| 941 private: | 940 private: |
| 942 internal::Object** Escape(internal::Object** escape_value); | 941 internal::Object** Escape(internal::Object** escape_value); |
| 943 | |
| 944 // Make it hard to create heap-allocated or illegal handle scopes by | |
| 945 // disallowing certain operations. | |
| 946 void* operator new(size_t size); | |
| 947 void operator delete(void*, size_t); | |
| 948 | |
| 949 internal::Object** escape_slot_; | 942 internal::Object** escape_slot_; |
| 950 }; | 943 }; |
| 951 | 944 |
| 952 class V8_EXPORT SealHandleScope { | 945 class V8_EXPORT SealHandleScope { |
| 953 public: | 946 public: |
| 954 SealHandleScope(Isolate* isolate); | 947 SealHandleScope(Isolate* isolate); |
| 955 ~SealHandleScope(); | 948 ~SealHandleScope(); |
| 956 | 949 |
| 957 SealHandleScope(const SealHandleScope&) = delete; | 950 SealHandleScope(const SealHandleScope&) = delete; |
| 958 void operator=(const SealHandleScope&) = delete; | 951 void operator=(const SealHandleScope&) = delete; |
| 952 void* operator new(size_t size) = delete; |
| 953 void operator delete(void*, size_t) = delete; |
| 959 | 954 |
| 960 private: | 955 private: |
| 961 // Make it hard to create heap-allocated or illegal handle scopes by | |
| 962 // disallowing certain operations. | |
| 963 void* operator new(size_t size); | |
| 964 void operator delete(void*, size_t); | |
| 965 | |
| 966 internal::Isolate* const isolate_; | 956 internal::Isolate* const isolate_; |
| 967 internal::Object** prev_limit_; | 957 internal::Object** prev_limit_; |
| 968 int prev_sealed_level_; | 958 int prev_sealed_level_; |
| 969 }; | 959 }; |
| 970 | 960 |
| 971 | 961 |
| 972 // --- Special objects --- | 962 // --- Special objects --- |
| 973 | 963 |
| 974 | 964 |
| 975 /** | 965 /** |
| (...skipping 5487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6463 * pending activity for the handle. | 6453 * pending activity for the handle. |
| 6464 */ | 6454 */ |
| 6465 void VisitWeakHandles(PersistentHandleVisitor* visitor); | 6455 void VisitWeakHandles(PersistentHandleVisitor* visitor); |
| 6466 | 6456 |
| 6467 /** | 6457 /** |
| 6468 * Check if this isolate is in use. | 6458 * Check if this isolate is in use. |
| 6469 * True if at least one thread Enter'ed this isolate. | 6459 * True if at least one thread Enter'ed this isolate. |
| 6470 */ | 6460 */ |
| 6471 bool IsInUse(); | 6461 bool IsInUse(); |
| 6472 | 6462 |
| 6463 Isolate() = delete; |
| 6464 ~Isolate() = delete; |
| 6473 Isolate(const Isolate&) = delete; | 6465 Isolate(const Isolate&) = delete; |
| 6474 Isolate& operator=(const Isolate&) = delete; | 6466 Isolate& operator=(const Isolate&) = delete; |
| 6467 void* operator new(size_t size) = delete; |
| 6468 void operator delete(void*, size_t) = delete; |
| 6475 | 6469 |
| 6476 private: | 6470 private: |
| 6477 template <class K, class V, class Traits> | 6471 template <class K, class V, class Traits> |
| 6478 friend class PersistentValueMapBase; | 6472 friend class PersistentValueMapBase; |
| 6479 | 6473 |
| 6480 Isolate(); | |
| 6481 ~Isolate(); | |
| 6482 void* operator new(size_t size); | |
| 6483 void operator delete(void*, size_t); | |
| 6484 | |
| 6485 void SetObjectGroupId(internal::Object** object, UniqueId id); | 6474 void SetObjectGroupId(internal::Object** object, UniqueId id); |
| 6486 void SetReferenceFromGroup(UniqueId id, internal::Object** object); | 6475 void SetReferenceFromGroup(UniqueId id, internal::Object** object); |
| 6487 void SetReference(internal::Object** parent, internal::Object** child); | 6476 void SetReference(internal::Object** parent, internal::Object** child); |
| 6488 void ReportExternalAllocationLimitReached(); | 6477 void ReportExternalAllocationLimitReached(); |
| 6489 }; | 6478 }; |
| 6490 | 6479 |
| 6491 class V8_EXPORT StartupData { | 6480 class V8_EXPORT StartupData { |
| 6492 public: | 6481 public: |
| 6493 const char* data; | 6482 const char* data; |
| 6494 int raw_size; | 6483 int raw_size; |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7140 * UseAfterReturn is enabled, then the address returned will be the address | 7129 * UseAfterReturn is enabled, then the address returned will be the address |
| 7141 * of the C++ try catch handler itself. | 7130 * of the C++ try catch handler itself. |
| 7142 */ | 7131 */ |
| 7143 static void* JSStackComparableAddress(v8::TryCatch* handler) { | 7132 static void* JSStackComparableAddress(v8::TryCatch* handler) { |
| 7144 if (handler == NULL) return NULL; | 7133 if (handler == NULL) return NULL; |
| 7145 return handler->js_stack_comparable_address_; | 7134 return handler->js_stack_comparable_address_; |
| 7146 } | 7135 } |
| 7147 | 7136 |
| 7148 TryCatch(const TryCatch&) = delete; | 7137 TryCatch(const TryCatch&) = delete; |
| 7149 void operator=(const TryCatch&) = delete; | 7138 void operator=(const TryCatch&) = delete; |
| 7139 void* operator new(size_t size) = delete; |
| 7140 void operator delete(void*, size_t) = delete; |
| 7150 | 7141 |
| 7151 private: | 7142 private: |
| 7152 void ResetInternal(); | 7143 void ResetInternal(); |
| 7153 | 7144 |
| 7154 // Make it hard to create heap-allocated TryCatch blocks. | |
| 7155 void* operator new(size_t size); | |
| 7156 void operator delete(void*, size_t); | |
| 7157 | |
| 7158 v8::internal::Isolate* isolate_; | 7145 v8::internal::Isolate* isolate_; |
| 7159 v8::TryCatch* next_; | 7146 v8::TryCatch* next_; |
| 7160 void* exception_; | 7147 void* exception_; |
| 7161 void* message_obj_; | 7148 void* message_obj_; |
| 7162 void* js_stack_comparable_address_; | 7149 void* js_stack_comparable_address_; |
| 7163 bool is_verbose_ : 1; | 7150 bool is_verbose_ : 1; |
| 7164 bool can_continue_ : 1; | 7151 bool can_continue_ : 1; |
| 7165 bool capture_message_ : 1; | 7152 bool capture_message_ : 1; |
| 7166 bool rethrow_ : 1; | 7153 bool rethrow_ : 1; |
| 7167 bool has_terminated_ : 1; | 7154 bool has_terminated_ : 1; |
| (...skipping 1850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9018 */ | 9005 */ |
| 9019 | 9006 |
| 9020 | 9007 |
| 9021 } // namespace v8 | 9008 } // namespace v8 |
| 9022 | 9009 |
| 9023 | 9010 |
| 9024 #undef TYPE_CHECK | 9011 #undef TYPE_CHECK |
| 9025 | 9012 |
| 9026 | 9013 |
| 9027 #endif // INCLUDE_V8_H_ | 9014 #endif // INCLUDE_V8_H_ |
| OLD | NEW |