libv8-node 15.14.0.1-aarch64-linux-musl → 16.19.0.0-aarch64-linux-musl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/ext/libv8-node/location.rb +1 -1
  3. data/ext/libv8-node/paths.rb +5 -1
  4. data/lib/libv8/node/version.rb +3 -3
  5. data/vendor/v8/{out.gn → aarch64-linux-musl}/libv8/obj/libv8_monolith.a +0 -0
  6. data/vendor/v8/include/cppgc/allocation.h +105 -45
  7. data/vendor/v8/include/cppgc/common.h +9 -6
  8. data/vendor/v8/include/cppgc/cross-thread-persistent.h +413 -0
  9. data/vendor/v8/include/cppgc/custom-space.h +37 -2
  10. data/vendor/v8/include/cppgc/default-platform.h +47 -48
  11. data/vendor/v8/include/cppgc/ephemeron-pair.h +30 -0
  12. data/vendor/v8/include/cppgc/explicit-management.h +82 -0
  13. data/vendor/v8/include/cppgc/garbage-collected.h +4 -3
  14. data/vendor/v8/include/cppgc/heap-consistency.h +253 -0
  15. data/vendor/v8/include/cppgc/heap-state.h +70 -0
  16. data/vendor/v8/include/cppgc/heap-statistics.h +120 -0
  17. data/vendor/v8/include/cppgc/heap.h +68 -6
  18. data/vendor/v8/include/cppgc/internal/api-constants.h +3 -3
  19. data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +2 -1
  20. data/vendor/v8/include/cppgc/internal/compiler-specific.h +2 -2
  21. data/vendor/v8/include/cppgc/internal/gc-info.h +44 -13
  22. data/vendor/v8/include/cppgc/internal/name-trait.h +111 -0
  23. data/vendor/v8/include/cppgc/internal/persistent-node.h +58 -2
  24. data/vendor/v8/include/cppgc/internal/pointer-policies.h +69 -28
  25. data/vendor/v8/include/cppgc/internal/prefinalizer-handler.h +1 -1
  26. data/vendor/v8/include/cppgc/internal/write-barrier.h +390 -35
  27. data/vendor/v8/include/cppgc/liveness-broker.h +11 -2
  28. data/vendor/v8/include/cppgc/macros.h +2 -0
  29. data/vendor/v8/include/cppgc/member.h +87 -25
  30. data/vendor/v8/include/cppgc/name-provider.h +65 -0
  31. data/vendor/v8/include/cppgc/object-size-trait.h +58 -0
  32. data/vendor/v8/include/cppgc/persistent.h +40 -10
  33. data/vendor/v8/include/cppgc/platform.h +49 -25
  34. data/vendor/v8/include/cppgc/prefinalizer.h +1 -1
  35. data/vendor/v8/include/cppgc/process-heap-statistics.h +36 -0
  36. data/vendor/v8/include/cppgc/sentinel-pointer.h +32 -0
  37. data/vendor/v8/include/cppgc/source-location.h +2 -1
  38. data/vendor/v8/include/cppgc/testing.h +99 -0
  39. data/vendor/v8/include/cppgc/trace-trait.h +8 -3
  40. data/vendor/v8/include/cppgc/type-traits.h +157 -19
  41. data/vendor/v8/include/cppgc/visitor.h +194 -28
  42. data/vendor/v8/include/libplatform/libplatform.h +11 -0
  43. data/vendor/v8/include/libplatform/v8-tracing.h +2 -0
  44. data/vendor/v8/include/v8-cppgc.h +258 -159
  45. data/vendor/v8/include/v8-fast-api-calls.h +603 -155
  46. data/vendor/v8/include/v8-inspector.h +22 -4
  47. data/vendor/v8/include/v8-internal.h +111 -27
  48. data/vendor/v8/include/v8-metrics.h +77 -8
  49. data/vendor/v8/include/v8-platform.h +47 -22
  50. data/vendor/v8/include/v8-profiler.h +75 -11
  51. data/vendor/v8/include/v8-unwinder-state.h +30 -0
  52. data/vendor/v8/include/v8-util.h +1 -1
  53. data/vendor/v8/include/v8-version.h +4 -4
  54. data/vendor/v8/include/v8.h +1196 -642
  55. data/vendor/v8/include/v8config.h +87 -11
  56. metadata +17 -5
  57. data/vendor/v8/include/cppgc/internal/process-heap.h +0 -34
@@ -10,6 +10,7 @@
10
10
  #include "cppgc/internal/api-constants.h"
11
11
  #include "cppgc/internal/logging.h"
12
12
  #include "cppgc/platform.h"
13
+ #include "v8config.h" // NOLINT(build/include_directory)
13
14
 
14
15
  namespace cppgc {
15
16
  namespace internal {
@@ -54,7 +55,7 @@ static_assert(sizeof(AgeTable) == 1 * api_constants::kMB,
54
55
  struct CagedHeapLocalData final {
55
56
  explicit CagedHeapLocalData(HeapBase* heap_base) : heap_base(heap_base) {}
56
57
 
57
- bool is_marking_in_progress = false;
58
+ bool is_incremental_marking_in_progress = false;
58
59
  HeapBase* heap_base = nullptr;
59
60
  #if defined(CPPGC_YOUNG_GENERATION)
60
61
  AgeTable age_table;
@@ -21,13 +21,13 @@ namespace cppgc {
21
21
 
22
22
  // [[no_unique_address]] comes in C++20 but supported in clang with -std >=
23
23
  // c++11.
24
- #if CPPGC_HAS_CPP_ATTRIBUTE(no_unique_address) // NOLINTNEXTLINE
24
+ #if CPPGC_HAS_CPP_ATTRIBUTE(no_unique_address)
25
25
  #define CPPGC_NO_UNIQUE_ADDRESS [[no_unique_address]]
26
26
  #else
27
27
  #define CPPGC_NO_UNIQUE_ADDRESS
28
28
  #endif
29
29
 
30
- #if CPPGC_HAS_ATTRIBUTE(unused) // NOLINTNEXTLINE
30
+ #if CPPGC_HAS_ATTRIBUTE(unused)
31
31
  #define CPPGC_UNUSED __attribute__((unused))
32
32
  #else
33
33
  #define CPPGC_UNUSED
@@ -5,9 +5,12 @@
5
5
  #ifndef INCLUDE_CPPGC_INTERNAL_GC_INFO_H_
6
6
  #define INCLUDE_CPPGC_INTERNAL_GC_INFO_H_
7
7
 
8
- #include <stdint.h>
8
+ #include <atomic>
9
+ #include <cstdint>
10
+ #include <type_traits>
9
11
 
10
12
  #include "cppgc/internal/finalizer-trait.h"
13
+ #include "cppgc/internal/name-trait.h"
11
14
  #include "cppgc/trace-trait.h"
12
15
  #include "v8config.h" // NOLINT(build/include_directory)
13
16
 
@@ -16,26 +19,54 @@ namespace internal {
16
19
 
17
20
  using GCInfoIndex = uint16_t;
18
21
 
19
- class V8_EXPORT RegisteredGCInfoIndex final {
20
- public:
21
- RegisteredGCInfoIndex(FinalizationCallback finalization_callback,
22
- TraceCallback trace_callback, bool has_v_table);
23
- GCInfoIndex GetIndex() const { return index_; }
22
+ // Acquires a new GC info object and returns the index. In addition, also
23
+ // updates `registered_index` atomically.
24
+ V8_EXPORT GCInfoIndex
25
+ EnsureGCInfoIndex(std::atomic<GCInfoIndex>& registered_index,
26
+ FinalizationCallback, TraceCallback, NameCallback, bool);
24
27
 
25
- private:
26
- const GCInfoIndex index_;
28
+ // Fold types based on finalizer behavior. Note that finalizer characteristics
29
+ // align with trace behavior, i.e., destructors are virtual when trace methods
30
+ // are and vice versa.
31
+ template <typename T, typename ParentMostGarbageCollectedType>
32
+ struct GCInfoFolding {
33
+ static constexpr bool kHasVirtualDestructorAtBase =
34
+ std::has_virtual_destructor<ParentMostGarbageCollectedType>::value;
35
+ static constexpr bool kBothTypesAreTriviallyDestructible =
36
+ std::is_trivially_destructible<ParentMostGarbageCollectedType>::value &&
37
+ std::is_trivially_destructible<T>::value;
38
+ static constexpr bool kHasCustomFinalizerDispatchAtBase =
39
+ internal::HasFinalizeGarbageCollectedObject<
40
+ ParentMostGarbageCollectedType>::value;
41
+ #ifdef CPPGC_SUPPORTS_OBJECT_NAMES
42
+ static constexpr bool kWantsDetailedObjectNames = true;
43
+ #else // !CPPGC_SUPPORTS_OBJECT_NAMES
44
+ static constexpr bool kWantsDetailedObjectNames = false;
45
+ #endif // !CPPGC_SUPPORTS_OBJECT_NAMES
46
+
47
+ // Folding would regresses name resolution when deriving names from C++
48
+ // class names as it would just folds a name to the base class name.
49
+ using ResultType = std::conditional_t<(kHasVirtualDestructorAtBase ||
50
+ kBothTypesAreTriviallyDestructible ||
51
+ kHasCustomFinalizerDispatchAtBase) &&
52
+ !kWantsDetailedObjectNames,
53
+ ParentMostGarbageCollectedType, T>;
27
54
  };
28
55
 
29
56
  // Trait determines how the garbage collector treats objects wrt. to traversing,
30
57
  // finalization, and naming.
31
58
  template <typename T>
32
- struct GCInfoTrait {
59
+ struct GCInfoTrait final {
33
60
  static GCInfoIndex Index() {
34
61
  static_assert(sizeof(T), "T must be fully defined");
35
- static const RegisteredGCInfoIndex registered_index(
36
- FinalizerTrait<T>::kCallback, TraceTrait<T>::Trace,
37
- std::is_polymorphic<T>::value);
38
- return registered_index.GetIndex();
62
+ static std::atomic<GCInfoIndex>
63
+ registered_index; // Uses zero initialization.
64
+ const GCInfoIndex index = registered_index.load(std::memory_order_acquire);
65
+ return index ? index
66
+ : EnsureGCInfoIndex(
67
+ registered_index, FinalizerTrait<T>::kCallback,
68
+ TraceTrait<T>::Trace, NameTrait<T>::GetName,
69
+ std::is_polymorphic<T>::value);
39
70
  }
40
71
  };
41
72
 
@@ -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_
@@ -19,7 +19,9 @@ class Visitor;
19
19
 
20
20
  namespace internal {
21
21
 
22
- // PersistentNode represesents a variant of two states:
22
+ class CrossThreadPersistentRegion;
23
+
24
+ // PersistentNode represents a variant of two states:
23
25
  // 1) traceable node with a back pointer to the Persistent object;
24
26
  // 2) freelist entry.
25
27
  class PersistentNode final {
@@ -30,6 +32,7 @@ class PersistentNode final {
30
32
  PersistentNode& operator=(const PersistentNode&) = delete;
31
33
 
32
34
  void InitializeAsUsedNode(void* owner, TraceCallback trace) {
35
+ CPPGC_DCHECK(trace);
33
36
  owner_ = owner;
34
37
  trace_ = trace;
35
38
  }
@@ -72,7 +75,7 @@ class PersistentNode final {
72
75
  TraceCallback trace_ = nullptr;
73
76
  };
74
77
 
75
- class V8_EXPORT PersistentRegion final {
78
+ class V8_EXPORT PersistentRegion {
76
79
  using PersistentNodeSlots = std::array<PersistentNode, 256u>;
77
80
 
78
81
  public:
@@ -89,24 +92,77 @@ class V8_EXPORT PersistentRegion final {
89
92
  }
90
93
  PersistentNode* node = free_list_head_;
91
94
  free_list_head_ = free_list_head_->FreeListNext();
95
+ CPPGC_DCHECK(!node->IsUsed());
92
96
  node->InitializeAsUsedNode(owner, trace);
97
+ nodes_in_use_++;
93
98
  return node;
94
99
  }
95
100
 
96
101
  void FreeNode(PersistentNode* node) {
102
+ CPPGC_DCHECK(node);
103
+ CPPGC_DCHECK(node->IsUsed());
97
104
  node->InitializeAsFreeNode(free_list_head_);
98
105
  free_list_head_ = node;
106
+ CPPGC_DCHECK(nodes_in_use_ > 0);
107
+ nodes_in_use_--;
99
108
  }
100
109
 
101
110
  void Trace(Visitor*);
102
111
 
103
112
  size_t NodesInUse() const;
104
113
 
114
+ void ClearAllUsedNodes();
115
+
105
116
  private:
106
117
  void EnsureNodeSlots();
107
118
 
119
+ template <typename PersistentBaseClass>
120
+ void ClearAllUsedNodes();
121
+
108
122
  std::vector<std::unique_ptr<PersistentNodeSlots>> nodes_;
109
123
  PersistentNode* free_list_head_ = nullptr;
124
+ size_t nodes_in_use_ = 0;
125
+
126
+ friend class CrossThreadPersistentRegion;
127
+ };
128
+
129
+ // CrossThreadPersistent uses PersistentRegion but protects it using this lock
130
+ // when needed.
131
+ class V8_EXPORT PersistentRegionLock final {
132
+ public:
133
+ PersistentRegionLock();
134
+ ~PersistentRegionLock();
135
+
136
+ static void AssertLocked();
137
+ };
138
+
139
+ // Variant of PersistentRegion that checks whether the PersistentRegionLock is
140
+ // locked.
141
+ class V8_EXPORT CrossThreadPersistentRegion final : protected PersistentRegion {
142
+ public:
143
+ CrossThreadPersistentRegion() = default;
144
+ // Clears Persistent fields to avoid stale pointers after heap teardown.
145
+ ~CrossThreadPersistentRegion();
146
+
147
+ CrossThreadPersistentRegion(const CrossThreadPersistentRegion&) = delete;
148
+ CrossThreadPersistentRegion& operator=(const CrossThreadPersistentRegion&) =
149
+ delete;
150
+
151
+ V8_INLINE PersistentNode* AllocateNode(void* owner, TraceCallback trace) {
152
+ PersistentRegionLock::AssertLocked();
153
+ return PersistentRegion::AllocateNode(owner, trace);
154
+ }
155
+
156
+ V8_INLINE void FreeNode(PersistentNode* node) {
157
+ PersistentRegionLock::AssertLocked();
158
+ PersistentRegion::FreeNode(node);
159
+ }
160
+
161
+ void Trace(Visitor*);
162
+
163
+ size_t NodesInUse() const;
164
+
165
+ void ClearAllUsedNodes();
110
166
  };
111
167
 
112
168
  } // namespace internal
@@ -9,13 +9,17 @@
9
9
  #include <type_traits>
10
10
 
11
11
  #include "cppgc/internal/write-barrier.h"
12
+ #include "cppgc/sentinel-pointer.h"
12
13
  #include "cppgc/source-location.h"
14
+ #include "cppgc/type-traits.h"
13
15
  #include "v8config.h" // NOLINT(build/include_directory)
14
16
 
15
17
  namespace cppgc {
16
18
  namespace internal {
17
19
 
20
+ class HeapBase;
18
21
  class PersistentRegion;
22
+ class CrossThreadPersistentRegion;
19
23
 
20
24
  // Tags to distinguish between strong and weak member types.
21
25
  class StrongMemberTag;
@@ -28,7 +32,17 @@ struct DijkstraWriteBarrierPolicy {
28
32
  // barrier doesn't break the tri-color invariant.
29
33
  }
30
34
  static void AssigningBarrier(const void* slot, const void* value) {
31
- WriteBarrier::MarkingBarrier(slot, 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
+ }
32
46
  }
33
47
  };
34
48
 
@@ -39,29 +53,56 @@ struct NoWriteBarrierPolicy {
39
53
 
40
54
  class V8_EXPORT EnabledCheckingPolicy {
41
55
  protected:
42
- EnabledCheckingPolicy();
43
- void CheckPointer(const void* ptr);
56
+ template <typename T>
57
+ void CheckPointer(const T* ptr) {
58
+ if (!ptr || (kSentinelPointer == ptr)) return;
59
+
60
+ CheckPointersImplTrampoline<T>::Call(this, ptr);
61
+ }
44
62
 
45
63
  private:
46
- void* impl_;
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;
47
81
  };
48
82
 
49
83
  class DisabledCheckingPolicy {
50
84
  protected:
51
- void CheckPointer(const void* raw) {}
85
+ void CheckPointer(const void*) {}
52
86
  };
53
87
 
54
88
  #if V8_ENABLE_CHECKS
55
- using DefaultCheckingPolicy = EnabledCheckingPolicy;
89
+ using DefaultMemberCheckingPolicy = EnabledCheckingPolicy;
90
+ using DefaultPersistentCheckingPolicy = EnabledCheckingPolicy;
56
91
  #else
57
- using DefaultCheckingPolicy = DisabledCheckingPolicy;
92
+ using DefaultMemberCheckingPolicy = DisabledCheckingPolicy;
93
+ using DefaultPersistentCheckingPolicy = DisabledCheckingPolicy;
58
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;
59
99
 
60
100
  class KeepLocationPolicy {
61
101
  public:
62
102
  constexpr const SourceLocation& Location() const { return location_; }
63
103
 
64
104
  protected:
105
+ constexpr KeepLocationPolicy() = default;
65
106
  constexpr explicit KeepLocationPolicy(const SourceLocation& location)
66
107
  : location_(location) {}
67
108
 
@@ -82,6 +123,7 @@ class IgnoreLocationPolicy {
82
123
  constexpr SourceLocation Location() const { return {}; }
83
124
 
84
125
  protected:
126
+ constexpr IgnoreLocationPolicy() = default;
85
127
  constexpr explicit IgnoreLocationPolicy(const SourceLocation&) {}
86
128
  };
87
129
 
@@ -93,42 +135,41 @@ using DefaultLocationPolicy = IgnoreLocationPolicy;
93
135
 
94
136
  struct StrongPersistentPolicy {
95
137
  using IsStrongPersistent = std::true_type;
96
-
97
- static V8_EXPORT PersistentRegion& GetPersistentRegion(void* object);
138
+ static V8_EXPORT PersistentRegion& GetPersistentRegion(const void* object);
98
139
  };
99
140
 
100
141
  struct WeakPersistentPolicy {
101
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
+ };
102
151
 
103
- static V8_EXPORT PersistentRegion& GetPersistentRegion(void* object);
152
+ struct WeakCrossThreadPersistentPolicy {
153
+ using IsStrongPersistent = std::false_type;
154
+ static V8_EXPORT CrossThreadPersistentRegion& GetPersistentRegion(
155
+ const void* object);
104
156
  };
105
157
 
106
- // Persistent/Member forward declarations.
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;
107
163
  template <typename T, typename WeaknessPolicy,
108
164
  typename LocationPolicy = DefaultLocationPolicy,
109
- typename CheckingPolicy = DefaultCheckingPolicy>
165
+ typename CheckingPolicy = DefaultPersistentCheckingPolicy>
110
166
  class BasicPersistent;
111
167
  template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
112
- typename CheckingPolicy = DefaultCheckingPolicy>
168
+ typename CheckingPolicy = DefaultMemberCheckingPolicy>
113
169
  class BasicMember;
114
170
 
115
- // Special tag type used to denote some sentinel member. The semantics of the
116
- // sentinel is defined by the embedder.
117
- struct SentinelPointer {
118
- template <typename T>
119
- operator T*() const { // NOLINT
120
- static constexpr intptr_t kSentinelValue = 1;
121
- return reinterpret_cast<T*>(kSentinelValue);
122
- }
123
- // Hidden friends.
124
- friend bool operator==(SentinelPointer, SentinelPointer) { return true; }
125
- friend bool operator!=(SentinelPointer, SentinelPointer) { return false; }
126
- };
127
-
128
171
  } // namespace internal
129
172
 
130
- constexpr internal::SentinelPointer kSentinelPointer;
131
-
132
173
  } // namespace cppgc
133
174
 
134
175
  #endif // INCLUDE_CPPGC_INTERNAL_POINTER_POLICIES_H_
@@ -18,7 +18,7 @@ class V8_EXPORT PreFinalizerRegistrationDispatcher final {
18
18
  void* object;
19
19
  PreFinalizerCallback callback;
20
20
 
21
- bool operator==(const PreFinalizer& other);
21
+ bool operator==(const PreFinalizer& other) const;
22
22
  };
23
23
 
24
24
  static void RegisterPrefinalizer(PreFinalizer pre_finalizer);