5 #ifndef INCLUDE_V8_TRACED_HANDLE_H_
6 #define INCLUDE_V8_TRACED_HANDLE_H_
14 #include <type_traits>
28 class BasicTracedReferenceExtractor;
104 reinterpret_cast<std::atomic<
void*>*>(&
val_)->store(
105 new_val, std::memory_order_relaxed);
112 return reinterpret_cast<std::atomic<
const void*>
const*>(&
val_)->load(
113 std::memory_order_relaxed);
121 friend class internal::BasicTracedReferenceExtractor;
122 template <
typename F>
124 template <
typename U>
145 template <
typename T>
160 #ifdef V8_ENABLE_CHECKS
163 return reinterpret_cast<T*>(
val_);
166 #ifdef V8_ENABLE_CHECKS
169 return reinterpret_cast<T*>(
val_);
176 BasicTracedReference() =
default;
179 Isolate* isolate, T* that,
void* slot,
184 template <
typename F>
187 template <
typename F>
189 template <
typename F>
191 template <
typename F>
193 template <
typename F>
216 template <
typename T>
242 this->New(isolate, that.val_, &
this->val_,
245 static_assert(std::is_base_of<T, S>::value,
"type check");
253 *
this = std::move(other);
259 template <
typename S>
262 *
this = std::move(other);
276 template <
typename S>
348 template <
typename T>
367 this->New(isolate, that.val_, &
this->val_,
370 static_assert(std::is_base_of<T, S>::value,
"type check");
379 *
this = std::move(other);
386 template <
typename S>
389 *
this = std::move(other);
405 template <
typename S>
450 Isolate* isolate, T* that,
void* slot,
453 if (that ==
nullptr)
return nullptr;
456 reinterpret_cast<
internal::Isolate*>(isolate)
, p
,
470 if (a ==
nullptr)
return b ==
nullptr;
471 if (b ==
nullptr)
return false;
475 template <
typename U>
480 if (a ==
nullptr)
return b ==
nullptr;
481 if (b ==
nullptr)
return false;
485 template <
typename U>
493 return !(lhs
== rhs);
496 template <
typename U>
499 return !(lhs == rhs);
502 template <
typename U>
505 return !(rhs == lhs);
511 static_assert(std::is_base_of<T, S>::value,
"type check");
513 if (other.IsEmpty())
return;
514 this->SetSlotThreadSafe(
515 this->New(isolate, other.val_, &
this->val_,
524 static_assert(std::is_base_of<T, S>::value,
"type check");
525 *
this = std::move(rhs.
template As<T>());
533 static_assert(std::is_base_of<T, S>::value,
"type check");
534 *
this = rhs.
template As<T>();
553 if (rhs.val_ !=
nullptr) {
567 *
reinterpret_cast<uint16_t*>(addr) = class_id;
575 return *
reinterpret_cast<uint16_t*>(addr);
581 static_assert(std::is_base_of<T, S>::value,
"type check");
583 if (other.IsEmpty())
return;
584 this->val_ =
this->New(isolate, other.val_, &
this->val_,
592 static_assert(std::is_base_of<T, S>::value,
"type check");
593 *
this = std::move(rhs.
template As<T>());
600 static_assert(std::is_base_of<T, S>::value,
"type check");
601 *
this = rhs.
template As<T>();
619 if (rhs.val_ !=
nullptr) {