⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.96
Server IP:
147.93.97.220
Server:
Linux srv843233 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64
Server Software:
nginx/1.28.0
PHP Version:
8.2.29
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
include
/
node
/
cppgc
/
internal
/
Edit File: gc-info.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_GC_INFO_H_ #define INCLUDE_CPPGC_INTERNAL_GC_INFO_H_ #include
#include
#include
#include "cppgc/internal/finalizer-trait.h" #include "cppgc/internal/logging.h" #include "cppgc/internal/name-trait.h" #include "cppgc/trace-trait.h" #include "v8config.h" // NOLINT(build/include_directory) namespace cppgc { namespace internal { using GCInfoIndex = uint16_t; struct V8_EXPORT EnsureGCInfoIndexTrait final { // Acquires a new GC info object and updates `registered_index` with the index // that identifies that new info accordingly. template
V8_INLINE static void EnsureIndex( std::atomic
& registered_index) { EnsureGCInfoIndexTraitDispatch
{}(registered_index); } private: template
::value, bool = FinalizerTrait
::HasFinalizer(), bool = NameTrait
::HasNonHiddenName()> struct EnsureGCInfoIndexTraitDispatch; static void V8_PRESERVE_MOST EnsureGCInfoIndexPolymorphic(std::atomic
&, TraceCallback, FinalizationCallback, NameCallback); static void V8_PRESERVE_MOST EnsureGCInfoIndexPolymorphic( std::atomic
&, TraceCallback, FinalizationCallback); static void V8_PRESERVE_MOST EnsureGCInfoIndexPolymorphic( std::atomic
&, TraceCallback, NameCallback); static void V8_PRESERVE_MOST EnsureGCInfoIndexPolymorphic(std::atomic
&, TraceCallback); static void V8_PRESERVE_MOST EnsureGCInfoIndexNonPolymorphic(std::atomic
&, TraceCallback, FinalizationCallback, NameCallback); static void V8_PRESERVE_MOST EnsureGCInfoIndexNonPolymorphic( std::atomic
&, TraceCallback, FinalizationCallback); static void V8_PRESERVE_MOST EnsureGCInfoIndexNonPolymorphic( std::atomic
&, TraceCallback, NameCallback); static void V8_PRESERVE_MOST EnsureGCInfoIndexNonPolymorphic(std::atomic
&, TraceCallback); }; #define DISPATCH(is_polymorphic, has_finalizer, has_non_hidden_name, function) \ template
\ struct EnsureGCInfoIndexTrait::EnsureGCInfoIndexTraitDispatch< \ T, is_polymorphic, has_finalizer, has_non_hidden_name> { \ V8_INLINE void operator()(std::atomic
& registered_index) { \ function; \ } \ }; // --------------------------------------------------------------------- // // DISPATCH(is_polymorphic, has_finalizer, has_non_hidden_name, function) // --------------------------------------------------------------------- // DISPATCH(true, true, true, // EnsureGCInfoIndexPolymorphic(registered_index, // TraceTrait
::Trace, // FinalizerTrait
::kCallback, // NameTrait
::GetName)) // DISPATCH(true, true, false, // EnsureGCInfoIndexPolymorphic(registered_index, // TraceTrait
::Trace, // FinalizerTrait
::kCallback)) // DISPATCH(true, false, true, // EnsureGCInfoIndexPolymorphic(registered_index, // TraceTrait
::Trace, // NameTrait
::GetName)) // DISPATCH(true, false, false, // EnsureGCInfoIndexPolymorphic(registered_index, // TraceTrait
::Trace)) // DISPATCH(false, true, true, // EnsureGCInfoIndexNonPolymorphic(registered_index, // TraceTrait
::Trace, // FinalizerTrait
::kCallback, // NameTrait
::GetName)) // DISPATCH(false, true, false, // EnsureGCInfoIndexNonPolymorphic(registered_index, // TraceTrait
::Trace, // FinalizerTrait
::kCallback)) // DISPATCH(false, false, true, // EnsureGCInfoIndexNonPolymorphic(registered_index, // TraceTrait
::Trace, // NameTrait
::GetName)) // DISPATCH(false, false, false, // EnsureGCInfoIndexNonPolymorphic(registered_index, // TraceTrait
::Trace)) // #undef DISPATCH // Fold types based on finalizer behavior. Note that finalizer characteristics // align with trace behavior, i.e., destructors are virtual when trace methods // are and vice versa. template
struct GCInfoFolding { static constexpr bool kHasVirtualDestructorAtBase = std::has_virtual_destructor
::value; static constexpr bool kBothTypesAreTriviallyDestructible = std::is_trivially_destructible
::value && std::is_trivially_destructible
::value; static constexpr bool kHasCustomFinalizerDispatchAtBase = internal::HasFinalizeGarbageCollectedObject< ParentMostGarbageCollectedType>::value; #ifdef CPPGC_SUPPORTS_OBJECT_NAMES static constexpr bool kWantsDetailedObjectNames = true; #else // !CPPGC_SUPPORTS_OBJECT_NAMES static constexpr bool kWantsDetailedObjectNames = false; #endif // !CPPGC_SUPPORTS_OBJECT_NAMES // Folding would regresses name resolution when deriving names from C++ // class names as it would just folds a name to the base class name. using ResultType = std::conditional_t<(kHasVirtualDestructorAtBase || kBothTypesAreTriviallyDestructible || kHasCustomFinalizerDispatchAtBase) && !kWantsDetailedObjectNames, ParentMostGarbageCollectedType, T>; }; // Trait determines how the garbage collector treats objects wrt. to traversing, // finalization, and naming. template
struct GCInfoTrait final { V8_INLINE static GCInfoIndex Index() { static_assert(sizeof(T), "T must be fully defined"); static std::atomic
registered_index; // Uses zero initialization. GCInfoIndex index = registered_index.load(std::memory_order_acquire); if (V8_UNLIKELY(!index)) { EnsureGCInfoIndexTrait::EnsureIndex
(registered_index); // Slow path call uses V8_PRESERVE_MOST which does not support return // values (also preserves RAX). Avoid out parameter by just reloading the // value here which at this point is guaranteed to be set. index = registered_index.load(std::memory_order_acquire); CPPGC_DCHECK(index != 0); } return index; } }; } // namespace internal } // namespace cppgc #endif // INCLUDE_CPPGC_INTERNAL_GC_INFO_H_
Simpan