libv8-node 16.10.0.0-arm64-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/ext/libv8-node/.location.yml +1 -0
- data/ext/libv8-node/location.rb +76 -0
- data/ext/libv8-node/paths.rb +34 -0
- data/lib/libv8/node/version.rb +7 -0
- data/lib/libv8/node.rb +11 -0
- data/lib/libv8-node.rb +1 -0
- data/vendor/v8/arm64-darwin/libv8/obj/libv8_monolith.a +0 -0
- data/vendor/v8/include/cppgc/allocation.h +232 -0
- data/vendor/v8/include/cppgc/common.h +29 -0
- data/vendor/v8/include/cppgc/cross-thread-persistent.h +384 -0
- data/vendor/v8/include/cppgc/custom-space.h +97 -0
- data/vendor/v8/include/cppgc/default-platform.h +75 -0
- data/vendor/v8/include/cppgc/ephemeron-pair.h +30 -0
- data/vendor/v8/include/cppgc/explicit-management.h +82 -0
- data/vendor/v8/include/cppgc/garbage-collected.h +117 -0
- data/vendor/v8/include/cppgc/heap-consistency.h +236 -0
- data/vendor/v8/include/cppgc/heap-state.h +70 -0
- data/vendor/v8/include/cppgc/heap-statistics.h +120 -0
- data/vendor/v8/include/cppgc/heap.h +201 -0
- data/vendor/v8/include/cppgc/internal/api-constants.h +47 -0
- data/vendor/v8/include/cppgc/internal/atomic-entry-flag.h +48 -0
- data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +68 -0
- data/vendor/v8/include/cppgc/internal/compiler-specific.h +38 -0
- data/vendor/v8/include/cppgc/internal/finalizer-trait.h +90 -0
- data/vendor/v8/include/cppgc/internal/gc-info.h +76 -0
- data/vendor/v8/include/cppgc/internal/logging.h +50 -0
- data/vendor/v8/include/cppgc/internal/name-trait.h +111 -0
- data/vendor/v8/include/cppgc/internal/persistent-node.h +172 -0
- data/vendor/v8/include/cppgc/internal/pointer-policies.h +175 -0
- data/vendor/v8/include/cppgc/internal/prefinalizer-handler.h +30 -0
- data/vendor/v8/include/cppgc/internal/write-barrier.h +396 -0
- data/vendor/v8/include/cppgc/liveness-broker.h +74 -0
- data/vendor/v8/include/cppgc/macros.h +26 -0
- data/vendor/v8/include/cppgc/member.h +286 -0
- data/vendor/v8/include/cppgc/name-provider.h +65 -0
- data/vendor/v8/include/cppgc/object-size-trait.h +58 -0
- data/vendor/v8/include/cppgc/persistent.h +365 -0
- data/vendor/v8/include/cppgc/platform.h +153 -0
- data/vendor/v8/include/cppgc/prefinalizer.h +52 -0
- data/vendor/v8/include/cppgc/process-heap-statistics.h +36 -0
- data/vendor/v8/include/cppgc/sentinel-pointer.h +32 -0
- data/vendor/v8/include/cppgc/source-location.h +92 -0
- data/vendor/v8/include/cppgc/testing.h +99 -0
- data/vendor/v8/include/cppgc/trace-trait.h +116 -0
- data/vendor/v8/include/cppgc/type-traits.h +247 -0
- data/vendor/v8/include/cppgc/visitor.h +377 -0
- data/vendor/v8/include/libplatform/libplatform-export.h +29 -0
- data/vendor/v8/include/libplatform/libplatform.h +117 -0
- data/vendor/v8/include/libplatform/v8-tracing.h +334 -0
- data/vendor/v8/include/v8-cppgc.h +325 -0
- data/vendor/v8/include/v8-fast-api-calls.h +791 -0
- data/vendor/v8/include/v8-inspector-protocol.h +13 -0
- data/vendor/v8/include/v8-inspector.h +348 -0
- data/vendor/v8/include/v8-internal.h +499 -0
- data/vendor/v8/include/v8-metrics.h +202 -0
- data/vendor/v8/include/v8-platform.h +709 -0
- data/vendor/v8/include/v8-profiler.h +1123 -0
- data/vendor/v8/include/v8-unwinder-state.h +30 -0
- data/vendor/v8/include/v8-util.h +652 -0
- data/vendor/v8/include/v8-value-serializer-version.h +24 -0
- data/vendor/v8/include/v8-version-string.h +38 -0
- data/vendor/v8/include/v8-version.h +20 -0
- data/vendor/v8/include/v8-wasm-trap-handler-posix.h +31 -0
- data/vendor/v8/include/v8-wasm-trap-handler-win.h +28 -0
- data/vendor/v8/include/v8.h +12648 -0
- data/vendor/v8/include/v8config.h +515 -0
- metadata +138 -0
@@ -0,0 +1,111 @@
|
|
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_NAME_TRAIT_H_
|
6
|
+
#define INCLUDE_CPPGC_INTERNAL_NAME_TRAIT_H_
|
7
|
+
|
8
|
+
#include <cstddef>
|
9
|
+
|
10
|
+
#include "cppgc/name-provider.h"
|
11
|
+
#include "v8config.h" // NOLINT(build/include_directory)
|
12
|
+
|
13
|
+
namespace cppgc {
|
14
|
+
namespace internal {
|
15
|
+
|
16
|
+
#if CPPGC_SUPPORTS_OBJECT_NAMES && defined(__clang__)
|
17
|
+
#define CPPGC_SUPPORTS_COMPILE_TIME_TYPENAME 1
|
18
|
+
|
19
|
+
// Provides constexpr c-string storage for a name of fixed |Size| characters.
|
20
|
+
// Automatically appends terminating 0 byte.
|
21
|
+
template <size_t Size>
|
22
|
+
struct NameBuffer {
|
23
|
+
char name[Size + 1]{};
|
24
|
+
|
25
|
+
static constexpr NameBuffer FromCString(const char* str) {
|
26
|
+
NameBuffer result;
|
27
|
+
for (size_t i = 0; i < Size; ++i) result.name[i] = str[i];
|
28
|
+
result.name[Size] = 0;
|
29
|
+
return result;
|
30
|
+
}
|
31
|
+
};
|
32
|
+
|
33
|
+
template <typename T>
|
34
|
+
const char* GetTypename() {
|
35
|
+
static constexpr char kSelfPrefix[] =
|
36
|
+
"const char *cppgc::internal::GetTypename() [T =";
|
37
|
+
static_assert(__builtin_strncmp(__PRETTY_FUNCTION__, kSelfPrefix,
|
38
|
+
sizeof(kSelfPrefix) - 1) == 0,
|
39
|
+
"The prefix must match");
|
40
|
+
static constexpr const char* kTypenameStart =
|
41
|
+
__PRETTY_FUNCTION__ + sizeof(kSelfPrefix);
|
42
|
+
static constexpr size_t kTypenameSize =
|
43
|
+
__builtin_strlen(__PRETTY_FUNCTION__) - sizeof(kSelfPrefix) - 1;
|
44
|
+
// NameBuffer is an indirection that is needed to make sure that only a
|
45
|
+
// substring of __PRETTY_FUNCTION__ gets materialized in the binary.
|
46
|
+
static constexpr auto buffer =
|
47
|
+
NameBuffer<kTypenameSize>::FromCString(kTypenameStart);
|
48
|
+
return buffer.name;
|
49
|
+
}
|
50
|
+
|
51
|
+
#else
|
52
|
+
#define CPPGC_SUPPORTS_COMPILE_TIME_TYPENAME 0
|
53
|
+
#endif
|
54
|
+
|
55
|
+
struct HeapObjectName {
|
56
|
+
const char* value;
|
57
|
+
bool name_was_hidden;
|
58
|
+
};
|
59
|
+
|
60
|
+
class V8_EXPORT NameTraitBase {
|
61
|
+
protected:
|
62
|
+
static HeapObjectName GetNameFromTypeSignature(const char*);
|
63
|
+
};
|
64
|
+
|
65
|
+
// Trait that specifies how the garbage collector retrieves the name for a
|
66
|
+
// given object.
|
67
|
+
template <typename T>
|
68
|
+
class NameTrait final : public NameTraitBase {
|
69
|
+
public:
|
70
|
+
static HeapObjectName GetName(const void* obj) {
|
71
|
+
return GetNameFor(static_cast<const T*>(obj));
|
72
|
+
}
|
73
|
+
|
74
|
+
private:
|
75
|
+
static HeapObjectName GetNameFor(const NameProvider* name_provider) {
|
76
|
+
return {name_provider->GetHumanReadableName(), false};
|
77
|
+
}
|
78
|
+
|
79
|
+
static HeapObjectName GetNameFor(...) {
|
80
|
+
#if CPPGC_SUPPORTS_COMPILE_TIME_TYPENAME
|
81
|
+
return {GetTypename<T>(), false};
|
82
|
+
#elif CPPGC_SUPPORTS_OBJECT_NAMES
|
83
|
+
|
84
|
+
#if defined(V8_CC_GNU)
|
85
|
+
#define PRETTY_FUNCTION_VALUE __PRETTY_FUNCTION__
|
86
|
+
#elif defined(V8_CC_MSVC)
|
87
|
+
#define PRETTY_FUNCTION_VALUE __FUNCSIG__
|
88
|
+
#else
|
89
|
+
#define PRETTY_FUNCTION_VALUE nullptr
|
90
|
+
#endif
|
91
|
+
|
92
|
+
static const HeapObjectName leaky_name =
|
93
|
+
GetNameFromTypeSignature(PRETTY_FUNCTION_VALUE);
|
94
|
+
return {leaky_name, false};
|
95
|
+
|
96
|
+
#undef PRETTY_FUNCTION_VALUE
|
97
|
+
|
98
|
+
#else // !CPPGC_SUPPORTS_OBJECT_NAMES
|
99
|
+
return {NameProvider::kHiddenName, true};
|
100
|
+
#endif // !CPPGC_SUPPORTS_OBJECT_NAMES
|
101
|
+
}
|
102
|
+
};
|
103
|
+
|
104
|
+
using NameCallback = HeapObjectName (*)(const void*);
|
105
|
+
|
106
|
+
} // namespace internal
|
107
|
+
} // namespace cppgc
|
108
|
+
|
109
|
+
#undef CPPGC_SUPPORTS_COMPILE_TIME_TYPENAME
|
110
|
+
|
111
|
+
#endif // INCLUDE_CPPGC_INTERNAL_NAME_TRAIT_H_
|
@@ -0,0 +1,172 @@
|
|
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_PERSISTENT_NODE_H_
|
6
|
+
#define INCLUDE_CPPGC_INTERNAL_PERSISTENT_NODE_H_
|
7
|
+
|
8
|
+
#include <array>
|
9
|
+
#include <memory>
|
10
|
+
#include <vector>
|
11
|
+
|
12
|
+
#include "cppgc/internal/logging.h"
|
13
|
+
#include "cppgc/trace-trait.h"
|
14
|
+
#include "v8config.h" // NOLINT(build/include_directory)
|
15
|
+
|
16
|
+
namespace cppgc {
|
17
|
+
|
18
|
+
class Visitor;
|
19
|
+
|
20
|
+
namespace internal {
|
21
|
+
|
22
|
+
class CrossThreadPersistentRegion;
|
23
|
+
|
24
|
+
// PersistentNode represents a variant of two states:
|
25
|
+
// 1) traceable node with a back pointer to the Persistent object;
|
26
|
+
// 2) freelist entry.
|
27
|
+
class PersistentNode final {
|
28
|
+
public:
|
29
|
+
PersistentNode() = default;
|
30
|
+
|
31
|
+
PersistentNode(const PersistentNode&) = delete;
|
32
|
+
PersistentNode& operator=(const PersistentNode&) = delete;
|
33
|
+
|
34
|
+
void InitializeAsUsedNode(void* owner, TraceCallback trace) {
|
35
|
+
CPPGC_DCHECK(trace);
|
36
|
+
owner_ = owner;
|
37
|
+
trace_ = trace;
|
38
|
+
}
|
39
|
+
|
40
|
+
void InitializeAsFreeNode(PersistentNode* next) {
|
41
|
+
next_ = next;
|
42
|
+
trace_ = nullptr;
|
43
|
+
}
|
44
|
+
|
45
|
+
void UpdateOwner(void* owner) {
|
46
|
+
CPPGC_DCHECK(IsUsed());
|
47
|
+
owner_ = owner;
|
48
|
+
}
|
49
|
+
|
50
|
+
PersistentNode* FreeListNext() const {
|
51
|
+
CPPGC_DCHECK(!IsUsed());
|
52
|
+
return next_;
|
53
|
+
}
|
54
|
+
|
55
|
+
void Trace(Visitor* visitor) const {
|
56
|
+
CPPGC_DCHECK(IsUsed());
|
57
|
+
trace_(visitor, owner_);
|
58
|
+
}
|
59
|
+
|
60
|
+
bool IsUsed() const { return trace_; }
|
61
|
+
|
62
|
+
void* owner() const {
|
63
|
+
CPPGC_DCHECK(IsUsed());
|
64
|
+
return owner_;
|
65
|
+
}
|
66
|
+
|
67
|
+
private:
|
68
|
+
// PersistentNode acts as a designated union:
|
69
|
+
// If trace_ != nullptr, owner_ points to the corresponding Persistent handle.
|
70
|
+
// Otherwise, next_ points to the next freed PersistentNode.
|
71
|
+
union {
|
72
|
+
void* owner_ = nullptr;
|
73
|
+
PersistentNode* next_;
|
74
|
+
};
|
75
|
+
TraceCallback trace_ = nullptr;
|
76
|
+
};
|
77
|
+
|
78
|
+
class V8_EXPORT PersistentRegion final {
|
79
|
+
using PersistentNodeSlots = std::array<PersistentNode, 256u>;
|
80
|
+
|
81
|
+
public:
|
82
|
+
PersistentRegion() = default;
|
83
|
+
// Clears Persistent fields to avoid stale pointers after heap teardown.
|
84
|
+
~PersistentRegion();
|
85
|
+
|
86
|
+
PersistentRegion(const PersistentRegion&) = delete;
|
87
|
+
PersistentRegion& operator=(const PersistentRegion&) = delete;
|
88
|
+
|
89
|
+
PersistentNode* AllocateNode(void* owner, TraceCallback trace) {
|
90
|
+
if (!free_list_head_) {
|
91
|
+
EnsureNodeSlots();
|
92
|
+
}
|
93
|
+
PersistentNode* node = free_list_head_;
|
94
|
+
free_list_head_ = free_list_head_->FreeListNext();
|
95
|
+
CPPGC_DCHECK(!node->IsUsed());
|
96
|
+
node->InitializeAsUsedNode(owner, trace);
|
97
|
+
nodes_in_use_++;
|
98
|
+
return node;
|
99
|
+
}
|
100
|
+
|
101
|
+
void FreeNode(PersistentNode* node) {
|
102
|
+
CPPGC_DCHECK(node);
|
103
|
+
CPPGC_DCHECK(node->IsUsed());
|
104
|
+
node->InitializeAsFreeNode(free_list_head_);
|
105
|
+
free_list_head_ = node;
|
106
|
+
CPPGC_DCHECK(nodes_in_use_ > 0);
|
107
|
+
nodes_in_use_--;
|
108
|
+
}
|
109
|
+
|
110
|
+
void Trace(Visitor*);
|
111
|
+
|
112
|
+
size_t NodesInUse() const;
|
113
|
+
|
114
|
+
void ClearAllUsedNodes();
|
115
|
+
|
116
|
+
private:
|
117
|
+
void EnsureNodeSlots();
|
118
|
+
|
119
|
+
std::vector<std::unique_ptr<PersistentNodeSlots>> nodes_;
|
120
|
+
PersistentNode* free_list_head_ = nullptr;
|
121
|
+
size_t nodes_in_use_ = 0;
|
122
|
+
|
123
|
+
friend class CrossThreadPersistentRegion;
|
124
|
+
};
|
125
|
+
|
126
|
+
// CrossThreadPersistent uses PersistentRegion but protects it using this lock
|
127
|
+
// when needed.
|
128
|
+
class V8_EXPORT PersistentRegionLock final {
|
129
|
+
public:
|
130
|
+
PersistentRegionLock();
|
131
|
+
~PersistentRegionLock();
|
132
|
+
|
133
|
+
static void AssertLocked();
|
134
|
+
};
|
135
|
+
|
136
|
+
// Variant of PersistentRegion that checks whether the PersistentRegionLock is
|
137
|
+
// locked.
|
138
|
+
class V8_EXPORT CrossThreadPersistentRegion final {
|
139
|
+
public:
|
140
|
+
CrossThreadPersistentRegion() = default;
|
141
|
+
// Clears Persistent fields to avoid stale pointers after heap teardown.
|
142
|
+
~CrossThreadPersistentRegion();
|
143
|
+
|
144
|
+
CrossThreadPersistentRegion(const CrossThreadPersistentRegion&) = delete;
|
145
|
+
CrossThreadPersistentRegion& operator=(const CrossThreadPersistentRegion&) =
|
146
|
+
delete;
|
147
|
+
|
148
|
+
V8_INLINE PersistentNode* AllocateNode(void* owner, TraceCallback trace) {
|
149
|
+
PersistentRegionLock::AssertLocked();
|
150
|
+
return persistent_region_.AllocateNode(owner, trace);
|
151
|
+
}
|
152
|
+
|
153
|
+
V8_INLINE void FreeNode(PersistentNode* node) {
|
154
|
+
PersistentRegionLock::AssertLocked();
|
155
|
+
persistent_region_.FreeNode(node);
|
156
|
+
}
|
157
|
+
|
158
|
+
void Trace(Visitor*);
|
159
|
+
|
160
|
+
size_t NodesInUse() const;
|
161
|
+
|
162
|
+
void ClearAllUsedNodes();
|
163
|
+
|
164
|
+
private:
|
165
|
+
PersistentRegion persistent_region_;
|
166
|
+
};
|
167
|
+
|
168
|
+
} // namespace internal
|
169
|
+
|
170
|
+
} // namespace cppgc
|
171
|
+
|
172
|
+
#endif // INCLUDE_CPPGC_INTERNAL_PERSISTENT_NODE_H_
|
@@ -0,0 +1,175 @@
|
|
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_POINTER_POLICIES_H_
|
6
|
+
#define INCLUDE_CPPGC_INTERNAL_POINTER_POLICIES_H_
|
7
|
+
|
8
|
+
#include <cstdint>
|
9
|
+
#include <type_traits>
|
10
|
+
|
11
|
+
#include "cppgc/internal/write-barrier.h"
|
12
|
+
#include "cppgc/sentinel-pointer.h"
|
13
|
+
#include "cppgc/source-location.h"
|
14
|
+
#include "cppgc/type-traits.h"
|
15
|
+
#include "v8config.h" // NOLINT(build/include_directory)
|
16
|
+
|
17
|
+
namespace cppgc {
|
18
|
+
namespace internal {
|
19
|
+
|
20
|
+
class HeapBase;
|
21
|
+
class PersistentRegion;
|
22
|
+
class CrossThreadPersistentRegion;
|
23
|
+
|
24
|
+
// Tags to distinguish between strong and weak member types.
|
25
|
+
class StrongMemberTag;
|
26
|
+
class WeakMemberTag;
|
27
|
+
class UntracedMemberTag;
|
28
|
+
|
29
|
+
struct DijkstraWriteBarrierPolicy {
|
30
|
+
static void InitializingBarrier(const void*, const void*) {
|
31
|
+
// Since in initializing writes the source object is always white, having no
|
32
|
+
// barrier doesn't break the tri-color invariant.
|
33
|
+
}
|
34
|
+
static void AssigningBarrier(const void* slot, const void* value) {
|
35
|
+
WriteBarrier::Params params;
|
36
|
+
switch (WriteBarrier::GetWriteBarrierType(slot, value, params)) {
|
37
|
+
case WriteBarrier::Type::kGenerational:
|
38
|
+
WriteBarrier::GenerationalBarrier(params, slot);
|
39
|
+
break;
|
40
|
+
case WriteBarrier::Type::kMarking:
|
41
|
+
WriteBarrier::DijkstraMarkingBarrier(params, value);
|
42
|
+
break;
|
43
|
+
case WriteBarrier::Type::kNone:
|
44
|
+
break;
|
45
|
+
}
|
46
|
+
}
|
47
|
+
};
|
48
|
+
|
49
|
+
struct NoWriteBarrierPolicy {
|
50
|
+
static void InitializingBarrier(const void*, const void*) {}
|
51
|
+
static void AssigningBarrier(const void*, const void*) {}
|
52
|
+
};
|
53
|
+
|
54
|
+
class V8_EXPORT EnabledCheckingPolicy {
|
55
|
+
protected:
|
56
|
+
template <typename T>
|
57
|
+
void CheckPointer(const T* ptr) {
|
58
|
+
if (!ptr || (kSentinelPointer == ptr)) return;
|
59
|
+
|
60
|
+
CheckPointersImplTrampoline<T>::Call(this, ptr);
|
61
|
+
}
|
62
|
+
|
63
|
+
private:
|
64
|
+
void CheckPointerImpl(const void* ptr, bool points_to_payload);
|
65
|
+
|
66
|
+
template <typename T, bool = IsCompleteV<T>>
|
67
|
+
struct CheckPointersImplTrampoline {
|
68
|
+
static void Call(EnabledCheckingPolicy* policy, const T* ptr) {
|
69
|
+
policy->CheckPointerImpl(ptr, false);
|
70
|
+
}
|
71
|
+
};
|
72
|
+
|
73
|
+
template <typename T>
|
74
|
+
struct CheckPointersImplTrampoline<T, true> {
|
75
|
+
static void Call(EnabledCheckingPolicy* policy, const T* ptr) {
|
76
|
+
policy->CheckPointerImpl(ptr, IsGarbageCollectedTypeV<T>);
|
77
|
+
}
|
78
|
+
};
|
79
|
+
|
80
|
+
const HeapBase* heap_ = nullptr;
|
81
|
+
};
|
82
|
+
|
83
|
+
class DisabledCheckingPolicy {
|
84
|
+
protected:
|
85
|
+
void CheckPointer(const void*) {}
|
86
|
+
};
|
87
|
+
|
88
|
+
#if V8_ENABLE_CHECKS
|
89
|
+
using DefaultMemberCheckingPolicy = EnabledCheckingPolicy;
|
90
|
+
using DefaultPersistentCheckingPolicy = EnabledCheckingPolicy;
|
91
|
+
#else
|
92
|
+
using DefaultMemberCheckingPolicy = DisabledCheckingPolicy;
|
93
|
+
using DefaultPersistentCheckingPolicy = DisabledCheckingPolicy;
|
94
|
+
#endif
|
95
|
+
// For CT(W)P neither marking information (for value), nor objectstart bitmap
|
96
|
+
// (for slot) are guaranteed to be present because there's no synchonization
|
97
|
+
// between heaps after marking.
|
98
|
+
using DefaultCrossThreadPersistentCheckingPolicy = DisabledCheckingPolicy;
|
99
|
+
|
100
|
+
class KeepLocationPolicy {
|
101
|
+
public:
|
102
|
+
constexpr const SourceLocation& Location() const { return location_; }
|
103
|
+
|
104
|
+
protected:
|
105
|
+
constexpr KeepLocationPolicy() = default;
|
106
|
+
constexpr explicit KeepLocationPolicy(const SourceLocation& location)
|
107
|
+
: location_(location) {}
|
108
|
+
|
109
|
+
// KeepLocationPolicy must not copy underlying source locations.
|
110
|
+
KeepLocationPolicy(const KeepLocationPolicy&) = delete;
|
111
|
+
KeepLocationPolicy& operator=(const KeepLocationPolicy&) = delete;
|
112
|
+
|
113
|
+
// Location of the original moved from object should be preserved.
|
114
|
+
KeepLocationPolicy(KeepLocationPolicy&&) = default;
|
115
|
+
KeepLocationPolicy& operator=(KeepLocationPolicy&&) = default;
|
116
|
+
|
117
|
+
private:
|
118
|
+
SourceLocation location_;
|
119
|
+
};
|
120
|
+
|
121
|
+
class IgnoreLocationPolicy {
|
122
|
+
public:
|
123
|
+
constexpr SourceLocation Location() const { return {}; }
|
124
|
+
|
125
|
+
protected:
|
126
|
+
constexpr IgnoreLocationPolicy() = default;
|
127
|
+
constexpr explicit IgnoreLocationPolicy(const SourceLocation&) {}
|
128
|
+
};
|
129
|
+
|
130
|
+
#if CPPGC_SUPPORTS_OBJECT_NAMES
|
131
|
+
using DefaultLocationPolicy = KeepLocationPolicy;
|
132
|
+
#else
|
133
|
+
using DefaultLocationPolicy = IgnoreLocationPolicy;
|
134
|
+
#endif
|
135
|
+
|
136
|
+
struct StrongPersistentPolicy {
|
137
|
+
using IsStrongPersistent = std::true_type;
|
138
|
+
static V8_EXPORT PersistentRegion& GetPersistentRegion(const void* object);
|
139
|
+
};
|
140
|
+
|
141
|
+
struct WeakPersistentPolicy {
|
142
|
+
using IsStrongPersistent = std::false_type;
|
143
|
+
static V8_EXPORT PersistentRegion& GetPersistentRegion(const void* object);
|
144
|
+
};
|
145
|
+
|
146
|
+
struct StrongCrossThreadPersistentPolicy {
|
147
|
+
using IsStrongPersistent = std::true_type;
|
148
|
+
static V8_EXPORT CrossThreadPersistentRegion& GetPersistentRegion(
|
149
|
+
const void* object);
|
150
|
+
};
|
151
|
+
|
152
|
+
struct WeakCrossThreadPersistentPolicy {
|
153
|
+
using IsStrongPersistent = std::false_type;
|
154
|
+
static V8_EXPORT CrossThreadPersistentRegion& GetPersistentRegion(
|
155
|
+
const void* object);
|
156
|
+
};
|
157
|
+
|
158
|
+
// Forward declarations setting up the default policies.
|
159
|
+
template <typename T, typename WeaknessPolicy,
|
160
|
+
typename LocationPolicy = DefaultLocationPolicy,
|
161
|
+
typename CheckingPolicy = DefaultCrossThreadPersistentCheckingPolicy>
|
162
|
+
class BasicCrossThreadPersistent;
|
163
|
+
template <typename T, typename WeaknessPolicy,
|
164
|
+
typename LocationPolicy = DefaultLocationPolicy,
|
165
|
+
typename CheckingPolicy = DefaultPersistentCheckingPolicy>
|
166
|
+
class BasicPersistent;
|
167
|
+
template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
|
168
|
+
typename CheckingPolicy = DefaultMemberCheckingPolicy>
|
169
|
+
class BasicMember;
|
170
|
+
|
171
|
+
} // namespace internal
|
172
|
+
|
173
|
+
} // namespace cppgc
|
174
|
+
|
175
|
+
#endif // INCLUDE_CPPGC_INTERNAL_POINTER_POLICIES_H_
|
@@ -0,0 +1,30 @@
|
|
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_PREFINALIZER_HANDLER_H_
|
6
|
+
#define INCLUDE_CPPGC_INTERNAL_PREFINALIZER_HANDLER_H_
|
7
|
+
|
8
|
+
#include "cppgc/heap.h"
|
9
|
+
#include "cppgc/liveness-broker.h"
|
10
|
+
|
11
|
+
namespace cppgc {
|
12
|
+
namespace internal {
|
13
|
+
|
14
|
+
class V8_EXPORT PreFinalizerRegistrationDispatcher final {
|
15
|
+
public:
|
16
|
+
using PreFinalizerCallback = bool (*)(const LivenessBroker&, void*);
|
17
|
+
struct PreFinalizer {
|
18
|
+
void* object;
|
19
|
+
PreFinalizerCallback callback;
|
20
|
+
|
21
|
+
bool operator==(const PreFinalizer& other) const;
|
22
|
+
};
|
23
|
+
|
24
|
+
static void RegisterPrefinalizer(PreFinalizer pre_finalizer);
|
25
|
+
};
|
26
|
+
|
27
|
+
} // namespace internal
|
28
|
+
} // namespace cppgc
|
29
|
+
|
30
|
+
#endif // INCLUDE_CPPGC_INTERNAL_PREFINALIZER_HANDLER_H_
|