@downdraft/native-mobile-android-arm64 0.0.0 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/include/node/cppgc/allocation.h +308 -0
- package/include/node/cppgc/common.h +28 -0
- package/include/node/cppgc/cross-thread-persistent.h +462 -0
- package/include/node/cppgc/custom-space.h +97 -0
- package/include/node/cppgc/default-platform.h +68 -0
- package/include/node/cppgc/explicit-management.h +100 -0
- package/include/node/cppgc/garbage-collected.h +114 -0
- package/include/node/cppgc/heap-consistency.h +309 -0
- package/include/node/cppgc/heap-handle.h +48 -0
- package/include/node/cppgc/heap-state.h +82 -0
- package/include/node/cppgc/heap-statistics.h +126 -0
- package/include/node/cppgc/heap.h +202 -0
- package/include/node/cppgc/internal/api-constants.h +75 -0
- package/include/node/cppgc/internal/atomic-entry-flag.h +48 -0
- package/include/node/cppgc/internal/base-page-handle.h +43 -0
- package/include/node/cppgc/internal/caged-heap-local-data.h +117 -0
- package/include/node/cppgc/internal/caged-heap.h +64 -0
- package/include/node/cppgc/internal/compiler-specific.h +46 -0
- package/include/node/cppgc/internal/conditional-stack-allocated.h +41 -0
- package/include/node/cppgc/internal/finalizer-trait.h +93 -0
- package/include/node/cppgc/internal/gc-info.h +150 -0
- package/include/node/cppgc/internal/logging.h +50 -0
- package/include/node/cppgc/internal/member-storage.h +305 -0
- package/include/node/cppgc/internal/name-trait.h +141 -0
- package/include/node/cppgc/internal/persistent-node.h +219 -0
- package/include/node/cppgc/internal/pointer-policies.h +280 -0
- package/include/node/cppgc/internal/write-barrier.h +487 -0
- package/include/node/cppgc/liveness-broker.h +78 -0
- package/include/node/cppgc/macros.h +56 -0
- package/include/node/cppgc/member.h +669 -0
- package/include/node/cppgc/name-provider.h +75 -0
- package/include/node/cppgc/object-size-trait.h +58 -0
- package/include/node/cppgc/persistent.h +376 -0
- package/include/node/cppgc/platform.h +174 -0
- package/include/node/cppgc/prefinalizer.h +75 -0
- package/include/node/cppgc/process-heap-statistics.h +36 -0
- package/include/node/cppgc/sentinel-pointer.h +39 -0
- package/include/node/cppgc/source-location.h +16 -0
- package/include/node/cppgc/tagged-member.h +114 -0
- package/include/node/cppgc/testing.h +106 -0
- package/include/node/cppgc/trace-trait.h +127 -0
- package/include/node/cppgc/type-traits.h +272 -0
- package/include/node/cppgc/visitor.h +534 -0
- package/include/node/js_native_api.h +634 -0
- package/include/node/js_native_api_types.h +244 -0
- package/include/node/libplatform/libplatform-export.h +29 -0
- package/include/node/libplatform/libplatform.h +112 -0
- package/include/node/libplatform/v8-tracing.h +343 -0
- package/include/node/node.h +1744 -0
- package/include/node/node_api.h +265 -0
- package/include/node/node_api_types.h +58 -0
- package/include/node/node_buffer.h +94 -0
- package/include/node/node_object_wrap.h +145 -0
- package/include/node/node_version.h +116 -0
- package/include/node/uv/aix.h +32 -0
- package/include/node/uv/bsd.h +34 -0
- package/include/node/uv/darwin.h +61 -0
- package/include/node/uv/errno.h +483 -0
- package/include/node/uv/linux.h +34 -0
- package/include/node/uv/os390.h +33 -0
- package/include/node/uv/posix.h +31 -0
- package/include/node/uv/sunos.h +44 -0
- package/include/node/uv/threadpool.h +37 -0
- package/include/node/uv/tree.h +521 -0
- package/include/node/uv/unix.h +509 -0
- package/include/node/uv/version.h +43 -0
- package/include/node/uv/win.h +698 -0
- package/include/node/uv.h +1994 -0
- package/include/node/v8-array-buffer.h +646 -0
- package/include/node/v8-callbacks.h +533 -0
- package/include/node/v8-container.h +183 -0
- package/include/node/v8-context.h +580 -0
- package/include/node/v8-cpp-heap-external.h +56 -0
- package/include/node/v8-cppgc.h +194 -0
- package/include/node/v8-data.h +96 -0
- package/include/node/v8-date.h +57 -0
- package/include/node/v8-debug.h +210 -0
- package/include/node/v8-embedder-heap.h +54 -0
- package/include/node/v8-embedder-state-scope.h +52 -0
- package/include/node/v8-exception.h +298 -0
- package/include/node/v8-extension.h +60 -0
- package/include/node/v8-external-memory-accounter.h +60 -0
- package/include/node/v8-external.h +73 -0
- package/include/node/v8-fast-api-calls.h +784 -0
- package/include/node/v8-forward.h +82 -0
- package/include/node/v8-function-callback.h +708 -0
- package/include/node/v8-function.h +148 -0
- package/include/node/v8-handle-base.h +155 -0
- package/include/node/v8-initialization.h +343 -0
- package/include/node/v8-inspector-protocol.h +13 -0
- package/include/node/v8-inspector.h +458 -0
- package/include/node/v8-internal.h +1827 -0
- package/include/node/v8-isolate.h +1925 -0
- package/include/node/v8-json.h +54 -0
- package/include/node/v8-local-handle.h +884 -0
- package/include/node/v8-locker.h +138 -0
- package/include/node/v8-maybe.h +185 -0
- package/include/node/v8-memory-span.h +273 -0
- package/include/node/v8-message.h +215 -0
- package/include/node/v8-metrics.h +273 -0
- package/include/node/v8-microtask-queue.h +152 -0
- package/include/node/v8-microtask.h +28 -0
- package/include/node/v8-object.h +1134 -0
- package/include/node/v8-persistent-handle.h +556 -0
- package/include/node/v8-platform.h +1552 -0
- package/include/node/v8-primitive-object.h +118 -0
- package/include/node/v8-primitive.h +1056 -0
- package/include/node/v8-profiler.h +1401 -0
- package/include/node/v8-promise.h +185 -0
- package/include/node/v8-proxy.h +49 -0
- package/include/node/v8-regexp.h +105 -0
- package/include/node/v8-sandbox.h +170 -0
- package/include/node/v8-script.h +996 -0
- package/include/node/v8-snapshot.h +302 -0
- package/include/node/v8-source-location.h +91 -0
- package/include/node/v8-statistics.h +246 -0
- package/include/node/v8-template.h +1096 -0
- package/include/node/v8-trace-categories.h +28 -0
- package/include/node/v8-traced-handle.h +420 -0
- package/include/node/v8-typed-array.h +386 -0
- package/include/node/v8-unwinder-state.h +30 -0
- package/include/node/v8-unwinder.h +146 -0
- package/include/node/v8-util.h +549 -0
- package/include/node/v8-value-serializer-version.h +24 -0
- package/include/node/v8-value-serializer.h +316 -0
- package/include/node/v8-value.h +674 -0
- package/include/node/v8-version-string.h +38 -0
- package/include/node/v8-version.h +20 -0
- package/include/node/v8-wasm-trap-handler-posix.h +31 -0
- package/include/node/v8-wasm-trap-handler-win.h +28 -0
- package/include/node/v8-wasm.h +325 -0
- package/include/node/v8-weak-callback-info.h +88 -0
- package/include/node/v8.h +88 -0
- package/include/node/v8config.h +1077 -0
- package/lib/libc++_shared.so +0 -0
- package/lib/libnode.so +4 -0
- package/package.json +23 -3
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Copyright 2020 the V8 project authors. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
#ifndef INCLUDE_CPPGC_INTERNAL_COMPILER_SPECIFIC_H_
|
|
6
|
+
#define INCLUDE_CPPGC_INTERNAL_COMPILER_SPECIFIC_H_
|
|
7
|
+
|
|
8
|
+
#include "v8config.h" // NOLINT(build/include_directory)
|
|
9
|
+
|
|
10
|
+
namespace cppgc {
|
|
11
|
+
|
|
12
|
+
#if defined(__has_attribute)
|
|
13
|
+
#define CPPGC_HAS_ATTRIBUTE(FEATURE) __has_attribute(FEATURE)
|
|
14
|
+
#else
|
|
15
|
+
#define CPPGC_HAS_ATTRIBUTE(FEATURE) 0
|
|
16
|
+
#endif
|
|
17
|
+
|
|
18
|
+
#if defined(__has_cpp_attribute)
|
|
19
|
+
#define CPPGC_HAS_CPP_ATTRIBUTE(FEATURE) __has_cpp_attribute(FEATURE)
|
|
20
|
+
#else
|
|
21
|
+
#define CPPGC_HAS_CPP_ATTRIBUTE(FEATURE) 0
|
|
22
|
+
#endif
|
|
23
|
+
|
|
24
|
+
// [[no_unique_address]] comes in C++20 but supported in clang with -std >=
|
|
25
|
+
// c++11.
|
|
26
|
+
#if defined(V8_CC_MSVC) && CPPGC_HAS_CPP_ATTRIBUTE(msvc::no_unique_address)
|
|
27
|
+
// Unfortunately MSVC ignores [[no_unique_address]] (see
|
|
28
|
+
// https://devblogs.microsoft.com/cppblog/msvc-cpp20-and-the-std-cpp20-switch/#msvc-extensions-and-abi),
|
|
29
|
+
// and clang-cl matches it for ABI compatibility reasons. We need to prefer
|
|
30
|
+
// [[msvc::no_unique_address]] when available if we actually want any effect.
|
|
31
|
+
#define CPPGC_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]]
|
|
32
|
+
#elif CPPGC_HAS_CPP_ATTRIBUTE(no_unique_address)
|
|
33
|
+
#define CPPGC_NO_UNIQUE_ADDRESS [[no_unique_address]]
|
|
34
|
+
#else
|
|
35
|
+
#define CPPGC_NO_UNIQUE_ADDRESS
|
|
36
|
+
#endif
|
|
37
|
+
|
|
38
|
+
#if CPPGC_HAS_ATTRIBUTE(unused)
|
|
39
|
+
#define CPPGC_UNUSED __attribute__((unused))
|
|
40
|
+
#else
|
|
41
|
+
#define CPPGC_UNUSED
|
|
42
|
+
#endif
|
|
43
|
+
|
|
44
|
+
} // namespace cppgc
|
|
45
|
+
|
|
46
|
+
#endif // INCLUDE_CPPGC_INTERNAL_COMPILER_SPECIFIC_H_
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Copyright 2025 the V8 project authors. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
#ifndef INCLUDE_CPPGC_INTERNAL_CONDITIONAL_STACK_ALLOCATED_H_
|
|
6
|
+
#define INCLUDE_CPPGC_INTERNAL_CONDITIONAL_STACK_ALLOCATED_H_
|
|
7
|
+
|
|
8
|
+
#include <type_traits>
|
|
9
|
+
|
|
10
|
+
#include "cppgc/macros.h" // NOLINT(build/include_directory)
|
|
11
|
+
#include "cppgc/type-traits.h" // NOLINT(build/include_directory)
|
|
12
|
+
|
|
13
|
+
namespace cppgc {
|
|
14
|
+
namespace internal {
|
|
15
|
+
|
|
16
|
+
// Base class that is marked as stack allocated if T is either marked as stack
|
|
17
|
+
// allocated or a traceable type.
|
|
18
|
+
template <typename T>
|
|
19
|
+
class ConditionalStackAllocatedBase;
|
|
20
|
+
|
|
21
|
+
template <typename T>
|
|
22
|
+
concept RequiresStackAllocated =
|
|
23
|
+
!std::is_void_v<T> &&
|
|
24
|
+
(cppgc::IsStackAllocatedType<T> || cppgc::internal::IsTraceableV<T> ||
|
|
25
|
+
cppgc::IsGarbageCollectedOrMixinTypeV<T>);
|
|
26
|
+
|
|
27
|
+
template <typename T>
|
|
28
|
+
requires(RequiresStackAllocated<T>)
|
|
29
|
+
class ConditionalStackAllocatedBase<T> {
|
|
30
|
+
public:
|
|
31
|
+
CPPGC_STACK_ALLOCATED();
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
template <typename T>
|
|
35
|
+
requires(!RequiresStackAllocated<T>)
|
|
36
|
+
class ConditionalStackAllocatedBase<T> {};
|
|
37
|
+
|
|
38
|
+
} // namespace internal
|
|
39
|
+
} // namespace cppgc
|
|
40
|
+
|
|
41
|
+
#endif // INCLUDE_CPPGC_INTERNAL_CONDITIONAL_STACK_ALLOCATED_H_
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// Copyright 2020 the V8 project authors. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
#ifndef INCLUDE_CPPGC_INTERNAL_FINALIZER_TRAIT_H_
|
|
6
|
+
#define INCLUDE_CPPGC_INTERNAL_FINALIZER_TRAIT_H_
|
|
7
|
+
|
|
8
|
+
#include <type_traits>
|
|
9
|
+
|
|
10
|
+
#include "cppgc/type-traits.h"
|
|
11
|
+
|
|
12
|
+
namespace cppgc {
|
|
13
|
+
namespace internal {
|
|
14
|
+
|
|
15
|
+
using FinalizationCallback = void (*)(void*);
|
|
16
|
+
|
|
17
|
+
template <typename T, typename = void>
|
|
18
|
+
struct HasFinalizeGarbageCollectedObject : std::false_type {};
|
|
19
|
+
|
|
20
|
+
template <typename T>
|
|
21
|
+
struct HasFinalizeGarbageCollectedObject<
|
|
22
|
+
T,
|
|
23
|
+
std::void_t<decltype(std::declval<T>().FinalizeGarbageCollectedObject())>>
|
|
24
|
+
: std::true_type {};
|
|
25
|
+
|
|
26
|
+
// The FinalizerTraitImpl specifies how to finalize objects.
|
|
27
|
+
template <typename T, bool isFinalized>
|
|
28
|
+
struct FinalizerTraitImpl;
|
|
29
|
+
|
|
30
|
+
template <typename T>
|
|
31
|
+
struct FinalizerTraitImpl<T, true> {
|
|
32
|
+
private:
|
|
33
|
+
// Dispatch to custom FinalizeGarbageCollectedObject().
|
|
34
|
+
struct Custom {
|
|
35
|
+
static void Call(void* obj) {
|
|
36
|
+
static_cast<T*>(obj)->FinalizeGarbageCollectedObject();
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// Dispatch to regular destructor.
|
|
41
|
+
struct Destructor {
|
|
42
|
+
static void Call(void* obj) { static_cast<T*>(obj)->~T(); }
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
using FinalizeImpl =
|
|
46
|
+
std::conditional_t<HasFinalizeGarbageCollectedObject<T>::value, Custom,
|
|
47
|
+
Destructor>;
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
static void Finalize(void* obj) {
|
|
51
|
+
static_assert(sizeof(T), "T must be fully defined");
|
|
52
|
+
FinalizeImpl::Call(obj);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
template <typename T>
|
|
57
|
+
struct FinalizerTraitImpl<T, false> {
|
|
58
|
+
static void Finalize(void* obj) {
|
|
59
|
+
static_assert(sizeof(T), "T must be fully defined");
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// The FinalizerTrait is used to determine if a type requires finalization and
|
|
64
|
+
// what finalization means.
|
|
65
|
+
template <typename T>
|
|
66
|
+
struct FinalizerTrait {
|
|
67
|
+
private:
|
|
68
|
+
// Object has a finalizer if it has
|
|
69
|
+
// - a custom FinalizeGarbageCollectedObject method, or
|
|
70
|
+
// - a destructor.
|
|
71
|
+
static constexpr bool kNonTrivialFinalizer =
|
|
72
|
+
internal::HasFinalizeGarbageCollectedObject<T>::value ||
|
|
73
|
+
!std::is_trivially_destructible_v<std::remove_cv_t<T>>;
|
|
74
|
+
|
|
75
|
+
static void Finalize(void* obj) {
|
|
76
|
+
internal::FinalizerTraitImpl<T, kNonTrivialFinalizer>::Finalize(obj);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
public:
|
|
80
|
+
static constexpr bool HasFinalizer() { return kNonTrivialFinalizer; }
|
|
81
|
+
|
|
82
|
+
// The callback used to finalize an object of type T.
|
|
83
|
+
static constexpr FinalizationCallback kCallback =
|
|
84
|
+
kNonTrivialFinalizer ? Finalize : nullptr;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
template <typename T>
|
|
88
|
+
constexpr FinalizationCallback FinalizerTrait<T>::kCallback;
|
|
89
|
+
|
|
90
|
+
} // namespace internal
|
|
91
|
+
} // namespace cppgc
|
|
92
|
+
|
|
93
|
+
#endif // INCLUDE_CPPGC_INTERNAL_FINALIZER_TRAIT_H_
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
// Copyright 2020 the V8 project authors. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
#ifndef INCLUDE_CPPGC_INTERNAL_GC_INFO_H_
|
|
6
|
+
#define INCLUDE_CPPGC_INTERNAL_GC_INFO_H_
|
|
7
|
+
|
|
8
|
+
#include <atomic>
|
|
9
|
+
#include <cstdint>
|
|
10
|
+
#include <type_traits>
|
|
11
|
+
|
|
12
|
+
#include "cppgc/internal/finalizer-trait.h"
|
|
13
|
+
#include "cppgc/internal/logging.h"
|
|
14
|
+
#include "cppgc/internal/name-trait.h"
|
|
15
|
+
#include "cppgc/trace-trait.h"
|
|
16
|
+
#include "v8config.h" // NOLINT(build/include_directory)
|
|
17
|
+
|
|
18
|
+
namespace cppgc {
|
|
19
|
+
namespace internal {
|
|
20
|
+
|
|
21
|
+
using GCInfoIndex = uint16_t;
|
|
22
|
+
|
|
23
|
+
struct V8_EXPORT EnsureGCInfoIndexTrait final {
|
|
24
|
+
// Acquires a new GC info object and updates `registered_index` with the index
|
|
25
|
+
// that identifies that new info accordingly.
|
|
26
|
+
template <typename T>
|
|
27
|
+
V8_INLINE static GCInfoIndex EnsureIndex(
|
|
28
|
+
std::atomic<GCInfoIndex>& registered_index) {
|
|
29
|
+
return EnsureGCInfoIndexTraitDispatch<T>{}(registered_index);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
private:
|
|
33
|
+
template <typename T, bool = FinalizerTrait<T>::HasFinalizer(),
|
|
34
|
+
bool = NameTrait<T>::HasNonHiddenName()>
|
|
35
|
+
struct EnsureGCInfoIndexTraitDispatch;
|
|
36
|
+
|
|
37
|
+
static GCInfoIndex V8_PRESERVE_MOST
|
|
38
|
+
EnsureGCInfoIndex(std::atomic<GCInfoIndex>&, TraceCallback,
|
|
39
|
+
FinalizationCallback, NameCallback);
|
|
40
|
+
static GCInfoIndex V8_PRESERVE_MOST EnsureGCInfoIndex(
|
|
41
|
+
std::atomic<GCInfoIndex>&, TraceCallback, FinalizationCallback);
|
|
42
|
+
static GCInfoIndex V8_PRESERVE_MOST
|
|
43
|
+
EnsureGCInfoIndex(std::atomic<GCInfoIndex>&, TraceCallback, NameCallback);
|
|
44
|
+
static GCInfoIndex V8_PRESERVE_MOST
|
|
45
|
+
EnsureGCInfoIndex(std::atomic<GCInfoIndex>&, TraceCallback);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
#define DISPATCH(has_finalizer, has_non_hidden_name, function) \
|
|
49
|
+
template <typename T> \
|
|
50
|
+
struct EnsureGCInfoIndexTrait::EnsureGCInfoIndexTraitDispatch< \
|
|
51
|
+
T, has_finalizer, has_non_hidden_name> { \
|
|
52
|
+
V8_INLINE GCInfoIndex \
|
|
53
|
+
operator()(std::atomic<GCInfoIndex>& registered_index) { \
|
|
54
|
+
return function; \
|
|
55
|
+
} \
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// ------------------------------------------------------- //
|
|
59
|
+
// DISPATCH(has_finalizer, has_non_hidden_name, function) //
|
|
60
|
+
// ------------------------------------------------------- //
|
|
61
|
+
DISPATCH(true, true, //
|
|
62
|
+
EnsureGCInfoIndex(registered_index, //
|
|
63
|
+
TraceTrait<T>::Trace, //
|
|
64
|
+
FinalizerTrait<T>::kCallback, //
|
|
65
|
+
NameTrait<T>::GetName)) //
|
|
66
|
+
DISPATCH(true, false, //
|
|
67
|
+
EnsureGCInfoIndex(registered_index, //
|
|
68
|
+
TraceTrait<T>::Trace, //
|
|
69
|
+
FinalizerTrait<T>::kCallback)) //
|
|
70
|
+
DISPATCH(false, true, //
|
|
71
|
+
EnsureGCInfoIndex(registered_index, //
|
|
72
|
+
TraceTrait<T>::Trace, //
|
|
73
|
+
NameTrait<T>::GetName)) //
|
|
74
|
+
DISPATCH(false, false, //
|
|
75
|
+
EnsureGCInfoIndex(registered_index, //
|
|
76
|
+
TraceTrait<T>::Trace)) //
|
|
77
|
+
|
|
78
|
+
#undef DISPATCH
|
|
79
|
+
|
|
80
|
+
// Trait determines how the garbage collector treats objects wrt. to traversing,
|
|
81
|
+
// finalization, and naming.
|
|
82
|
+
template <typename T>
|
|
83
|
+
struct GCInfoTrait final {
|
|
84
|
+
V8_INLINE static GCInfoIndex Index() {
|
|
85
|
+
static_assert(sizeof(T), "T must be fully defined");
|
|
86
|
+
static std::atomic<GCInfoIndex>
|
|
87
|
+
registered_index; // Uses zero initialization.
|
|
88
|
+
GCInfoIndex index = registered_index.load(std::memory_order_acquire);
|
|
89
|
+
if (V8_UNLIKELY(!index)) {
|
|
90
|
+
index = EnsureGCInfoIndexTrait::EnsureIndex<T>(registered_index);
|
|
91
|
+
CPPGC_DCHECK(index != 0);
|
|
92
|
+
CPPGC_DCHECK(index == registered_index.load(std::memory_order_acquire));
|
|
93
|
+
}
|
|
94
|
+
return index;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
static constexpr void CheckCallbacksAreDefined() {
|
|
98
|
+
// No USE() macro available.
|
|
99
|
+
(void)static_cast<TraceCallback>(TraceTrait<T>::Trace);
|
|
100
|
+
(void)static_cast<FinalizationCallback>(FinalizerTrait<T>::kCallback);
|
|
101
|
+
(void)static_cast<NameCallback>(NameTrait<T>::GetName);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
// Fold types based on finalizer behavior. Note that finalizer characteristics
|
|
106
|
+
// align with trace behavior, i.e., destructors are virtual when trace methods
|
|
107
|
+
// are and vice versa.
|
|
108
|
+
template <typename T, typename ParentMostGarbageCollectedType>
|
|
109
|
+
struct GCInfoFolding final {
|
|
110
|
+
static constexpr bool kHasVirtualDestructorAtBase =
|
|
111
|
+
std::has_virtual_destructor_v<ParentMostGarbageCollectedType>;
|
|
112
|
+
static constexpr bool kBothTypesAreTriviallyDestructible =
|
|
113
|
+
std::is_trivially_destructible_v<ParentMostGarbageCollectedType> &&
|
|
114
|
+
std::is_trivially_destructible_v<T>;
|
|
115
|
+
static constexpr bool kHasCustomFinalizerDispatchAtBase =
|
|
116
|
+
internal::HasFinalizeGarbageCollectedObject<
|
|
117
|
+
ParentMostGarbageCollectedType>::value;
|
|
118
|
+
#ifdef CPPGC_SUPPORTS_OBJECT_NAMES
|
|
119
|
+
static constexpr bool kWantsDetailedObjectNames = true;
|
|
120
|
+
#else // !CPPGC_SUPPORTS_OBJECT_NAMES
|
|
121
|
+
static constexpr bool kWantsDetailedObjectNames = false;
|
|
122
|
+
#endif // !CPPGC_SUPPORTS_OBJECT_NAMES
|
|
123
|
+
|
|
124
|
+
// Always true. Forces the compiler to resolve callbacks which ensures that
|
|
125
|
+
// both modes don't break without requiring compiling a separate
|
|
126
|
+
// configuration. Only a single GCInfo (for `ResultType` below) will actually
|
|
127
|
+
// be instantiated but existence (and well-formedness) of all callbacks is
|
|
128
|
+
// checked.
|
|
129
|
+
static constexpr bool WantToFold() {
|
|
130
|
+
if constexpr ((kHasVirtualDestructorAtBase ||
|
|
131
|
+
kBothTypesAreTriviallyDestructible ||
|
|
132
|
+
kHasCustomFinalizerDispatchAtBase) &&
|
|
133
|
+
!kWantsDetailedObjectNames) {
|
|
134
|
+
GCInfoTrait<T>::CheckCallbacksAreDefined();
|
|
135
|
+
GCInfoTrait<ParentMostGarbageCollectedType>::CheckCallbacksAreDefined();
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Folding would regress name resolution when deriving names from C++
|
|
142
|
+
// class names as it would just folds a name to the base class name.
|
|
143
|
+
using ResultType =
|
|
144
|
+
std::conditional_t<WantToFold(), ParentMostGarbageCollectedType, T>;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
} // namespace internal
|
|
148
|
+
} // namespace cppgc
|
|
149
|
+
|
|
150
|
+
#endif // INCLUDE_CPPGC_INTERNAL_GC_INFO_H_
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Copyright 2020 the V8 project authors. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
#ifndef INCLUDE_CPPGC_INTERNAL_LOGGING_H_
|
|
6
|
+
#define INCLUDE_CPPGC_INTERNAL_LOGGING_H_
|
|
7
|
+
|
|
8
|
+
#include "cppgc/source-location.h"
|
|
9
|
+
#include "v8config.h" // NOLINT(build/include_directory)
|
|
10
|
+
|
|
11
|
+
namespace cppgc {
|
|
12
|
+
namespace internal {
|
|
13
|
+
|
|
14
|
+
void V8_EXPORT DCheckImpl(const char*,
|
|
15
|
+
SourceLocation = SourceLocation::Current());
|
|
16
|
+
[[noreturn]] void V8_EXPORT
|
|
17
|
+
FatalImpl(const char*, SourceLocation = SourceLocation::Current());
|
|
18
|
+
|
|
19
|
+
// Used to ignore -Wunused-variable.
|
|
20
|
+
template <typename>
|
|
21
|
+
struct EatParams {};
|
|
22
|
+
|
|
23
|
+
#ifdef CPPGC_ENABLE_API_CHECKS
|
|
24
|
+
#define CPPGC_DCHECK_MSG(condition, message) \
|
|
25
|
+
do { \
|
|
26
|
+
if (V8_UNLIKELY(!(condition))) { \
|
|
27
|
+
::cppgc::internal::DCheckImpl(message); \
|
|
28
|
+
} \
|
|
29
|
+
} while (false)
|
|
30
|
+
#else // !CPPGC_ENABLE_API_CHECKS
|
|
31
|
+
#define CPPGC_DCHECK_MSG(condition, message) \
|
|
32
|
+
(static_cast<void>(::cppgc::internal::EatParams<decltype( \
|
|
33
|
+
static_cast<void>(condition), message)>{}))
|
|
34
|
+
#endif // !CPPGC_ENABLE_API_CHECKS
|
|
35
|
+
|
|
36
|
+
#define CPPGC_DCHECK(condition) CPPGC_DCHECK_MSG(condition, #condition)
|
|
37
|
+
|
|
38
|
+
#define CPPGC_CHECK_MSG(condition, message) \
|
|
39
|
+
do { \
|
|
40
|
+
if (V8_UNLIKELY(!(condition))) { \
|
|
41
|
+
::cppgc::internal::FatalImpl(message); \
|
|
42
|
+
} \
|
|
43
|
+
} while (false)
|
|
44
|
+
|
|
45
|
+
#define CPPGC_CHECK(condition) CPPGC_CHECK_MSG(condition, #condition)
|
|
46
|
+
|
|
47
|
+
} // namespace internal
|
|
48
|
+
} // namespace cppgc
|
|
49
|
+
|
|
50
|
+
#endif // INCLUDE_CPPGC_INTERNAL_LOGGING_H_
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
// Copyright 2022 the V8 project authors. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
#ifndef INCLUDE_CPPGC_INTERNAL_MEMBER_STORAGE_H_
|
|
6
|
+
#define INCLUDE_CPPGC_INTERNAL_MEMBER_STORAGE_H_
|
|
7
|
+
|
|
8
|
+
#include <atomic>
|
|
9
|
+
#include <cstddef>
|
|
10
|
+
#include <type_traits>
|
|
11
|
+
|
|
12
|
+
#include "cppgc/internal/api-constants.h"
|
|
13
|
+
#include "cppgc/internal/caged-heap.h"
|
|
14
|
+
#include "cppgc/internal/logging.h"
|
|
15
|
+
#include "cppgc/sentinel-pointer.h"
|
|
16
|
+
#include "v8config.h" // NOLINT(build/include_directory)
|
|
17
|
+
|
|
18
|
+
namespace cppgc {
|
|
19
|
+
namespace internal {
|
|
20
|
+
|
|
21
|
+
enum class WriteBarrierSlotType {
|
|
22
|
+
kCompressed,
|
|
23
|
+
kUncompressed,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
#if defined(CPPGC_POINTER_COMPRESSION)
|
|
27
|
+
|
|
28
|
+
#if defined(__clang__)
|
|
29
|
+
// Attribute const allows the compiler to assume that CageBaseGlobal::g_base_
|
|
30
|
+
// doesn't change (e.g. across calls) and thereby avoid redundant loads.
|
|
31
|
+
#define CPPGC_CONST __attribute__((const))
|
|
32
|
+
#define CPPGC_REQUIRE_CONSTANT_INIT \
|
|
33
|
+
__attribute__((require_constant_initialization))
|
|
34
|
+
#else // defined(__clang__)
|
|
35
|
+
#define CPPGC_CONST
|
|
36
|
+
#define CPPGC_REQUIRE_CONSTANT_INIT
|
|
37
|
+
#endif // defined(__clang__)
|
|
38
|
+
|
|
39
|
+
class V8_EXPORT CageBaseGlobal final {
|
|
40
|
+
public:
|
|
41
|
+
V8_INLINE CPPGC_CONST static uintptr_t Get() {
|
|
42
|
+
CPPGC_DCHECK(IsBaseConsistent());
|
|
43
|
+
return g_base_.base;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
V8_INLINE CPPGC_CONST static bool IsSet() {
|
|
47
|
+
CPPGC_DCHECK(IsBaseConsistent());
|
|
48
|
+
return (g_base_.base & ~kLowerHalfWordMask) != 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
private:
|
|
52
|
+
// We keep the lower halfword as ones to speed up decompression.
|
|
53
|
+
static constexpr uintptr_t kLowerHalfWordMask =
|
|
54
|
+
(api_constants::kCagedHeapReservationAlignment - 1);
|
|
55
|
+
|
|
56
|
+
static union alignas(api_constants::kCachelineSize) Base {
|
|
57
|
+
uintptr_t base;
|
|
58
|
+
char cache_line[api_constants::kCachelineSize];
|
|
59
|
+
} g_base_ CPPGC_REQUIRE_CONSTANT_INIT;
|
|
60
|
+
|
|
61
|
+
CageBaseGlobal() = delete;
|
|
62
|
+
|
|
63
|
+
V8_INLINE static bool IsBaseConsistent() {
|
|
64
|
+
return kLowerHalfWordMask == (g_base_.base & kLowerHalfWordMask);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
friend class CageBaseGlobalUpdater;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
#undef CPPGC_REQUIRE_CONSTANT_INIT
|
|
71
|
+
#undef CPPGC_CONST
|
|
72
|
+
|
|
73
|
+
class V8_TRIVIAL_ABI CompressedPointer final {
|
|
74
|
+
public:
|
|
75
|
+
struct AtomicInitializerTag {};
|
|
76
|
+
|
|
77
|
+
using IntegralType = uint32_t;
|
|
78
|
+
static constexpr auto kWriteBarrierSlotType =
|
|
79
|
+
WriteBarrierSlotType::kCompressed;
|
|
80
|
+
|
|
81
|
+
V8_INLINE CompressedPointer() : value_(0u) {}
|
|
82
|
+
V8_INLINE explicit CompressedPointer(const void* value,
|
|
83
|
+
AtomicInitializerTag) {
|
|
84
|
+
StoreAtomic(value);
|
|
85
|
+
}
|
|
86
|
+
V8_INLINE explicit CompressedPointer(const void* ptr)
|
|
87
|
+
: value_(Compress(ptr)) {}
|
|
88
|
+
V8_INLINE explicit CompressedPointer(std::nullptr_t) : value_(0u) {}
|
|
89
|
+
V8_INLINE explicit CompressedPointer(SentinelPointer)
|
|
90
|
+
: value_(kCompressedSentinel) {}
|
|
91
|
+
|
|
92
|
+
V8_INLINE const void* Load() const { return Decompress(value_); }
|
|
93
|
+
V8_INLINE const void* LoadAtomic() const {
|
|
94
|
+
return Decompress(
|
|
95
|
+
reinterpret_cast<const std::atomic<IntegralType>&>(value_).load(
|
|
96
|
+
std::memory_order_relaxed));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
V8_INLINE void Store(const void* ptr) { value_ = Compress(ptr); }
|
|
100
|
+
V8_INLINE void StoreAtomic(const void* value) {
|
|
101
|
+
reinterpret_cast<std::atomic<IntegralType>&>(value_).store(
|
|
102
|
+
Compress(value), std::memory_order_relaxed);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
V8_INLINE void Clear() { value_ = 0u; }
|
|
106
|
+
V8_INLINE bool IsCleared() const { return !value_; }
|
|
107
|
+
|
|
108
|
+
V8_INLINE bool IsSentinel() const { return value_ == kCompressedSentinel; }
|
|
109
|
+
|
|
110
|
+
V8_INLINE uint32_t GetAsInteger() const { return value_; }
|
|
111
|
+
|
|
112
|
+
V8_INLINE friend bool operator==(CompressedPointer a, CompressedPointer b) {
|
|
113
|
+
return a.value_ == b.value_;
|
|
114
|
+
}
|
|
115
|
+
V8_INLINE friend bool operator!=(CompressedPointer a, CompressedPointer b) {
|
|
116
|
+
return a.value_ != b.value_;
|
|
117
|
+
}
|
|
118
|
+
V8_INLINE friend bool operator<(CompressedPointer a, CompressedPointer b) {
|
|
119
|
+
return a.value_ < b.value_;
|
|
120
|
+
}
|
|
121
|
+
V8_INLINE friend bool operator<=(CompressedPointer a, CompressedPointer b) {
|
|
122
|
+
return a.value_ <= b.value_;
|
|
123
|
+
}
|
|
124
|
+
V8_INLINE friend bool operator>(CompressedPointer a, CompressedPointer b) {
|
|
125
|
+
return a.value_ > b.value_;
|
|
126
|
+
}
|
|
127
|
+
V8_INLINE friend bool operator>=(CompressedPointer a, CompressedPointer b) {
|
|
128
|
+
return a.value_ >= b.value_;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
static V8_INLINE IntegralType Compress(const void* ptr) {
|
|
132
|
+
static_assert(SentinelPointer::kSentinelValue ==
|
|
133
|
+
1 << api_constants::kPointerCompressionShift,
|
|
134
|
+
"The compression scheme relies on the sentinel encoded as 1 "
|
|
135
|
+
"<< kPointerCompressionShift");
|
|
136
|
+
static constexpr size_t kGigaCageMask =
|
|
137
|
+
~(api_constants::kCagedHeapReservationAlignment - 1);
|
|
138
|
+
static constexpr size_t kPointerCompressionShiftMask =
|
|
139
|
+
(1 << api_constants::kPointerCompressionShift) - 1;
|
|
140
|
+
|
|
141
|
+
CPPGC_DCHECK(CageBaseGlobal::IsSet());
|
|
142
|
+
const uintptr_t base = CageBaseGlobal::Get();
|
|
143
|
+
CPPGC_DCHECK(!ptr || ptr == kSentinelPointer ||
|
|
144
|
+
(base & kGigaCageMask) ==
|
|
145
|
+
(reinterpret_cast<uintptr_t>(ptr) & kGigaCageMask));
|
|
146
|
+
CPPGC_DCHECK(
|
|
147
|
+
(reinterpret_cast<uintptr_t>(ptr) & kPointerCompressionShiftMask) == 0);
|
|
148
|
+
|
|
149
|
+
const auto uptr = reinterpret_cast<uintptr_t>(ptr);
|
|
150
|
+
// Shift the pointer and truncate.
|
|
151
|
+
auto compressed = static_cast<IntegralType>(
|
|
152
|
+
uptr >> api_constants::kPointerCompressionShift);
|
|
153
|
+
// Normal compressed pointers must have the MSB set. This is guaranteed by
|
|
154
|
+
// the cage alignment.
|
|
155
|
+
CPPGC_DCHECK((!compressed || compressed == kCompressedSentinel) ||
|
|
156
|
+
(compressed & (1 << 31)));
|
|
157
|
+
return compressed;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
static V8_INLINE void* Decompress(IntegralType ptr) {
|
|
161
|
+
CPPGC_DCHECK(CageBaseGlobal::IsSet());
|
|
162
|
+
const uintptr_t base = CageBaseGlobal::Get();
|
|
163
|
+
return Decompress(ptr, base);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
static V8_INLINE void* Decompress(IntegralType ptr, uintptr_t base) {
|
|
167
|
+
CPPGC_DCHECK(CageBaseGlobal::IsSet());
|
|
168
|
+
CPPGC_DCHECK(base == CageBaseGlobal::Get());
|
|
169
|
+
// Sign-extend compressed pointer to full width. This ensure that normal
|
|
170
|
+
// pointers have only 1s in the base part of the address. It's also
|
|
171
|
+
// important to shift the unsigned value, as otherwise it would result in
|
|
172
|
+
// undefined behavior.
|
|
173
|
+
const uint64_t mask = static_cast<uint64_t>(static_cast<int32_t>(ptr))
|
|
174
|
+
<< api_constants::kPointerCompressionShift;
|
|
175
|
+
// Set the base part of the address for normal compressed pointers. Note
|
|
176
|
+
// that nullptr and the sentinel value do not have 1s in the base part and
|
|
177
|
+
// remain as-is in this operation.
|
|
178
|
+
return reinterpret_cast<void*>(mask & base);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// For a given memory `address`, this method iterates all possible pointers
|
|
182
|
+
// that can be reasonably recovered with the current compression scheme and
|
|
183
|
+
// passes them to `callback`.
|
|
184
|
+
template <typename Callback>
|
|
185
|
+
static V8_INLINE void VisitPossiblePointers(const void* address,
|
|
186
|
+
Callback callback);
|
|
187
|
+
|
|
188
|
+
private:
|
|
189
|
+
static constexpr IntegralType kCompressedSentinel =
|
|
190
|
+
SentinelPointer::kSentinelValue >>
|
|
191
|
+
api_constants::kPointerCompressionShift;
|
|
192
|
+
// All constructors initialize `value_`. Do not add a default value here as it
|
|
193
|
+
// results in a non-atomic write on some builds, even when the atomic version
|
|
194
|
+
// of the constructor is used.
|
|
195
|
+
IntegralType value_;
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
template <typename Callback>
|
|
199
|
+
// static
|
|
200
|
+
void CompressedPointer::VisitPossiblePointers(const void* address,
|
|
201
|
+
Callback callback) {
|
|
202
|
+
const uintptr_t base = CageBaseGlobal::Get();
|
|
203
|
+
CPPGC_DCHECK(base);
|
|
204
|
+
// We may have random compressed pointers on stack (e.g. due to inlined
|
|
205
|
+
// collections). These could be present in both halfwords.
|
|
206
|
+
const uint32_t compressed_low =
|
|
207
|
+
static_cast<uint32_t>(reinterpret_cast<uintptr_t>(address));
|
|
208
|
+
callback(CompressedPointer::Decompress(compressed_low, base));
|
|
209
|
+
const uint32_t compressed_high = static_cast<uint32_t>(
|
|
210
|
+
reinterpret_cast<uintptr_t>(address) >> (sizeof(uint32_t) * CHAR_BIT));
|
|
211
|
+
callback(CompressedPointer::Decompress(compressed_high, base));
|
|
212
|
+
// Iterate possible intermediate values, see `Decompress()`. The intermediate
|
|
213
|
+
// value of decompressing is a 64-bit value where 35 bits are the offset. We
|
|
214
|
+
// don't assume sign extension is stored and recover that part.
|
|
215
|
+
//
|
|
216
|
+
// Note that this case conveniently also recovers the full pointer.
|
|
217
|
+
static constexpr uintptr_t kBitForIntermediateValue =
|
|
218
|
+
(sizeof(uint32_t) * CHAR_BIT) + api_constants::kPointerCompressionShift;
|
|
219
|
+
static constexpr uintptr_t kSignExtensionMask =
|
|
220
|
+
~((uintptr_t{1} << kBitForIntermediateValue) - 1);
|
|
221
|
+
const uintptr_t intermediate_sign_extended =
|
|
222
|
+
reinterpret_cast<uintptr_t>(address) | kSignExtensionMask;
|
|
223
|
+
callback(reinterpret_cast<void*>(intermediate_sign_extended & base));
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
#endif // defined(CPPGC_POINTER_COMPRESSION)
|
|
227
|
+
|
|
228
|
+
class V8_TRIVIAL_ABI RawPointer final {
|
|
229
|
+
public:
|
|
230
|
+
struct AtomicInitializerTag {};
|
|
231
|
+
|
|
232
|
+
using IntegralType = uintptr_t;
|
|
233
|
+
static constexpr auto kWriteBarrierSlotType =
|
|
234
|
+
WriteBarrierSlotType::kUncompressed;
|
|
235
|
+
|
|
236
|
+
V8_INLINE RawPointer() : ptr_(nullptr) {}
|
|
237
|
+
V8_INLINE explicit RawPointer(const void* ptr, AtomicInitializerTag) {
|
|
238
|
+
StoreAtomic(ptr);
|
|
239
|
+
}
|
|
240
|
+
V8_INLINE explicit RawPointer(const void* ptr) : ptr_(ptr) {}
|
|
241
|
+
|
|
242
|
+
V8_INLINE const void* Load() const { return ptr_; }
|
|
243
|
+
V8_INLINE const void* LoadAtomic() const {
|
|
244
|
+
return reinterpret_cast<const std::atomic<const void*>&>(ptr_).load(
|
|
245
|
+
std::memory_order_relaxed);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
V8_INLINE void Store(const void* ptr) { ptr_ = ptr; }
|
|
249
|
+
V8_INLINE void StoreAtomic(const void* ptr) {
|
|
250
|
+
reinterpret_cast<std::atomic<const void*>&>(ptr_).store(
|
|
251
|
+
ptr, std::memory_order_relaxed);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
V8_INLINE void Clear() { ptr_ = nullptr; }
|
|
255
|
+
V8_INLINE bool IsCleared() const { return !ptr_; }
|
|
256
|
+
|
|
257
|
+
V8_INLINE bool IsSentinel() const { return ptr_ == kSentinelPointer; }
|
|
258
|
+
|
|
259
|
+
V8_INLINE uintptr_t GetAsInteger() const {
|
|
260
|
+
return reinterpret_cast<uintptr_t>(ptr_);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
V8_INLINE friend bool operator==(RawPointer a, RawPointer b) {
|
|
264
|
+
return a.ptr_ == b.ptr_;
|
|
265
|
+
}
|
|
266
|
+
V8_INLINE friend bool operator!=(RawPointer a, RawPointer b) {
|
|
267
|
+
return a.ptr_ != b.ptr_;
|
|
268
|
+
}
|
|
269
|
+
V8_INLINE friend bool operator<(RawPointer a, RawPointer b) {
|
|
270
|
+
return a.ptr_ < b.ptr_;
|
|
271
|
+
}
|
|
272
|
+
V8_INLINE friend bool operator<=(RawPointer a, RawPointer b) {
|
|
273
|
+
return a.ptr_ <= b.ptr_;
|
|
274
|
+
}
|
|
275
|
+
V8_INLINE friend bool operator>(RawPointer a, RawPointer b) {
|
|
276
|
+
return a.ptr_ > b.ptr_;
|
|
277
|
+
}
|
|
278
|
+
V8_INLINE friend bool operator>=(RawPointer a, RawPointer b) {
|
|
279
|
+
return a.ptr_ >= b.ptr_;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
template <typename Callback>
|
|
283
|
+
static V8_INLINE void VisitPossiblePointers(const void* address,
|
|
284
|
+
Callback callback) {
|
|
285
|
+
// Pass along the full pointer.
|
|
286
|
+
return callback(const_cast<void*>(address));
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
private:
|
|
290
|
+
// All constructors initialize `ptr_`. Do not add a default value here as it
|
|
291
|
+
// results in a non-atomic write on some builds, even when the atomic version
|
|
292
|
+
// of the constructor is used.
|
|
293
|
+
const void* ptr_;
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
#if defined(CPPGC_POINTER_COMPRESSION)
|
|
297
|
+
using DefaultMemberStorage = CompressedPointer;
|
|
298
|
+
#else // !defined(CPPGC_POINTER_COMPRESSION)
|
|
299
|
+
using DefaultMemberStorage = RawPointer;
|
|
300
|
+
#endif // !defined(CPPGC_POINTER_COMPRESSION)
|
|
301
|
+
|
|
302
|
+
} // namespace internal
|
|
303
|
+
} // namespace cppgc
|
|
304
|
+
|
|
305
|
+
#endif // INCLUDE_CPPGC_INTERNAL_MEMBER_STORAGE_H_
|