
     ¥ˆîíñ514ìÀô     ¥‹      ½”]oÚ0†ïû+<_ìŽ¾Z©­ã©#HC£€h¦mš¦ÉÄ&ñšØ‘mJÛ_?‡€È&Ø‡Ævås’7ç¼Ï‰|È‹h:ˆ?Î†èM|;F³w¯Ç£Â-€÷½@Gõ‹~Ðî 'áÌ¹ò
`½^ë^ M
ñ2Wä}°ÎÈÄÜqLÏHõŒž!’	Æý‰ˆ“.t¤¸xDz‰@¯œ•\twÁîlwá™ã 4_
ÍW¹° ’ŒgÁZI.…rÀ¥uêº¾l[‘…æO•ƒÎ?èæ‹n`ØbÓ´
%.C,—©
±Ó%¦D)²&	1ÈD+‹œ©û •KŒXîBüi4˜~ö:pYõ5%eF,CüjN®§á¦Vì°æ¶ÖŒ™uÈ{–K)øQñ�G˜ÞÉçã£º`$lbdé¤V{)xÄ&j¢s[2Ïzî	2ÓTÕþ«i°ä»aÌnæÃI�æõHxUbïîÿÓ3>@‘4"qÚ<méêV/ÕÂ–×»m½™fS„Zè ò€Wê^éµj2ûy¤-ýlX*‚¯V+L›YÓò»íîE«}Ùê^ öåU¯‡Ð1¯ø[']“$þ$‘ÕåóÎ1ÝE§ èçoÿ7AP°rOQe§ é�Ÿ�üæ}ƒí&"°Ùzê½ûÂåt²Ú       §ˆîíñ555ìÀô +    §‹      ½”Ûsš@ÆßóWl÷¡or@ðÒèDq¬QÁMšvú°rÛMÈ²Þú×ÅŽ¶£I�Îô‰¾óíù};{ôw–ÓvGôÉÐèskÐk#\xPÛ –k•?4IV :6F˜
‘]¬V+i¥J)�À� óXƒ\pæ	É>6¯ôí7ó
é4 ~ñDº`"Ì^âk”†Ò…È™Îbž�G< Éó@ä�g<õž·«e±µ$CÄt(ëGØ[ê³ÔßlwRþÁµ(Þ5Gf;óí’›º hIb%i†M�Í#”sÏÀÀ¼4Éa“äYŠXˆ‰…�¿õÚÎ÷B‚n«M� ÊƒÐÀÛ†}ã·Ø´É<Ð�œÖ�…ÍÉš§>YàŸOKÃ)ûqÞÐ*5V�{œe‚¥ÉA
â1ª—ÆyF
ÖZA@ù±ª”øo¥A¼ßÂÝN:¶kõ&e$þÖâÐÝEg„ÍáA"�Åxà‰”oö¥éûd–g7¿^Ñ¾KÎ"*°‰P�T^€¶Hž“t•ÓÉ�äŠØüKØ ÷ãzF^j-;\O¢RG»ŸÒîú®e×ê�U£ß�6‘´ƒÆæÅ%ÇðÐVåj½"7*²Šùº¦!tF¨4åÿ“nØ¯)Í§ÅÝrÝ”�…K¿ÈX}qâ§dÌ‰¦ñ‡©üxˆåÂ’·bQ”Jµ�äúk±T?¨¯Äò—×öƒD‡ÝpÒ¡ƒ?vÙ˜ùi    @   ©ˆl–Ðz¾”Êe¶…4 Y¸'n61hß�þY…YÀ’28à¼çó„œm¯ò_ˆI|¥�+y,Âö 1n    ©// Copyright 2021 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef INCLUDE_V8_TRACED_HANDLE_H_
#define INCLUDE_V8_TRACED_HANDLE_H_

#include <stddef.h>
#include <stdint.h>
#include <stdio.h>

#include <atomic>
#include <memory>
#include <type_traits>
#include <utility>

#include "v8-internal.h"            // NOLINT(build/include_directory)
#include "v8-local-handle.h"        // NOLINT(build/include_directory)
#include "v8-weak-callback-info.h"  // NOLINT(build/include_directory)
#include "v8config.h"               // NOLINT(build/include_directory)

namespace v8 {

class Value;

namespace internal {

class BasicTracedReferenceExtractor;

enum class GlobalHandleStoreMode {
  kInitializingStore,
  kAssigningStore,
};

V8_EXPORT internal::Address* GlobalizeTracedReference(
    internal::Isolate* isolate, internal::Address* handle,
    internal::Address* slot, GlobalHandleStoreMode store_mode);
V8_EXPORT void MoveTracedReference(internal::Address** from,
                                   internal::Address** to);
V8_EXPORT void CopyTracedReference(const internal::Address* const* from,
                                   internal::Address** to);
V8_EXPORT void DisposeTracedReference(internal::Address* global_handle);

}  // namespace internal

class TracedReferenceBase {
 public:
  /**
   * Returns true if the reference is empty, i.e., has not been assigned
   * 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<Value> from this handle.
   */
  V8_INLINE v8::Local<v8::Value> Get(v8::Isolate* isolate) const {
    if (IsEmpty()) return Local<Value>();
    return Local<Value>::New(isolate, reinterpret_cast<Value*>(val_));
  }

  /**
   * Returns true if this TracedReference is empty, i.e., has not been
   * assigned an object. This version of IsEmpty is thread-safe.
   */
  bool IsEmptyThreadSafe() const {
    return this->GetSlotThreadSafe() == nullptr;
  }

  /**
   * 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;

 protected:
  /**
   * Update this reference in a thread-safe way.
   */
  void SetSlotThreadSafe(void* new_val) {
    reinterpret_cast<std::atomic<void*>*>(&val_)->store(
        new_val, std::memory_order_relaxed);
  }

  /**
   * Get this reference in a thread-safe way
   */
  const void* GetSlotThreadSafe() const {
    return reinterpret_cast<std::atomic<const void*> const*>(&val_)->load(
        std::memory_or