| 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 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 #endif | 627 #endif |
| 628 | 628 |
| 629 V8_INLINE(void Dispose()); | 629 V8_INLINE(void Dispose()); |
| 630 | 630 |
| 631 /** | 631 /** |
| 632 * Releases the storage cell referenced by this persistent handle. | 632 * Releases the storage cell referenced by this persistent handle. |
| 633 * Does not remove the reference to the cell from any handles. | 633 * Does not remove the reference to the cell from any handles. |
| 634 * This handle's reference, and any other references to the storage | 634 * This handle's reference, and any other references to the storage |
| 635 * cell remain and IsEmpty will still return false. | 635 * cell remain and IsEmpty will still return false. |
| 636 */ | 636 */ |
| 637 // TODO(dcarney): deprecate | 637 V8_DEPRECATED(V8_INLINE(void Dispose(Isolate* isolate))) { Dispose(); } |
| 638 V8_INLINE(void Dispose(Isolate* isolate)) { Dispose(); } | |
| 639 | 638 |
| 640 /** | 639 /** |
| 641 * Make the reference to this object weak. When only weak handles | 640 * Make the reference to this object weak. When only weak handles |
| 642 * refer to the object, the garbage collector will perform a | 641 * refer to the object, the garbage collector will perform a |
| 643 * callback to the given V8::NearDeathCallback function, passing | 642 * callback to the given V8::NearDeathCallback function, passing |
| 644 * it the object reference and the given parameters. | 643 * it the object reference and the given parameters. |
| 645 */ | 644 */ |
| 646 template<typename S, typename P> | 645 template<typename S, typename P> |
| 647 V8_INLINE(void MakeWeak( | 646 V8_INLINE(void MakeWeak( |
| 648 P* parameters, | 647 P* parameters, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 660 typename WeakReferenceCallbacks<S, P>::Revivable callback)); | 659 typename WeakReferenceCallbacks<S, P>::Revivable callback)); |
| 661 | 660 |
| 662 template<typename P> | 661 template<typename P> |
| 663 V8_DEPRECATED(void MakeWeak( | 662 V8_DEPRECATED(void MakeWeak( |
| 664 Isolate* isolate, | 663 Isolate* isolate, |
| 665 P* parameters, | 664 P* parameters, |
| 666 typename WeakReferenceCallbacks<T, P>::Revivable callback)); | 665 typename WeakReferenceCallbacks<T, P>::Revivable callback)); |
| 667 | 666 |
| 668 V8_INLINE(void ClearWeak()); | 667 V8_INLINE(void ClearWeak()); |
| 669 | 668 |
| 670 // TODO(dcarney): deprecate | 669 V8_DEPRECATED(V8_INLINE(void ClearWeak(Isolate* isolate))) { ClearWeak(); } |
| 671 V8_INLINE(void ClearWeak(Isolate* isolate)) { ClearWeak(); } | |
| 672 | 670 |
| 673 /** | 671 /** |
| 674 * Marks the reference to this object independent. Garbage collector is free | 672 * Marks the reference to this object independent. Garbage collector is free |
| 675 * to ignore any object groups containing this object. Weak callback for an | 673 * to ignore any object groups containing this object. Weak callback for an |
| 676 * independent handle should not assume that it will be preceded by a global | 674 * independent handle should not assume that it will be preceded by a global |
| 677 * GC prologue callback or followed by a global GC epilogue callback. | 675 * GC prologue callback or followed by a global GC epilogue callback. |
| 678 */ | 676 */ |
| 679 V8_INLINE(void MarkIndependent()); | 677 V8_INLINE(void MarkIndependent()); |
| 680 | 678 |
| 681 // TODO(dcarney): deprecate | 679 V8_DEPRECATED(V8_INLINE(void MarkIndependent(Isolate* isolate))) { |
| 682 V8_INLINE(void MarkIndependent(Isolate* isolate)) { MarkIndependent(); } | 680 MarkIndependent(); |
| 681 } |
| 683 | 682 |
| 684 /** | 683 /** |
| 685 * Marks the reference to this object partially dependent. Partially dependent | 684 * Marks the reference to this object partially dependent. Partially dependent |
| 686 * handles only depend on other partially dependent handles and these | 685 * handles only depend on other partially dependent handles and these |
| 687 * dependencies are provided through object groups. It provides a way to build | 686 * dependencies are provided through object groups. It provides a way to build |
| 688 * smaller object groups for young objects that represent only a subset of all | 687 * smaller object groups for young objects that represent only a subset of all |
| 689 * external dependencies. This mark is automatically cleared after each | 688 * external dependencies. This mark is automatically cleared after each |
| 690 * garbage collection. | 689 * garbage collection. |
| 691 */ | 690 */ |
| 692 V8_INLINE(void MarkPartiallyDependent()); | 691 V8_INLINE(void MarkPartiallyDependent()); |
| 693 | 692 |
| 694 // TODO(dcarney): deprecate | 693 V8_DEPRECATED(V8_INLINE(void MarkPartiallyDependent(Isolate* isolate))) { |
| 695 V8_INLINE(void MarkPartiallyDependent(Isolate* isolate)) { | |
| 696 MarkPartiallyDependent(); | 694 MarkPartiallyDependent(); |
| 697 } | 695 } |
| 698 | 696 |
| 699 V8_INLINE(bool IsIndependent() const); | 697 V8_INLINE(bool IsIndependent() const); |
| 700 | 698 |
| 701 // TODO(dcarney): deprecate | 699 V8_DEPRECATED(V8_INLINE(bool IsIndependent(Isolate* isolate)) const) { |
| 702 V8_INLINE(bool IsIndependent(Isolate* isolate) const) { | |
| 703 return IsIndependent(); | 700 return IsIndependent(); |
| 704 } | 701 } |
| 705 | 702 |
| 706 /** Checks if the handle holds the only reference to an object. */ | 703 /** Checks if the handle holds the only reference to an object. */ |
| 707 V8_INLINE(bool IsNearDeath() const); | 704 V8_INLINE(bool IsNearDeath() const); |
| 708 | 705 |
| 709 // TODO(dcarney): deprecate | 706 V8_DEPRECATED(V8_INLINE(bool IsNearDeath(Isolate* isolate)) const) { |
| 710 V8_INLINE(bool IsNearDeath(Isolate* isolate) const) { return IsNearDeath(); } | 707 return IsNearDeath(); |
| 708 } |
| 711 | 709 |
| 712 /** Returns true if the handle's reference is weak. */ | 710 /** Returns true if the handle's reference is weak. */ |
| 713 V8_INLINE(bool IsWeak() const); | 711 V8_INLINE(bool IsWeak() const); |
| 714 | 712 |
| 715 // TODO(dcarney): deprecate | 713 V8_DEPRECATED(V8_INLINE(bool IsWeak(Isolate* isolate)) const) { |
| 716 V8_INLINE(bool IsWeak(Isolate* isolate) const) { return IsWeak(); } | 714 return IsWeak(); |
| 715 } |
| 717 | 716 |
| 718 /** | 717 /** |
| 719 * Assigns a wrapper class ID to the handle. See RetainedObjectInfo interface | 718 * Assigns a wrapper class ID to the handle. See RetainedObjectInfo interface |
| 720 * description in v8-profiler.h for details. | 719 * description in v8-profiler.h for details. |
| 721 */ | 720 */ |
| 722 V8_INLINE(void SetWrapperClassId(uint16_t class_id)); | 721 V8_INLINE(void SetWrapperClassId(uint16_t class_id)); |
| 723 | 722 |
| 724 // TODO(dcarney): deprecate | 723 V8_DEPRECATED( |
| 725 V8_INLINE(void SetWrapperClassId(Isolate* isolate, uint16_t class_id)) { | 724 V8_INLINE(void SetWrapperClassId(Isolate * isolate, uint16_t class_id))) { |
| 726 SetWrapperClassId(class_id); | 725 SetWrapperClassId(class_id); |
| 727 } | 726 } |
| 728 | 727 |
| 729 /** | 728 /** |
| 730 * Returns the class ID previously assigned to this handle or 0 if no class ID | 729 * Returns the class ID previously assigned to this handle or 0 if no class ID |
| 731 * was previously assigned. | 730 * was previously assigned. |
| 732 */ | 731 */ |
| 733 V8_INLINE(uint16_t WrapperClassId() const); | 732 V8_INLINE(uint16_t WrapperClassId() const); |
| 734 | 733 |
| 735 // TODO(dcarney): deprecate | 734 V8_DEPRECATED(V8_INLINE(uint16_t WrapperClassId(Isolate* isolate)) const) { |
| 736 V8_INLINE(uint16_t WrapperClassId(Isolate* isolate) const) { | |
| 737 return WrapperClassId(); | 735 return WrapperClassId(); |
| 738 } | 736 } |
| 739 | 737 |
| 740 /** | 738 /** |
| 741 * Disposes the current contents of the handle and replaces it. | 739 * Disposes the current contents of the handle and replaces it. |
| 742 */ | 740 */ |
| 743 V8_INLINE(void Reset(Isolate* isolate, const Handle<T>& other)); | 741 V8_INLINE(void Reset(Isolate* isolate, const Handle<T>& other)); |
| 744 | 742 |
| 745 #ifndef V8_USE_UNSAFE_HANDLES | 743 #ifndef V8_USE_UNSAFE_HANDLES |
| 746 V8_INLINE(void Reset(Isolate* isolate, const Persistent<T>& other)); | 744 V8_INLINE(void Reset(Isolate* isolate, const Persistent<T>& other)); |
| (...skipping 4972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5719 typedef internal::Internals I; | 5717 typedef internal::Internals I; |
| 5720 if (this->IsEmpty()) return; | 5718 if (this->IsEmpty()) return; |
| 5721 I::UpdateNodeFlag(reinterpret_cast<internal::Object**>(this->val_), | 5719 I::UpdateNodeFlag(reinterpret_cast<internal::Object**>(this->val_), |
| 5722 true, | 5720 true, |
| 5723 I::kNodeIsPartiallyDependentShift); | 5721 I::kNodeIsPartiallyDependentShift); |
| 5724 } | 5722 } |
| 5725 | 5723 |
| 5726 | 5724 |
| 5727 template <class T> | 5725 template <class T> |
| 5728 void Persistent<T>::Reset(Isolate* isolate, const Handle<T>& other) { | 5726 void Persistent<T>::Reset(Isolate* isolate, const Handle<T>& other) { |
| 5729 Dispose(isolate); | 5727 Dispose(); |
| 5730 #ifdef V8_USE_UNSAFE_HANDLES | 5728 #ifdef V8_USE_UNSAFE_HANDLES |
| 5731 *this = *New(isolate, other); | 5729 *this = *New(isolate, other); |
| 5732 #else | 5730 #else |
| 5733 if (other.IsEmpty()) { | 5731 if (other.IsEmpty()) { |
| 5734 this->val_ = NULL; | 5732 this->val_ = NULL; |
| 5735 return; | 5733 return; |
| 5736 } | 5734 } |
| 5737 internal::Object** p = reinterpret_cast<internal::Object**>(other.val_); | 5735 internal::Object** p = reinterpret_cast<internal::Object**>(other.val_); |
| 5738 this->val_ = reinterpret_cast<T*>( | 5736 this->val_ = reinterpret_cast<T*>( |
| 5739 V8::GlobalizeReference(reinterpret_cast<internal::Isolate*>(isolate), p)); | 5737 V8::GlobalizeReference(reinterpret_cast<internal::Isolate*>(isolate), p)); |
| 5740 #endif | 5738 #endif |
| 5741 } | 5739 } |
| 5742 | 5740 |
| 5743 | 5741 |
| 5744 #ifndef V8_USE_UNSAFE_HANDLES | 5742 #ifndef V8_USE_UNSAFE_HANDLES |
| 5745 template <class T> | 5743 template <class T> |
| 5746 void Persistent<T>::Reset(Isolate* isolate, const Persistent<T>& other) { | 5744 void Persistent<T>::Reset(Isolate* isolate, const Persistent<T>& other) { |
| 5747 Dispose(isolate); | 5745 Dispose(); |
| 5748 if (other.IsEmpty()) { | 5746 if (other.IsEmpty()) { |
| 5749 this->val_ = NULL; | 5747 this->val_ = NULL; |
| 5750 return; | 5748 return; |
| 5751 } | 5749 } |
| 5752 internal::Object** p = reinterpret_cast<internal::Object**>(other.val_); | 5750 internal::Object** p = reinterpret_cast<internal::Object**>(other.val_); |
| 5753 this->val_ = reinterpret_cast<T*>( | 5751 this->val_ = reinterpret_cast<T*>( |
| 5754 V8::GlobalizeReference(reinterpret_cast<internal::Isolate*>(isolate), p)); | 5752 V8::GlobalizeReference(reinterpret_cast<internal::Isolate*>(isolate), p)); |
| 5755 } | 5753 } |
| 5756 #endif | 5754 #endif |
| 5757 | 5755 |
| (...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6489 */ | 6487 */ |
| 6490 | 6488 |
| 6491 | 6489 |
| 6492 } // namespace v8 | 6490 } // namespace v8 |
| 6493 | 6491 |
| 6494 | 6492 |
| 6495 #undef TYPE_CHECK | 6493 #undef TYPE_CHECK |
| 6496 | 6494 |
| 6497 | 6495 |
| 6498 #endif // V8_H_ | 6496 #endif // V8_H_ |
| OLD | NEW |