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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) 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 +184 -47
  7. data/vendor/v8/include/cppgc/common.h +9 -6
  8. data/vendor/v8/include/cppgc/cross-thread-persistent.h +465 -0
  9. data/vendor/v8/include/cppgc/custom-space.h +37 -2
  10. data/vendor/v8/include/cppgc/default-platform.h +40 -49
  11. data/vendor/v8/include/cppgc/ephemeron-pair.h +30 -0
  12. data/vendor/v8/include/cppgc/explicit-management.h +100 -0
  13. data/vendor/v8/include/cppgc/garbage-collected.h +19 -29
  14. data/vendor/v8/include/cppgc/heap-consistency.h +266 -0
  15. data/vendor/v8/include/cppgc/heap-state.h +82 -0
  16. data/vendor/v8/include/cppgc/heap-statistics.h +120 -0
  17. data/vendor/v8/include/cppgc/heap.h +73 -6
  18. data/vendor/v8/include/cppgc/internal/api-constants.h +11 -3
  19. data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +27 -15
  20. data/vendor/v8/include/cppgc/internal/compiler-specific.h +2 -2
  21. data/vendor/v8/include/cppgc/internal/finalizer-trait.h +4 -1
  22. data/vendor/v8/include/cppgc/internal/gc-info.h +124 -13
  23. data/vendor/v8/include/cppgc/internal/logging.h +3 -3
  24. data/vendor/v8/include/cppgc/internal/name-trait.h +122 -0
  25. data/vendor/v8/include/cppgc/internal/persistent-node.h +116 -16
  26. data/vendor/v8/include/cppgc/internal/pointer-policies.h +84 -32
  27. data/vendor/v8/include/cppgc/internal/write-barrier.h +392 -35
  28. data/vendor/v8/include/cppgc/liveness-broker.h +11 -2
  29. data/vendor/v8/include/cppgc/macros.h +2 -0
  30. data/vendor/v8/include/cppgc/member.h +91 -26
  31. data/vendor/v8/include/cppgc/name-provider.h +65 -0
  32. data/vendor/v8/include/cppgc/object-size-trait.h +58 -0
  33. data/vendor/v8/include/cppgc/persistent.h +70 -41
  34. data/vendor/v8/include/cppgc/platform.h +52 -26
  35. data/vendor/v8/include/cppgc/prefinalizer.h +36 -13
  36. data/vendor/v8/include/cppgc/process-heap-statistics.h +36 -0
  37. data/vendor/v8/include/cppgc/sentinel-pointer.h +32 -0
  38. data/vendor/v8/include/cppgc/source-location.h +2 -1
  39. data/vendor/v8/include/cppgc/testing.h +106 -0
  40. data/vendor/v8/include/cppgc/trace-trait.h +8 -3
  41. data/vendor/v8/include/cppgc/type-traits.h +163 -32
  42. data/vendor/v8/include/cppgc/visitor.h +194 -28
  43. data/vendor/v8/include/libplatform/libplatform.h +11 -11
  44. data/vendor/v8/include/libplatform/v8-tracing.h +2 -1
  45. data/vendor/v8/include/v8-array-buffer.h +445 -0
  46. data/vendor/v8/include/v8-callbacks.h +397 -0
  47. data/vendor/v8/include/v8-container.h +129 -0
  48. data/vendor/v8/include/v8-context.h +407 -0
  49. data/vendor/v8/include/v8-cppgc.h +151 -159
  50. data/vendor/v8/include/v8-data.h +80 -0
  51. data/vendor/v8/include/v8-date.h +43 -0
  52. data/vendor/v8/include/v8-debug.h +168 -0
  53. data/vendor/v8/include/v8-embedder-heap.h +218 -0
  54. data/vendor/v8/include/v8-embedder-state-scope.h +51 -0
  55. data/vendor/v8/include/v8-exception.h +217 -0
  56. data/vendor/v8/include/v8-extension.h +62 -0
  57. data/vendor/v8/include/v8-external.h +37 -0
  58. data/vendor/v8/include/v8-fast-api-calls.h +703 -152
  59. data/vendor/v8/include/v8-forward.h +81 -0
  60. data/vendor/v8/include/v8-function-callback.h +475 -0
  61. data/vendor/v8/include/v8-function.h +125 -0
  62. data/vendor/v8/include/v8-initialization.h +315 -0
  63. data/vendor/v8/include/v8-inspector.h +76 -27
  64. data/vendor/v8/include/v8-internal.h +285 -51
  65. data/vendor/v8/include/v8-isolate.h +1709 -0
  66. data/vendor/v8/include/v8-json.h +47 -0
  67. data/vendor/v8/include/v8-local-handle.h +455 -0
  68. data/vendor/v8/include/v8-locker.h +149 -0
  69. data/vendor/v8/include/v8-maybe.h +137 -0
  70. data/vendor/v8/include/v8-memory-span.h +43 -0
  71. data/vendor/v8/include/v8-message.h +216 -0
  72. data/vendor/v8/include/v8-metrics.h +131 -9
  73. data/vendor/v8/include/v8-microtask-queue.h +152 -0
  74. data/vendor/v8/include/v8-microtask.h +28 -0
  75. data/vendor/v8/include/v8-object.h +775 -0
  76. data/vendor/v8/include/v8-persistent-handle.h +590 -0
  77. data/vendor/v8/include/v8-platform.h +433 -25
  78. data/vendor/v8/include/v8-primitive-object.h +118 -0
  79. data/vendor/v8/include/v8-primitive.h +866 -0
  80. data/vendor/v8/include/v8-profiler.h +149 -10
  81. data/vendor/v8/include/v8-promise.h +174 -0
  82. data/vendor/v8/include/v8-proxy.h +50 -0
  83. data/vendor/v8/include/v8-regexp.h +105 -0
  84. data/vendor/v8/include/v8-script.h +747 -0
  85. data/vendor/v8/include/v8-snapshot.h +196 -0
  86. data/vendor/v8/include/v8-statistics.h +217 -0
  87. data/vendor/v8/include/v8-template.h +1079 -0
  88. data/vendor/v8/include/v8-traced-handle.h +420 -0
  89. data/vendor/v8/include/v8-typed-array.h +282 -0
  90. data/vendor/v8/include/v8-unwinder-state.h +31 -0
  91. data/vendor/v8/include/v8-unwinder.h +132 -0
  92. data/vendor/v8/include/v8-util.h +8 -2
  93. data/vendor/v8/include/v8-value-serializer-version.h +1 -1
  94. data/vendor/v8/include/v8-value-serializer.h +279 -0
  95. data/vendor/v8/include/v8-value.h +526 -0
  96. data/vendor/v8/include/v8-version.h +4 -4
  97. data/vendor/v8/include/v8-wasm.h +257 -0
  98. data/vendor/v8/include/v8-weak-callback-info.h +87 -0
  99. data/vendor/v8/include/v8.h +41 -12051
  100. data/vendor/v8/include/v8config.h +142 -21
  101. metadata +64 -10
  102. data/vendor/v8/include/cppgc/internal/prefinalizer-handler.h +0 -30
  103. data/vendor/v8/include/cppgc/internal/process-heap.h +0 -34
@@ -19,7 +19,10 @@ class Visitor;
19
19
 
20
20
  namespace internal {
21
21
 
22
- // PersistentNode represesents a variant of two states:
22
+ class CrossThreadPersistentRegion;
23
+ class FatalOutOfMemoryHandler;
24
+
25
+ // PersistentNode represents a variant of two states:
23
26
  // 1) traceable node with a back pointer to the Persistent object;
24
27
  // 2) freelist entry.
25
28
  class PersistentNode final {
@@ -30,6 +33,7 @@ class PersistentNode final {
30
33
  PersistentNode& operator=(const PersistentNode&) = delete;
31
34
 
32
35
  void InitializeAsUsedNode(void* owner, TraceCallback trace) {
36
+ CPPGC_DCHECK(trace);
33
37
  owner_ = owner;
34
38
  trace_ = trace;
35
39
  }
@@ -72,41 +76,137 @@ class PersistentNode final {
72
76
  TraceCallback trace_ = nullptr;
73
77
  };
74
78
 
75
- class V8_EXPORT PersistentRegion final {
79
+ class V8_EXPORT PersistentRegionBase {
76
80
  using PersistentNodeSlots = std::array<PersistentNode, 256u>;
77
81
 
78
82
  public:
79
- PersistentRegion() = default;
80
83
  // Clears Persistent fields to avoid stale pointers after heap teardown.
81
- ~PersistentRegion();
84
+ ~PersistentRegionBase();
82
85
 
83
- PersistentRegion(const PersistentRegion&) = delete;
84
- PersistentRegion& operator=(const PersistentRegion&) = delete;
86
+ PersistentRegionBase(const PersistentRegionBase&) = delete;
87
+ PersistentRegionBase& operator=(const PersistentRegionBase&) = delete;
88
+
89
+ void Trace(Visitor*);
90
+
91
+ size_t NodesInUse() const;
92
+
93
+ void ClearAllUsedNodes();
94
+
95
+ protected:
96
+ explicit PersistentRegionBase(const FatalOutOfMemoryHandler& oom_handler);
85
97
 
86
- PersistentNode* AllocateNode(void* owner, TraceCallback trace) {
87
- if (!free_list_head_) {
88
- EnsureNodeSlots();
98
+ PersistentNode* TryAllocateNodeFromFreeList(void* owner,
99
+ TraceCallback trace) {
100
+ PersistentNode* node = nullptr;
101
+ if (V8_LIKELY(free_list_head_)) {
102
+ node = free_list_head_;
103
+ free_list_head_ = free_list_head_->FreeListNext();
104
+ CPPGC_DCHECK(!node->IsUsed());
105
+ node->InitializeAsUsedNode(owner, trace);
106
+ nodes_in_use_++;
89
107
  }
90
- PersistentNode* node = free_list_head_;
91
- free_list_head_ = free_list_head_->FreeListNext();
92
- node->InitializeAsUsedNode(owner, trace);
93
108
  return node;
94
109
  }
95
110
 
96
111
  void FreeNode(PersistentNode* node) {
112
+ CPPGC_DCHECK(node);
113
+ CPPGC_DCHECK(node->IsUsed());
97
114
  node->InitializeAsFreeNode(free_list_head_);
98
115
  free_list_head_ = node;
116
+ CPPGC_DCHECK(nodes_in_use_ > 0);
117
+ nodes_in_use_--;
99
118
  }
100
119
 
101
- void Trace(Visitor*);
102
-
103
- size_t NodesInUse() const;
120
+ PersistentNode* RefillFreeListAndAllocateNode(void* owner,
121
+ TraceCallback trace);
104
122
 
105
123
  private:
106
- void EnsureNodeSlots();
124
+ template <typename PersistentBaseClass>
125
+ void ClearAllUsedNodes();
126
+
127
+ void RefillFreeList();
107
128
 
108
129
  std::vector<std::unique_ptr<PersistentNodeSlots>> nodes_;
109
130
  PersistentNode* free_list_head_ = nullptr;
131
+ size_t nodes_in_use_ = 0;
132
+ const FatalOutOfMemoryHandler& oom_handler_;
133
+
134
+ friend class CrossThreadPersistentRegion;
135
+ };
136
+
137
+ // Variant of PersistentRegionBase that checks whether the allocation and
138
+ // freeing happens only on the thread that created the region.
139
+ class V8_EXPORT PersistentRegion final : public PersistentRegionBase {
140
+ public:
141
+ explicit PersistentRegion(const FatalOutOfMemoryHandler&);
142
+ // Clears Persistent fields to avoid stale pointers after heap teardown.
143
+ ~PersistentRegion() = default;
144
+
145
+ PersistentRegion(const PersistentRegion&) = delete;
146
+ PersistentRegion& operator=(const PersistentRegion&) = delete;
147
+
148
+ V8_INLINE PersistentNode* AllocateNode(void* owner, TraceCallback trace) {
149
+ CPPGC_DCHECK(IsCreationThread());
150
+ auto* node = TryAllocateNodeFromFreeList(owner, trace);
151
+ if (V8_LIKELY(node)) return node;
152
+
153
+ // Slow path allocation allows for checking thread correspondence.
154
+ CPPGC_CHECK(IsCreationThread());
155
+ return RefillFreeListAndAllocateNode(owner, trace);
156
+ }
157
+
158
+ V8_INLINE void FreeNode(PersistentNode* node) {
159
+ CPPGC_DCHECK(IsCreationThread());
160
+ PersistentRegionBase::FreeNode(node);
161
+ }
162
+
163
+ private:
164
+ bool IsCreationThread();
165
+
166
+ int creation_thread_id_;
167
+ };
168
+
169
+ // CrossThreadPersistent uses PersistentRegionBase but protects it using this
170
+ // lock when needed.
171
+ class V8_EXPORT PersistentRegionLock final {
172
+ public:
173
+ PersistentRegionLock();
174
+ ~PersistentRegionLock();
175
+
176
+ static void AssertLocked();
177
+ };
178
+
179
+ // Variant of PersistentRegionBase that checks whether the PersistentRegionLock
180
+ // is locked.
181
+ class V8_EXPORT CrossThreadPersistentRegion final
182
+ : protected PersistentRegionBase {
183
+ public:
184
+ explicit CrossThreadPersistentRegion(const FatalOutOfMemoryHandler&);
185
+ // Clears Persistent fields to avoid stale pointers after heap teardown.
186
+ ~CrossThreadPersistentRegion();
187
+
188
+ CrossThreadPersistentRegion(const CrossThreadPersistentRegion&) = delete;
189
+ CrossThreadPersistentRegion& operator=(const CrossThreadPersistentRegion&) =
190
+ delete;
191
+
192
+ V8_INLINE PersistentNode* AllocateNode(void* owner, TraceCallback trace) {
193
+ PersistentRegionLock::AssertLocked();
194
+ auto* node = TryAllocateNodeFromFreeList(owner, trace);
195
+ if (V8_LIKELY(node)) return node;
196
+
197
+ return RefillFreeListAndAllocateNode(owner, trace);
198
+ }
199
+
200
+ V8_INLINE void FreeNode(PersistentNode* node) {
201
+ PersistentRegionLock::AssertLocked();
202
+ PersistentRegionBase::FreeNode(node);
203
+ }
204
+
205
+ void Trace(Visitor*);
206
+
207
+ size_t NodesInUse() const;
208
+
209
+ void ClearAllUsedNodes();
110
210
  };
111
211
 
112
212
  } // 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
 
@@ -37,31 +51,69 @@ struct NoWriteBarrierPolicy {
37
51
  static void AssigningBarrier(const void*, const void*) {}
38
52
  };
39
53
 
40
- class V8_EXPORT EnabledCheckingPolicy {
54
+ class V8_EXPORT SameThreadEnabledCheckingPolicyBase {
41
55
  protected:
42
- EnabledCheckingPolicy();
43
- void CheckPointer(const void* ptr);
56
+ void CheckPointerImpl(const void* ptr, bool points_to_payload,
57
+ bool check_off_heap_assignments);
58
+
59
+ const HeapBase* heap_ = nullptr;
60
+ };
61
+
62
+ template <bool kCheckOffHeapAssignments>
63
+ class V8_EXPORT SameThreadEnabledCheckingPolicy
64
+ : private SameThreadEnabledCheckingPolicyBase {
65
+ protected:
66
+ template <typename T>
67
+ void CheckPointer(const T* ptr) {
68
+ if (!ptr || (kSentinelPointer == ptr)) return;
69
+
70
+ CheckPointersImplTrampoline<T>::Call(this, ptr);
71
+ }
44
72
 
45
73
  private:
46
- void* impl_;
74
+ template <typename T, bool = IsCompleteV<T>>
75
+ struct CheckPointersImplTrampoline {
76
+ static void Call(SameThreadEnabledCheckingPolicy* policy, const T* ptr) {
77
+ policy->CheckPointerImpl(ptr, false, kCheckOffHeapAssignments);
78
+ }
79
+ };
80
+
81
+ template <typename T>
82
+ struct CheckPointersImplTrampoline<T, true> {
83
+ static void Call(SameThreadEnabledCheckingPolicy* policy, const T* ptr) {
84
+ policy->CheckPointerImpl(ptr, IsGarbageCollectedTypeV<T>,
85
+ kCheckOffHeapAssignments);
86
+ }
87
+ };
47
88
  };
48
89
 
49
90
  class DisabledCheckingPolicy {
50
91
  protected:
51
- void CheckPointer(const void* raw) {}
92
+ void CheckPointer(const void*) {}
52
93
  };
53
94
 
54
- #if V8_ENABLE_CHECKS
55
- using DefaultCheckingPolicy = EnabledCheckingPolicy;
56
- #else
57
- using DefaultCheckingPolicy = DisabledCheckingPolicy;
58
- #endif
95
+ #ifdef DEBUG
96
+ // Off heap members are not connected to object graph and thus cannot ressurect
97
+ // dead objects.
98
+ using DefaultMemberCheckingPolicy =
99
+ SameThreadEnabledCheckingPolicy<false /* kCheckOffHeapAssignments*/>;
100
+ using DefaultPersistentCheckingPolicy =
101
+ SameThreadEnabledCheckingPolicy<true /* kCheckOffHeapAssignments*/>;
102
+ #else // !DEBUG
103
+ using DefaultMemberCheckingPolicy = DisabledCheckingPolicy;
104
+ using DefaultPersistentCheckingPolicy = DisabledCheckingPolicy;
105
+ #endif // !DEBUG
106
+ // For CT(W)P neither marking information (for value), nor objectstart bitmap
107
+ // (for slot) are guaranteed to be present because there's no synchronization
108
+ // between heaps after marking.
109
+ using DefaultCrossThreadPersistentCheckingPolicy = DisabledCheckingPolicy;
59
110
 
60
111
  class KeepLocationPolicy {
61
112
  public:
62
113
  constexpr const SourceLocation& Location() const { return location_; }
63
114
 
64
115
  protected:
116
+ constexpr KeepLocationPolicy() = default;
65
117
  constexpr explicit KeepLocationPolicy(const SourceLocation& location)
66
118
  : location_(location) {}
67
119
 
@@ -82,6 +134,7 @@ class IgnoreLocationPolicy {
82
134
  constexpr SourceLocation Location() const { return {}; }
83
135
 
84
136
  protected:
137
+ constexpr IgnoreLocationPolicy() = default;
85
138
  constexpr explicit IgnoreLocationPolicy(const SourceLocation&) {}
86
139
  };
87
140
 
@@ -93,42 +146,41 @@ using DefaultLocationPolicy = IgnoreLocationPolicy;
93
146
 
94
147
  struct StrongPersistentPolicy {
95
148
  using IsStrongPersistent = std::true_type;
96
-
97
- static V8_EXPORT PersistentRegion& GetPersistentRegion(void* object);
149
+ static V8_EXPORT PersistentRegion& GetPersistentRegion(const void* object);
98
150
  };
99
151
 
100
152
  struct WeakPersistentPolicy {
101
153
  using IsStrongPersistent = std::false_type;
154
+ static V8_EXPORT PersistentRegion& GetPersistentRegion(const void* object);
155
+ };
156
+
157
+ struct StrongCrossThreadPersistentPolicy {
158
+ using IsStrongPersistent = std::true_type;
159
+ static V8_EXPORT CrossThreadPersistentRegion& GetPersistentRegion(
160
+ const void* object);
161
+ };
102
162
 
103
- static V8_EXPORT PersistentRegion& GetPersistentRegion(void* object);
163
+ struct WeakCrossThreadPersistentPolicy {
164
+ using IsStrongPersistent = std::false_type;
165
+ static V8_EXPORT CrossThreadPersistentRegion& GetPersistentRegion(
166
+ const void* object);
104
167
  };
105
168
 
106
- // Persistent/Member forward declarations.
169
+ // Forward declarations setting up the default policies.
170
+ template <typename T, typename WeaknessPolicy,
171
+ typename LocationPolicy = DefaultLocationPolicy,
172
+ typename CheckingPolicy = DefaultCrossThreadPersistentCheckingPolicy>
173
+ class BasicCrossThreadPersistent;
107
174
  template <typename T, typename WeaknessPolicy,
108
175
  typename LocationPolicy = DefaultLocationPolicy,
109
- typename CheckingPolicy = DefaultCheckingPolicy>
176
+ typename CheckingPolicy = DefaultPersistentCheckingPolicy>
110
177
  class BasicPersistent;
111
178
  template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
112
- typename CheckingPolicy = DefaultCheckingPolicy>
179
+ typename CheckingPolicy = DefaultMemberCheckingPolicy>
113
180
  class BasicMember;
114
181
 
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
182
  } // namespace internal
129
183
 
130
- constexpr internal::SentinelPointer kSentinelPointer;
131
-
132
184
  } // namespace cppgc
133
185
 
134
186
  #endif // INCLUDE_CPPGC_INTERNAL_POINTER_POLICIES_H_