OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 * refer to the object, the garbage collector will perform a | 381 * refer to the object, the garbage collector will perform a |
382 * callback to the given V8::WeakReferenceCallback function, passing | 382 * callback to the given V8::WeakReferenceCallback function, passing |
383 * it the object reference and the given parameters. | 383 * it the object reference and the given parameters. |
384 */ | 384 */ |
385 inline void MakeWeak(void* parameters, WeakReferenceCallback callback); | 385 inline void MakeWeak(void* parameters, WeakReferenceCallback callback); |
386 | 386 |
387 /** Clears the weak reference to this object.*/ | 387 /** Clears the weak reference to this object.*/ |
388 inline void ClearWeak(); | 388 inline void ClearWeak(); |
389 | 389 |
390 /** | 390 /** |
| 391 * Marks the reference to this object independent. Garbage collector |
| 392 * is free to ignore any object groups containing this object. |
| 393 * Weak callback for an independent handle should not |
| 394 * assume that it will be preceded by a global GC prologue callback |
| 395 * or followed by a global GC epilogue callback. |
| 396 */ |
| 397 inline void MarkIndependent(); |
| 398 |
| 399 /** |
391 *Checks if the handle holds the only reference to an object. | 400 *Checks if the handle holds the only reference to an object. |
392 */ | 401 */ |
393 inline bool IsNearDeath() const; | 402 inline bool IsNearDeath() const; |
394 | 403 |
395 /** | 404 /** |
396 * Returns true if the handle's reference is weak. | 405 * Returns true if the handle's reference is weak. |
397 */ | 406 */ |
398 inline bool IsWeak() const; | 407 inline bool IsWeak() const; |
399 | 408 |
400 /** | 409 /** |
(...skipping 2698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3099 | 3108 |
3100 private: | 3109 private: |
3101 V8(); | 3110 V8(); |
3102 | 3111 |
3103 static internal::Object** GlobalizeReference(internal::Object** handle); | 3112 static internal::Object** GlobalizeReference(internal::Object** handle); |
3104 static void DisposeGlobal(internal::Object** global_handle); | 3113 static void DisposeGlobal(internal::Object** global_handle); |
3105 static void MakeWeak(internal::Object** global_handle, | 3114 static void MakeWeak(internal::Object** global_handle, |
3106 void* data, | 3115 void* data, |
3107 WeakReferenceCallback); | 3116 WeakReferenceCallback); |
3108 static void ClearWeak(internal::Object** global_handle); | 3117 static void ClearWeak(internal::Object** global_handle); |
| 3118 static void MarkIndependent(internal::Object** global_handle); |
3109 static bool IsGlobalNearDeath(internal::Object** global_handle); | 3119 static bool IsGlobalNearDeath(internal::Object** global_handle); |
3110 static bool IsGlobalWeak(internal::Object** global_handle); | 3120 static bool IsGlobalWeak(internal::Object** global_handle); |
3111 static void SetWrapperClassId(internal::Object** global_handle, | 3121 static void SetWrapperClassId(internal::Object** global_handle, |
3112 uint16_t class_id); | 3122 uint16_t class_id); |
3113 | 3123 |
3114 template <class T> friend class Handle; | 3124 template <class T> friend class Handle; |
3115 template <class T> friend class Local; | 3125 template <class T> friend class Local; |
3116 template <class T> friend class Persistent; | 3126 template <class T> friend class Persistent; |
3117 friend class Context; | 3127 friend class Context; |
3118 }; | 3128 }; |
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3802 parameters, | 3812 parameters, |
3803 callback); | 3813 callback); |
3804 } | 3814 } |
3805 | 3815 |
3806 template <class T> | 3816 template <class T> |
3807 void Persistent<T>::ClearWeak() { | 3817 void Persistent<T>::ClearWeak() { |
3808 V8::ClearWeak(reinterpret_cast<internal::Object**>(**this)); | 3818 V8::ClearWeak(reinterpret_cast<internal::Object**>(**this)); |
3809 } | 3819 } |
3810 | 3820 |
3811 template <class T> | 3821 template <class T> |
| 3822 void Persistent<T>::MarkIndependent() { |
| 3823 V8::MarkIndependent(reinterpret_cast<internal::Object**>(**this)); |
| 3824 } |
| 3825 |
| 3826 template <class T> |
3812 void Persistent<T>::SetWrapperClassId(uint16_t class_id) { | 3827 void Persistent<T>::SetWrapperClassId(uint16_t class_id) { |
3813 V8::SetWrapperClassId(reinterpret_cast<internal::Object**>(**this), class_id); | 3828 V8::SetWrapperClassId(reinterpret_cast<internal::Object**>(**this), class_id); |
3814 } | 3829 } |
3815 | 3830 |
3816 Arguments::Arguments(internal::Object** implicit_args, | 3831 Arguments::Arguments(internal::Object** implicit_args, |
3817 internal::Object** values, int length, | 3832 internal::Object** values, int length, |
3818 bool is_construct_call) | 3833 bool is_construct_call) |
3819 : implicit_args_(implicit_args), | 3834 : implicit_args_(implicit_args), |
3820 values_(values), | 3835 values_(values), |
3821 length_(length), | 3836 length_(length), |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4089 | 4104 |
4090 | 4105 |
4091 } // namespace v8 | 4106 } // namespace v8 |
4092 | 4107 |
4093 | 4108 |
4094 #undef V8EXPORT | 4109 #undef V8EXPORT |
4095 #undef TYPE_CHECK | 4110 #undef TYPE_CHECK |
4096 | 4111 |
4097 | 4112 |
4098 #endif // V8_H_ | 4113 #endif // V8_H_ |
OLD | NEW |