Index: include/v8.h |
diff --git a/include/v8.h b/include/v8.h |
index 29f2508fd638c4d2187e748a1265a31b03303045..d624c926eb87246ee89a787d083bb757123fb0db 100644 |
--- a/include/v8.h |
+++ b/include/v8.h |
@@ -603,6 +603,13 @@ template <class T> class PersistentBase { |
*/ |
V8_INLINE void MarkPartiallyDependent(); |
+ /** |
+ * Marks the reference to this object as active. The scavenge garbage |
+ * collection should not reclaim the objects marked as active. |
+ * This bit is cleared after the each garbage collection pass. |
+ */ |
+ V8_INLINE void MarkInactive(); |
+ |
V8_INLINE bool IsIndependent() const; |
/** Checks if the handle holds the only reference to an object. */ |
@@ -5927,6 +5934,14 @@ class V8_EXPORT Isolate { |
*/ |
void VisitHandlesForPartialDependence(PersistentHandleVisitor* visitor); |
+ /** |
+ * Iterates through all the persistent handles in the current isolate's heap |
+ * that have class_ids and are weak to be marked as inactive if there is no |
+ * pending activity for the handle. |
+ */ |
+ void VisitWeakHandles(PersistentHandleVisitor* visitor); |
+ |
+ |
private: |
template <class K, class V, class Traits> |
friend class PersistentValueMapBase; |
@@ -7009,6 +7024,7 @@ class Internals { |
static const int kNodeStateIsNearDeathValue = 4; |
static const int kNodeIsIndependentShift = 3; |
static const int kNodeIsPartiallyDependentShift = 4; |
+ static const int kNodeIsInactiveShift = 4; |
static const int kJSObjectType = 0xb7; |
static const int kFirstNonstringType = 0x80; |
@@ -7336,6 +7352,15 @@ void PersistentBase<T>::MarkPartiallyDependent() { |
template <class T> |
+void PersistentBase<T>::MarkInactive() { |
+ typedef internal::Internals I; |
+ if (this->IsEmpty()) return; |
+ I::UpdateNodeFlag(reinterpret_cast<internal::Object**>(this->val_), true, |
+ I::kNodeIsInactiveShift); |
+} |
+ |
+ |
+template <class T> |
void PersistentBase<T>::SetWrapperClassId(uint16_t class_id) { |
typedef internal::Internals I; |
if (this->IsEmpty()) return; |