diff -up chromium-78.0.3904.70/v8/include/v8.h.implement-tracedreference chromium-78.0.3904.70/v8/include/v8.h --- chromium-78.0.3904.70/v8/include/v8.h.implement-tracedreference 2019-10-24 08:58:26.185640117 -0400 +++ chromium-78.0.3904.70/v8/include/v8.h 2019-10-24 09:18:33.719546481 -0400 @@ -96,6 +96,10 @@ template class Global; template class TracedGlobal; +template +class TracedReference; +template +class TracedReferenceBase; template class PersistentValueMap; template class PersistentValueMapBase; @@ -281,7 +285,8 @@ class Local { V8_INLINE static Local New(Isolate* isolate, Local that); V8_INLINE static Local New(Isolate* isolate, const PersistentBase& that); - V8_INLINE static Local New(Isolate* isolate, const TracedGlobal& that); + V8_INLINE static Local New(Isolate* isolate, + const TracedReferenceBase& that); private: friend class Utils; @@ -311,7 +316,13 @@ class Local { template friend class ReturnValue; template + friend class Traced; + template friend class TracedGlobal; + template + friend class TracedReferenceBase; + template + friend class TracedReference; explicit V8_INLINE Local(T* that) : val_(that) {} V8_INLINE static Local New(Isolate* isolate, T* that); @@ -792,22 +803,10 @@ template using UniquePersistent = Global; /** - * Trait specifying behavior of |TracedGlobal|. + * Deprecated. Use |TracedReference| instead. */ template -struct TracedGlobalTrait { - /** - * Specifies whether |TracedGlobal| should clear its handle on destruction. - * - * V8 will *not* clear the embedder-side memory of the handle. The embedder is - * expected to report all |TracedGlobal| handles through - * |EmbedderHeapTracer| upon garabge collection. - * - * See |EmbedderHeapTracer::IsRootForNonTracingGC| for handling with - * non-tracing GCs in V8. - */ - static constexpr bool kRequiresExplicitDestruction = true; -}; +struct TracedGlobalTrait {}; /** * A traced handle with copy and move semantics. The handle is to be used @@ -820,15 +819,131 @@ struct TracedGlobalTrait { * |v8::EmbedderHeapTracer::IsRootForNonTracingGC()| whether the handle should * be treated as root or not. * - * For destruction semantics see |TracedGlobalTrait|. + * Note that the base class cannot be instantiated itself. Choose from + * - TracedGlobal + * - TracedReference */ template -class TracedGlobal { +class TracedReferenceBase { public: /** + * Returns true if this TracedReferenceBase is empty, i.e., has not been + * assigned an object. + */ + bool IsEmpty() const { return val_ == nullptr; } + + /** + * If non-empty, destroy the underlying storage cell. |IsEmpty| will return + * true after this call. + */ + V8_INLINE void Reset(); + + /** + * Construct a Local from this handle. + */ + Local Get(Isolate* isolate) const { return Local::New(isolate, *this); } + + template + V8_INLINE bool operator==(const TracedReferenceBase& that) const { + internal::Address* a = reinterpret_cast(val_); + internal::Address* b = reinterpret_cast(that.val_); + if (a == nullptr) return b == nullptr; + if (b == nullptr) return false; + return *a == *b; + } + + template + V8_INLINE bool operator==(const Local& that) const { + internal::Address* a = reinterpret_cast(val_); + internal::Address* b = reinterpret_cast(that.val_); + if (a == nullptr) return b == nullptr; + if (b == nullptr) return false; + return *a == *b; + } + + template + V8_INLINE bool operator!=(const TracedReferenceBase& that) const { + return !operator==(that); + } + + template + V8_INLINE bool operator!=(const Local& that) const { + return !operator==(that); + } + + /** + * Assigns a wrapper class ID to the handle. + */ + V8_INLINE void SetWrapperClassId(uint16_t class_id); + + /** + * Returns the class ID previously assigned to this handle or 0 if no class ID + * was previously assigned. + */ + V8_INLINE uint16_t WrapperClassId() const; + + /** + * Adds a finalization callback to the handle. The type of this callback is + * similar to WeakCallbackType::kInternalFields, i.e., it will pass the + * parameter and the first two internal fields of the object. + * + * The callback is then supposed to reset the handle in the callback. No + * further V8 API may be called in this callback. In case additional work + * involving V8 needs to be done, a second callback can be scheduled using + * WeakCallbackInfo::SetSecondPassCallback. + */ + V8_INLINE void SetFinalizationCallback( + void* parameter, WeakCallbackInfo::Callback callback); + + template + V8_INLINE TracedReferenceBase& As() const { + return reinterpret_cast&>( + const_cast&>(*this)); + } + + private: + enum DestructionMode { kWithDestructor, kWithoutDestructor }; + + /** + * An empty TracedReferenceBase without storage cell. + */ + TracedReferenceBase() = default; + + V8_INLINE static T* New(Isolate* isolate, T* that, void* slot, + DestructionMode destruction_mode); + + T* val_ = nullptr; + + friend class EmbedderHeapTracer; + template + friend class Local; + friend class Object; + template + friend class TracedGlobal; + template + friend class TracedReference; + template + friend class ReturnValue; +}; + +/** + * A traced handle with destructor that clears the handle. For more details see + * TracedReferenceBase. + */ +template +class TracedGlobal : public TracedReferenceBase { + public: + using TracedReferenceBase::Reset; + + /** + * Destructor resetting the handle. + */ + ~TracedGlobal() { this->Reset(); } + + /** * An empty TracedGlobal without storage cell. */ - TracedGlobal() = default; + TracedGlobal() : TracedReferenceBase() {} /** * Construct a TracedGlobal from a Local. @@ -837,8 +952,9 @@ class TracedGlobal { * pointing to the same object. */ template - TracedGlobal(Isolate* isolate, Local that) - : val_(New(isolate, *that, &val_)) { + TracedGlobal(Isolate* isolate, Local that) : TracedReferenceBase() { + this->val_ = this->New(isolate, that.val_, &this->val_, + TracedReferenceBase::kWithDestructor); TYPE_CHECK(T, S); } @@ -905,121 +1021,126 @@ class TracedGlobal { V8_INLINE TracedGlobal& operator=(const TracedGlobal& rhs); /** - * Returns true if this TracedGlobal is empty, i.e., has not been assigned an - * object. - */ - bool IsEmpty() const { return val_ == nullptr; } - - /** - * If non-empty, destroy the underlying storage cell. |IsEmpty| will return - * true after this call. - */ - V8_INLINE void Reset(); - - /** * If non-empty, destroy the underlying storage cell and create a new one with * the contents of other if other is non empty */ template V8_INLINE void Reset(Isolate* isolate, const Local& other); - /** - * Construct a Local from this handle. - */ - Local Get(Isolate* isolate) const { return Local::New(isolate, *this); } - template V8_INLINE TracedGlobal& As() const { return reinterpret_cast&>( const_cast&>(*this)); } +}; - template - V8_INLINE bool operator==(const TracedGlobal& that) const { - internal::Address* a = reinterpret_cast(**this); - internal::Address* b = reinterpret_cast(*that); - if (a == nullptr) return b == nullptr; - if (b == nullptr) return false; - return *a == *b; - } +/** + * A traced handle without destructor that clears the handle. The embedder needs + * to ensure that the handle is not accessed once the V8 object has been + * reclaimed. This can happen when the handle is not passed through the + * EmbedderHeapTracer. For more details see TracedReferenceBase. + */ +template +class TracedReference : public TracedReferenceBase { + public: + using TracedReferenceBase::Reset; + + /** + * An empty TracedReference without storage cell. + */ + TracedReference() : TracedReferenceBase() {} + /** + * Construct a TracedReference from a Local. + * + * When the Local is non-empty, a new storage cell is created + * pointing to the same object. + */ template - V8_INLINE bool operator==(const Local& that) const { - internal::Address* a = reinterpret_cast(**this); - internal::Address* b = reinterpret_cast(*that); - if (a == nullptr) return b == nullptr; - if (b == nullptr) return false; - return *a == *b; + TracedReference(Isolate* isolate, Local that) : TracedReferenceBase() { + this->val_ = this->New(isolate, that.val_, &this->val_, + TracedReferenceBase::kWithoutDestructor); + TYPE_CHECK(T, S); } - template - V8_INLINE bool operator!=(const TracedGlobal& that) const { - return !operator==(that); + /** + * Move constructor initializing TracedReference from an + * existing one. + */ + V8_INLINE TracedReference(TracedReference&& other) { + // Forward to operator=. + *this = std::move(other); } - template - V8_INLINE bool operator!=(const Local& that) const { - return !operator==(that); + /** + * Move constructor initializing TracedReference from an + * existing one. + */ + template + V8_INLINE TracedReference(TracedReference&& other) { + // Forward to operator=. + *this = std::move(other); } /** - * Assigns a wrapper class ID to the handle. + * Copy constructor initializing TracedReference from an + * existing one. */ - V8_INLINE void SetWrapperClassId(uint16_t class_id); + V8_INLINE TracedReference(const TracedReference& other) { + // Forward to operator=; + *this = other; + } /** - * Returns the class ID previously assigned to this handle or 0 if no class ID - * was previously assigned. + * Copy constructor initializing TracedReference from an + * existing one. */ - V8_INLINE uint16_t WrapperClassId() const; + template + V8_INLINE TracedReference(const TracedReference& other) { + // Forward to operator=; + *this = other; + } /** - * Adds a finalization callback to the handle. The type of this callback is - * similar to WeakCallbackType::kInternalFields, i.e., it will pass the - * parameter and the first two internal fields of the object. - * - * The callback is then supposed to reset the handle in the callback. No - * further V8 API may be called in this callback. In case additional work - * involving V8 needs to be done, a second callback can be scheduled using - * WeakCallbackInfo::SetSecondPassCallback. + * Move assignment operator initializing TracedGlobal from an existing one. */ - V8_INLINE void SetFinalizationCallback( - void* parameter, WeakCallbackInfo::Callback callback); + V8_INLINE TracedReference& operator=(TracedReference&& rhs); - private: - // Wrapping type used when clearing on destruction is required. - struct WrappedForDestruction { - T* value; - - explicit WrappedForDestruction(T* val) : value(val) {} - ~WrappedForDestruction(); - operator T*() const { return value; } - T* operator*() const { return value; } - T* operator->() const { return value; } - WrappedForDestruction& operator=(const WrappedForDestruction& other) { - value = other.value; - return *this; - } - WrappedForDestruction& operator=(T* val) { - value = val; - return *this; - } - }; + /** + * Move assignment operator initializing TracedGlobal from an existing one. + */ + template + V8_INLINE TracedReference& operator=(TracedReference&& rhs); - V8_INLINE static T* New(Isolate* isolate, T* that, void* slot); + /** + * Copy assignment operator initializing TracedGlobal from an existing one. + * + * Note: Prohibited when |other| has a finalization callback set through + * |SetFinalizationCallback|. + */ + V8_INLINE TracedReference& operator=(const TracedReference& rhs); - T* operator*() const { return this->val_; } + /** + * Copy assignment operator initializing TracedGlobal from an existing one. + * + * Note: Prohibited when |other| has a finalization callback set through + * |SetFinalizationCallback|. + */ + template + V8_INLINE TracedReference& operator=(const TracedReference& rhs); - typename std::conditional< - TracedGlobalTrait>::kRequiresExplicitDestruction, - WrappedForDestruction, T*>::type val_{nullptr}; + /** + * If non-empty, destroy the underlying storage cell and create a new one with + * the contents of other if other is non empty + */ + template + V8_INLINE void Reset(Isolate* isolate, const Local& other); - friend class EmbedderHeapTracer; - template - friend class Local; - friend class Object; - template - friend class ReturnValue; + template + V8_INLINE TracedReference& As() const { + return reinterpret_cast&>( + const_cast&>(*this)); + } }; /** @@ -3640,8 +3761,9 @@ class V8_EXPORT Object : public Value { return object.val_->InternalFieldCount(); } - /** Same as above, but works for TracedGlobal. */ - V8_INLINE static int InternalFieldCount(const TracedGlobal& object) { + /** Same as above, but works for TracedReferenceBase. */ + V8_INLINE static int InternalFieldCount( + const TracedReferenceBase& object) { return object.val_->InternalFieldCount(); } @@ -3666,7 +3788,7 @@ class V8_EXPORT Object : public Value { /** Same as above, but works for TracedGlobal. */ V8_INLINE static void* GetAlignedPointerFromInternalField( - const TracedGlobal& object, int index) { + const TracedReferenceBase& object, int index) { return object.val_->GetAlignedPointerFromInternalField(index); } @@ -3956,7 +4078,7 @@ class ReturnValue { template V8_INLINE void Set(const Global& handle); template - V8_INLINE void Set(const TracedGlobal& handle); + V8_INLINE void Set(const TracedReferenceBase& handle); template V8_INLINE void Set(const Local handle); // Fast primitive setters @@ -7376,7 +7498,8 @@ class V8_EXPORT EmbedderHeapTracer { class V8_EXPORT TracedGlobalHandleVisitor { public: virtual ~TracedGlobalHandleVisitor() = default; - virtual void VisitTracedGlobalHandle(const TracedGlobal& value) = 0; + virtual void VisitTracedGlobalHandle(const TracedGlobal& handle) {} + virtual void VisitTracedReference(const TracedReference& handle) {} }; /** @@ -7414,7 +7537,7 @@ class V8_EXPORT EmbedderHeapTracer { virtual void RegisterV8References( const std::vector >& embedder_fields) = 0; - void RegisterEmbedderReference(const TracedGlobal& ref); + void RegisterEmbedderReference(const TracedReferenceBase& ref); /** * Called at the beginning of a GC cycle. @@ -7475,32 +7598,35 @@ class V8_EXPORT EmbedderHeapTracer { * * If this returns false, then V8 may decide that the object referred to by * such a handle is reclaimed. In that case: - * - No action is required if handles are used with destructors. - * - When run without destructors (by specializing - * |TracedGlobalTrait::kRequiresExplicitDestruction|) V8 calls - * |ResetHandleInNonTracingGC|. - * - * Note that the |handle| is different from the |TracedGlobal| handle that - * the embedder holds for retaining the object. The embedder may use - * |TracedGlobal::WrapperClassId()| to distinguish cases where it wants - * handles to be treated as roots from not being treated as roots. + * - No action is required if handles are used with destructors, i.e., by just + * using |TracedGlobal|. + * - When run without destructors, i.e., by using + * |TracedReference|, V8 calls |ResetHandleInNonTracingGC|. + * + * Note that the |handle| is different from the handle that the embedder holds + * for retaining the object. The embedder may use |WrapperClassId()| to + * distinguish cases where it wants handles to be treated as roots from not + * being treated as roots. */ virtual bool IsRootForNonTracingGC( - const v8::TracedGlobal& handle) { - return true; - } + const v8::TracedReference& handle); + virtual bool IsRootForNonTracingGC(const v8::TracedGlobal& handle); /** * Used in combination with |IsRootForNonTracingGC|. Called by V8 when an * object that is backed by a handle is reclaimed by a non-tracing garbage * collection. It is up to the embedder to reset the original handle. * - * Note that the |handle| is different from the |TracedGlobal| handle that - * the embedder holds for retaining the object. It is up to the embedder to - * find the orignal |TracedGlobal| handle via the object or class id. + * Note that the |handle| is different from the handle that the embedder holds + * for retaining the object. It is up to the embedder to find the original + * handle via the object or class id. */ virtual void ResetHandleInNonTracingGC( - const v8::TracedGlobal& handle) {} + const v8::TracedReference& handle); + V8_DEPRECATE_SOON( + "Use TracedReference version when not requiring destructors.", + virtual void ResetHandleInNonTracingGC( + const v8::TracedGlobal& handle)); /* * Called by the embedder to immediately perform a full garbage collection. @@ -9103,8 +9229,12 @@ class V8_EXPORT V8 { template friend class Maybe; template + friend class TracedReferenceBase; + template friend class TracedGlobal; template + friend class TracedReference; + template friend class WeakCallbackInfo; template friend class Eternal; template friend class PersistentBase; @@ -9975,7 +10105,7 @@ Local Local::New(Isolate* isolate, } template -Local Local::New(Isolate* isolate, const TracedGlobal& that) { +Local Local::New(Isolate* isolate, const TracedReferenceBase& that) { return New(isolate, that.val_); } @@ -10156,26 +10286,20 @@ Global& Global::operator=(Global -TracedGlobal::WrappedForDestruction::~WrappedForDestruction() { - if (value == nullptr) return; - V8::DisposeTracedGlobal(reinterpret_cast(value)); - value = nullptr; -} - -template -T* TracedGlobal::New(Isolate* isolate, T* that, void* slot) { +T* TracedReferenceBase::New(Isolate* isolate, T* that, void* slot, + DestructionMode destruction_mode) { if (that == nullptr) return nullptr; internal::Address* p = reinterpret_cast(that); return reinterpret_cast(V8::GlobalizeTracedReference( reinterpret_cast(isolate), p, reinterpret_cast(slot), - TracedGlobalTrait>::kRequiresExplicitDestruction)); + destruction_mode == kWithDestructor)); } template -void TracedGlobal::Reset() { +void TracedReferenceBase::Reset() { if (IsEmpty()) return; - V8::DisposeTracedGlobal(reinterpret_cast(**this)); + V8::DisposeTracedGlobal(reinterpret_cast(val_)); val_ = nullptr; } @@ -10185,7 +10309,8 @@ void TracedGlobal::Reset(Isolate* iso TYPE_CHECK(T, S); Reset(); if (other.IsEmpty()) return; - this->val_ = New(isolate, other.val_, &val_); + this->val_ = this->New(isolate, other.val_, &this->val_, + TracedReferenceBase::kWithDestructor); } template @@ -10233,28 +10358,83 @@ TracedGlobal& TracedGlobal::operat } template -void TracedGlobal::SetWrapperClassId(uint16_t class_id) { +template +void TracedReference::Reset(Isolate* isolate, const Local& other) { + TYPE_CHECK(T, S); + Reset(); + if (other.IsEmpty()) return; + this->val_ = this->New(isolate, other.val_, &this->val_, + TracedReferenceBase::kWithoutDestructor); +} + +template +template +TracedReference& TracedReference::operator=(TracedReference&& rhs) { + TYPE_CHECK(T, S); + *this = std::move(rhs.template As()); + return *this; +} + +template +template +TracedReference& TracedReference::operator=( + const TracedReference& rhs) { + TYPE_CHECK(T, S); + *this = rhs.template As(); + return *this; +} + +template +TracedReference& TracedReference::operator=(TracedReference&& rhs) { + if (this != &rhs) { + this->Reset(); + if (rhs.val_ != nullptr) { + this->val_ = rhs.val_; + V8::MoveTracedGlobalReference( + reinterpret_cast(&rhs.val_), + reinterpret_cast(&this->val_)); + rhs.val_ = nullptr; + } + } + return *this; +} + +template +TracedReference& TracedReference::operator=(const TracedReference& rhs) { + if (this != &rhs) { + this->Reset(); + if (rhs.val_ != nullptr) { + V8::CopyTracedGlobalReference( + reinterpret_cast(&rhs.val_), + reinterpret_cast(&this->val_)); + } + } + return *this; +} + +template +void TracedReferenceBase::SetWrapperClassId(uint16_t class_id) { typedef internal::Internals I; if (IsEmpty()) return; - internal::Address* obj = reinterpret_cast(**this); + internal::Address* obj = reinterpret_cast(val_); uint8_t* addr = reinterpret_cast(obj) + I::kNodeClassIdOffset; *reinterpret_cast(addr) = class_id; } template -uint16_t TracedGlobal::WrapperClassId() const { +uint16_t TracedReferenceBase::WrapperClassId() const { typedef internal::Internals I; if (IsEmpty()) return 0; - internal::Address* obj = reinterpret_cast(**this); + internal::Address* obj = reinterpret_cast(val_); uint8_t* addr = reinterpret_cast(obj) + I::kNodeClassIdOffset; return *reinterpret_cast(addr); } template -void TracedGlobal::SetFinalizationCallback( +void TracedReferenceBase::SetFinalizationCallback( void* parameter, typename WeakCallbackInfo::Callback callback) { - V8::SetFinalizationCallbackTraced( - reinterpret_cast(**this), parameter, callback); + V8::SetFinalizationCallbackTraced(reinterpret_cast(val_), + parameter, callback); } template @@ -10273,12 +10453,12 @@ void ReturnValue::Set(const Global template template -void ReturnValue::Set(const TracedGlobal& handle) { +void ReturnValue::Set(const TracedReferenceBase& handle) { TYPE_CHECK(T, S); if (V8_UNLIKELY(handle.IsEmpty())) { *value_ = GetDefaultValue(); } else { - *value_ = *reinterpret_cast(*handle); + *value_ = *reinterpret_cast(handle.val_); } } diff -up chromium-78.0.3904.70/v8/src/api/api.cc.implement-tracedreference chromium-78.0.3904.70/v8/src/api/api.cc --- chromium-78.0.3904.70/v8/src/api/api.cc.implement-tracedreference 2019-10-24 09:18:56.712105100 -0400 +++ chromium-78.0.3904.70/v8/src/api/api.cc 2019-10-24 09:20:17.428555637 -0400 @@ -10346,11 +10346,12 @@ void EmbedderHeapTracer::DecreaseAllocat } void EmbedderHeapTracer::RegisterEmbedderReference( - const TracedGlobal& ref) { + const TracedReferenceBase& ref) { if (ref.IsEmpty()) return; i::Heap* const heap = reinterpret_cast(isolate_)->heap(); - heap->RegisterExternallyReferencedObject(reinterpret_cast(*ref)); + heap->RegisterExternallyReferencedObject( + reinterpret_cast(ref.val_)); } void EmbedderHeapTracer::IterateTracedGlobalHandles( @@ -10360,6 +10361,26 @@ void EmbedderHeapTracer::IterateTracedGl isolate->global_handles()->IterateTracedNodes(visitor); } +bool EmbedderHeapTracer::IsRootForNonTracingGC( + const v8::TracedReference& handle) { + return true; +} + +bool EmbedderHeapTracer::IsRootForNonTracingGC( + const v8::TracedGlobal& handle) { + return true; +} + +void EmbedderHeapTracer::ResetHandleInNonTracingGC( + const v8::TracedReference& handle) { + UNREACHABLE(); +} + +void EmbedderHeapTracer::ResetHandleInNonTracingGC( + const v8::TracedGlobal& handle) { + UNREACHABLE(); +} + namespace internal { const size_t HandleScopeImplementer::kEnteredContextsOffset = diff -up chromium-78.0.3904.70/v8/src/handles/global-handles.cc.implement-tracedreference chromium-78.0.3904.70/v8/src/handles/global-handles.cc --- chromium-78.0.3904.70/v8/src/handles/global-handles.cc.implement-tracedreference 2019-10-24 09:20:39.954123225 -0400 +++ chromium-78.0.3904.70/v8/src/handles/global-handles.cc 2019-10-24 09:21:45.911857072 -0400 @@ -901,8 +901,13 @@ void GlobalHandles::IdentifyWeakUnmodifi DCHECK(node->is_root()); if (is_unmodified(node->location())) { v8::Value* value = ToApi(node->handle()); - node->set_root(tracer->IsRootForNonTracingGC( - *reinterpret_cast*>(&value))); + if (node->has_destructor()) { + node->set_root(tracer->IsRootForNonTracingGC( + *reinterpret_cast*>(&value))); + } else { + node->set_root(tracer->IsRootForNonTracingGC( + *reinterpret_cast*>(&value))); + } } } } @@ -990,7 +995,7 @@ void GlobalHandles::IterateYoungWeakUnmo } else { v8::Value* value = ToApi(node->handle()); tracer->ResetHandleInNonTracingGC( - *reinterpret_cast*>(&value)); + *reinterpret_cast*>(&value)); DCHECK(!node->IsInUse()); } @@ -1271,8 +1276,13 @@ void GlobalHandles::IterateTracedNodes( for (TracedNode* node : *traced_nodes_) { if (node->IsInUse()) { v8::Value* value = ToApi(node->handle()); - visitor->VisitTracedGlobalHandle( - *reinterpret_cast*>(&value)); + if (node->has_destructor()) { + visitor->VisitTracedGlobalHandle( + *reinterpret_cast*>(&value)); + } else { + visitor->VisitTracedReference( + *reinterpret_cast*>(&value)); + } } } } diff -up chromium-78.0.3904.70/v8/src/heap/embedder-tracing.h.implement-tracedreference chromium-78.0.3904.70/v8/src/heap/embedder-tracing.h --- chromium-78.0.3904.70/v8/src/heap/embedder-tracing.h.implement-tracedreference 2019-10-24 09:22:03.664519559 -0400 +++ chromium-78.0.3904.70/v8/src/heap/embedder-tracing.h 2019-10-24 09:22:45.197729964 -0400 @@ -57,7 +57,12 @@ class V8_EXPORT_PRIVATE LocalEmbedderHea bool IsRootForNonTracingGC(const v8::TracedGlobal& handle) { return !InUse() || remote_tracer_->IsRootForNonTracingGC(handle); } - void ResetHandleInNonTracingGC(const v8::TracedGlobal& handle) { + + bool IsRootForNonTracingGC(const v8::TracedReference& handle) { + return !InUse() || remote_tracer_->IsRootForNonTracingGC(handle); + } + + void ResetHandleInNonTracingGC(const v8::TracedReference& handle) { // Resetting is only called when IsRootForNonTracingGC returns false which // can only happen the EmbedderHeapTracer is set on API level. DCHECK(InUse());