@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.
Files changed (137) hide show
  1. package/include/node/cppgc/allocation.h +308 -0
  2. package/include/node/cppgc/common.h +28 -0
  3. package/include/node/cppgc/cross-thread-persistent.h +462 -0
  4. package/include/node/cppgc/custom-space.h +97 -0
  5. package/include/node/cppgc/default-platform.h +68 -0
  6. package/include/node/cppgc/explicit-management.h +100 -0
  7. package/include/node/cppgc/garbage-collected.h +114 -0
  8. package/include/node/cppgc/heap-consistency.h +309 -0
  9. package/include/node/cppgc/heap-handle.h +48 -0
  10. package/include/node/cppgc/heap-state.h +82 -0
  11. package/include/node/cppgc/heap-statistics.h +126 -0
  12. package/include/node/cppgc/heap.h +202 -0
  13. package/include/node/cppgc/internal/api-constants.h +75 -0
  14. package/include/node/cppgc/internal/atomic-entry-flag.h +48 -0
  15. package/include/node/cppgc/internal/base-page-handle.h +43 -0
  16. package/include/node/cppgc/internal/caged-heap-local-data.h +117 -0
  17. package/include/node/cppgc/internal/caged-heap.h +64 -0
  18. package/include/node/cppgc/internal/compiler-specific.h +46 -0
  19. package/include/node/cppgc/internal/conditional-stack-allocated.h +41 -0
  20. package/include/node/cppgc/internal/finalizer-trait.h +93 -0
  21. package/include/node/cppgc/internal/gc-info.h +150 -0
  22. package/include/node/cppgc/internal/logging.h +50 -0
  23. package/include/node/cppgc/internal/member-storage.h +305 -0
  24. package/include/node/cppgc/internal/name-trait.h +141 -0
  25. package/include/node/cppgc/internal/persistent-node.h +219 -0
  26. package/include/node/cppgc/internal/pointer-policies.h +280 -0
  27. package/include/node/cppgc/internal/write-barrier.h +487 -0
  28. package/include/node/cppgc/liveness-broker.h +78 -0
  29. package/include/node/cppgc/macros.h +56 -0
  30. package/include/node/cppgc/member.h +669 -0
  31. package/include/node/cppgc/name-provider.h +75 -0
  32. package/include/node/cppgc/object-size-trait.h +58 -0
  33. package/include/node/cppgc/persistent.h +376 -0
  34. package/include/node/cppgc/platform.h +174 -0
  35. package/include/node/cppgc/prefinalizer.h +75 -0
  36. package/include/node/cppgc/process-heap-statistics.h +36 -0
  37. package/include/node/cppgc/sentinel-pointer.h +39 -0
  38. package/include/node/cppgc/source-location.h +16 -0
  39. package/include/node/cppgc/tagged-member.h +114 -0
  40. package/include/node/cppgc/testing.h +106 -0
  41. package/include/node/cppgc/trace-trait.h +127 -0
  42. package/include/node/cppgc/type-traits.h +272 -0
  43. package/include/node/cppgc/visitor.h +534 -0
  44. package/include/node/js_native_api.h +634 -0
  45. package/include/node/js_native_api_types.h +244 -0
  46. package/include/node/libplatform/libplatform-export.h +29 -0
  47. package/include/node/libplatform/libplatform.h +112 -0
  48. package/include/node/libplatform/v8-tracing.h +343 -0
  49. package/include/node/node.h +1744 -0
  50. package/include/node/node_api.h +265 -0
  51. package/include/node/node_api_types.h +58 -0
  52. package/include/node/node_buffer.h +94 -0
  53. package/include/node/node_object_wrap.h +145 -0
  54. package/include/node/node_version.h +116 -0
  55. package/include/node/uv/aix.h +32 -0
  56. package/include/node/uv/bsd.h +34 -0
  57. package/include/node/uv/darwin.h +61 -0
  58. package/include/node/uv/errno.h +483 -0
  59. package/include/node/uv/linux.h +34 -0
  60. package/include/node/uv/os390.h +33 -0
  61. package/include/node/uv/posix.h +31 -0
  62. package/include/node/uv/sunos.h +44 -0
  63. package/include/node/uv/threadpool.h +37 -0
  64. package/include/node/uv/tree.h +521 -0
  65. package/include/node/uv/unix.h +509 -0
  66. package/include/node/uv/version.h +43 -0
  67. package/include/node/uv/win.h +698 -0
  68. package/include/node/uv.h +1994 -0
  69. package/include/node/v8-array-buffer.h +646 -0
  70. package/include/node/v8-callbacks.h +533 -0
  71. package/include/node/v8-container.h +183 -0
  72. package/include/node/v8-context.h +580 -0
  73. package/include/node/v8-cpp-heap-external.h +56 -0
  74. package/include/node/v8-cppgc.h +194 -0
  75. package/include/node/v8-data.h +96 -0
  76. package/include/node/v8-date.h +57 -0
  77. package/include/node/v8-debug.h +210 -0
  78. package/include/node/v8-embedder-heap.h +54 -0
  79. package/include/node/v8-embedder-state-scope.h +52 -0
  80. package/include/node/v8-exception.h +298 -0
  81. package/include/node/v8-extension.h +60 -0
  82. package/include/node/v8-external-memory-accounter.h +60 -0
  83. package/include/node/v8-external.h +73 -0
  84. package/include/node/v8-fast-api-calls.h +784 -0
  85. package/include/node/v8-forward.h +82 -0
  86. package/include/node/v8-function-callback.h +708 -0
  87. package/include/node/v8-function.h +148 -0
  88. package/include/node/v8-handle-base.h +155 -0
  89. package/include/node/v8-initialization.h +343 -0
  90. package/include/node/v8-inspector-protocol.h +13 -0
  91. package/include/node/v8-inspector.h +458 -0
  92. package/include/node/v8-internal.h +1827 -0
  93. package/include/node/v8-isolate.h +1925 -0
  94. package/include/node/v8-json.h +54 -0
  95. package/include/node/v8-local-handle.h +884 -0
  96. package/include/node/v8-locker.h +138 -0
  97. package/include/node/v8-maybe.h +185 -0
  98. package/include/node/v8-memory-span.h +273 -0
  99. package/include/node/v8-message.h +215 -0
  100. package/include/node/v8-metrics.h +273 -0
  101. package/include/node/v8-microtask-queue.h +152 -0
  102. package/include/node/v8-microtask.h +28 -0
  103. package/include/node/v8-object.h +1134 -0
  104. package/include/node/v8-persistent-handle.h +556 -0
  105. package/include/node/v8-platform.h +1552 -0
  106. package/include/node/v8-primitive-object.h +118 -0
  107. package/include/node/v8-primitive.h +1056 -0
  108. package/include/node/v8-profiler.h +1401 -0
  109. package/include/node/v8-promise.h +185 -0
  110. package/include/node/v8-proxy.h +49 -0
  111. package/include/node/v8-regexp.h +105 -0
  112. package/include/node/v8-sandbox.h +170 -0
  113. package/include/node/v8-script.h +996 -0
  114. package/include/node/v8-snapshot.h +302 -0
  115. package/include/node/v8-source-location.h +91 -0
  116. package/include/node/v8-statistics.h +246 -0
  117. package/include/node/v8-template.h +1096 -0
  118. package/include/node/v8-trace-categories.h +28 -0
  119. package/include/node/v8-traced-handle.h +420 -0
  120. package/include/node/v8-typed-array.h +386 -0
  121. package/include/node/v8-unwinder-state.h +30 -0
  122. package/include/node/v8-unwinder.h +146 -0
  123. package/include/node/v8-util.h +549 -0
  124. package/include/node/v8-value-serializer-version.h +24 -0
  125. package/include/node/v8-value-serializer.h +316 -0
  126. package/include/node/v8-value.h +674 -0
  127. package/include/node/v8-version-string.h +38 -0
  128. package/include/node/v8-version.h +20 -0
  129. package/include/node/v8-wasm-trap-handler-posix.h +31 -0
  130. package/include/node/v8-wasm-trap-handler-win.h +28 -0
  131. package/include/node/v8-wasm.h +325 -0
  132. package/include/node/v8-weak-callback-info.h +88 -0
  133. package/include/node/v8.h +88 -0
  134. package/include/node/v8config.h +1077 -0
  135. package/lib/libc++_shared.so +0 -0
  136. package/lib/libnode.so +4 -0
  137. package/package.json +23 -3
@@ -0,0 +1,308 @@
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_ALLOCATION_H_
6
+ #define INCLUDE_CPPGC_ALLOCATION_H_
7
+
8
+ #include <atomic>
9
+ #include <cstddef>
10
+ #include <cstdint>
11
+ #include <new>
12
+ #include <type_traits>
13
+ #include <utility>
14
+
15
+ #include "cppgc/custom-space.h"
16
+ #include "cppgc/internal/api-constants.h"
17
+ #include "cppgc/internal/gc-info.h"
18
+ #include "cppgc/type-traits.h"
19
+ #include "atomic-ref-shim.h" // NOLINT(build/include_directory)
20
+ #include "v8config.h" // NOLINT(build/include_directory)
21
+
22
+ #if defined(__has_attribute)
23
+ #if __has_attribute(assume_aligned)
24
+ #define CPPGC_DEFAULT_ALIGNED \
25
+ __attribute__((assume_aligned(api_constants::kDefaultAlignment)))
26
+ #define CPPGC_DOUBLE_WORD_ALIGNED \
27
+ __attribute__((assume_aligned(2 * api_constants::kDefaultAlignment)))
28
+ #endif // __has_attribute(assume_aligned)
29
+ #endif // defined(__has_attribute)
30
+
31
+ #if !defined(CPPGC_DEFAULT_ALIGNED)
32
+ #define CPPGC_DEFAULT_ALIGNED
33
+ #endif
34
+
35
+ #if !defined(CPPGC_DOUBLE_WORD_ALIGNED)
36
+ #define CPPGC_DOUBLE_WORD_ALIGNED
37
+ #endif
38
+
39
+ namespace cppgc {
40
+
41
+ /**
42
+ * AllocationHandle is used to allocate garbage-collected objects.
43
+ */
44
+ class AllocationHandle;
45
+
46
+ namespace internal {
47
+
48
+ using AlignVal = std::align_val_t;
49
+
50
+ class MakeGarbageCollectedTraitInternal {
51
+ protected:
52
+ static inline void MarkObjectAsFullyConstructed(const void* payload) {
53
+ // See api_constants for an explanation of the constants.
54
+ std::atomic_ref<uint16_t> atomic_mutable_bitfield(
55
+ *const_cast<uint16_t*>(reinterpret_cast<const uint16_t*>(
56
+ reinterpret_cast<const uint8_t*>(payload) -
57
+ api_constants::kFullyConstructedBitFieldOffsetFromPayload)));
58
+ // It's safe to split use load+store here (instead of a read-modify-write
59
+ // operation), since it's guaranteed that this 16-bit bitfield is only
60
+ // modified by a single thread. This is cheaper in terms of code bloat (on
61
+ // ARM) and performance.
62
+ uint16_t value = atomic_mutable_bitfield.load(std::memory_order_relaxed);
63
+ value |= api_constants::kFullyConstructedBitMask;
64
+ atomic_mutable_bitfield.store(value, std::memory_order_release);
65
+ }
66
+
67
+ // Dispatch based on compile-time information.
68
+ //
69
+ // Default implementation is for a custom space with >`kDefaultAlignment` byte
70
+ // alignment.
71
+ template <typename GCInfoType, typename CustomSpace, size_t alignment>
72
+ struct AllocationDispatcher final {
73
+ static void* Invoke(AllocationHandle& handle, size_t size) {
74
+ static_assert(std::is_base_of_v<CustomSpaceBase, CustomSpace>,
75
+ "Custom space must inherit from CustomSpaceBase.");
76
+ static_assert(
77
+ !CustomSpace::kSupportsCompaction,
78
+ "Custom spaces that support compaction do not support allocating "
79
+ "objects with non-default (i.e. word-sized) alignment.");
80
+ return MakeGarbageCollectedTraitInternal::Allocate(
81
+ handle, size, static_cast<AlignVal>(alignment),
82
+ internal::GCInfoTrait<GCInfoType>::Index(), CustomSpace::kSpaceIndex);
83
+ }
84
+ };
85
+
86
+ // Fast path for regular allocations for the default space with
87
+ // `kDefaultAlignment` byte alignment.
88
+ template <typename GCInfoType>
89
+ struct AllocationDispatcher<GCInfoType, void,
90
+ api_constants::kDefaultAlignment>
91
+ final {
92
+ static void* Invoke(AllocationHandle& handle, size_t size) {
93
+ return MakeGarbageCollectedTraitInternal::Allocate(
94
+ handle, size, internal::GCInfoTrait<GCInfoType>::Index());
95
+ }
96
+ };
97
+
98
+ // Default space with >`kDefaultAlignment` byte alignment.
99
+ template <typename GCInfoType, size_t alignment>
100
+ struct AllocationDispatcher<GCInfoType, void, alignment> final {
101
+ static void* Invoke(AllocationHandle& handle, size_t size) {
102
+ return MakeGarbageCollectedTraitInternal::Allocate(
103
+ handle, size, static_cast<AlignVal>(alignment),
104
+ internal::GCInfoTrait<GCInfoType>::Index());
105
+ }
106
+ };
107
+
108
+ // Custom space with `kDefaultAlignment` byte alignment.
109
+ template <typename GCInfoType, typename CustomSpace>
110
+ struct AllocationDispatcher<GCInfoType, CustomSpace,
111
+ api_constants::kDefaultAlignment>
112
+ final {
113
+ static void* Invoke(AllocationHandle& handle, size_t size) {
114
+ static_assert(std::is_base_of_v<CustomSpaceBase, CustomSpace>,
115
+ "Custom space must inherit from CustomSpaceBase.");
116
+ return MakeGarbageCollectedTraitInternal::Allocate(
117
+ handle, size, internal::GCInfoTrait<GCInfoType>::Index(),
118
+ CustomSpace::kSpaceIndex);
119
+ }
120
+ };
121
+
122
+ private:
123
+ V8_EXPORT static void* CPPGC_DEFAULT_ALIGNED
124
+ Allocate(cppgc::AllocationHandle&, size_t, GCInfoIndex);
125
+ V8_EXPORT static void* CPPGC_DOUBLE_WORD_ALIGNED
126
+ Allocate(cppgc::AllocationHandle&, size_t, AlignVal, GCInfoIndex);
127
+ V8_EXPORT static void* CPPGC_DEFAULT_ALIGNED
128
+ Allocate(cppgc::AllocationHandle&, size_t, GCInfoIndex, CustomSpaceIndex);
129
+ V8_EXPORT static void* CPPGC_DOUBLE_WORD_ALIGNED
130
+ Allocate(cppgc::AllocationHandle&, size_t, AlignVal, GCInfoIndex,
131
+ CustomSpaceIndex);
132
+
133
+ friend class HeapObjectHeader;
134
+ };
135
+
136
+ } // namespace internal
137
+
138
+ /**
139
+ * Base trait that provides utilities for advancers users that have custom
140
+ * allocation needs (e.g., overriding size). It's expected that users override
141
+ * MakeGarbageCollectedTrait (see below) and inherit from
142
+ * MakeGarbageCollectedTraitBase and make use of the low-level primitives
143
+ * offered to allocate and construct an object.
144
+ */
145
+ template <typename T>
146
+ class MakeGarbageCollectedTraitBase
147
+ : private internal::MakeGarbageCollectedTraitInternal {
148
+ private:
149
+ static_assert(internal::IsGarbageCollectedType<T>::value,
150
+ "T needs to be a garbage collected object");
151
+ static_assert(!IsGarbageCollectedWithMixinTypeV<T> ||
152
+ sizeof(T) <=
153
+ internal::api_constants::kLargeObjectSizeThreshold,
154
+ "GarbageCollectedMixin may not be a large object");
155
+
156
+ protected:
157
+ /**
158
+ * Allocates memory for an object of type T.
159
+ *
160
+ * \param handle AllocationHandle identifying the heap to allocate the object
161
+ * on.
162
+ * \param size The size that should be reserved for the object.
163
+ * \returns the memory to construct an object of type T on.
164
+ */
165
+ V8_INLINE static void* Allocate(AllocationHandle& handle, size_t size) {
166
+ static_assert(
167
+ std::is_base_of_v<typename T::ParentMostGarbageCollectedType, T>,
168
+ "U of GarbageCollected<U> must be a base of T. Check "
169
+ "GarbageCollected<T> base class inheritance.");
170
+ static constexpr size_t kWantedAlignment =
171
+ alignof(T) < internal::api_constants::kDefaultAlignment
172
+ ? internal::api_constants::kDefaultAlignment
173
+ : alignof(T);
174
+ static_assert(
175
+ kWantedAlignment <= internal::api_constants::kMaxSupportedAlignment,
176
+ "Requested alignment larger than alignof(std::max_align_t) bytes. "
177
+ "Please file a bug to possibly get this restriction lifted.");
178
+ return AllocationDispatcher<
179
+ typename internal::GCInfoFolding<
180
+ T, typename T::ParentMostGarbageCollectedType>::ResultType,
181
+ typename SpaceTrait<T>::Space, kWantedAlignment>::Invoke(handle, size);
182
+ }
183
+
184
+ /**
185
+ * Marks an object as fully constructed, resulting in precise handling by the
186
+ * garbage collector.
187
+ *
188
+ * \param payload The base pointer the object is allocated at.
189
+ */
190
+ V8_INLINE static void MarkObjectAsFullyConstructed(const void* payload) {
191
+ internal::MakeGarbageCollectedTraitInternal::MarkObjectAsFullyConstructed(
192
+ payload);
193
+ }
194
+ };
195
+
196
+ /**
197
+ * Passed to MakeGarbageCollected to specify how many bytes should be appended
198
+ * to the allocated object.
199
+ *
200
+ * Example:
201
+ * \code
202
+ * class InlinedArray final : public GarbageCollected<InlinedArray> {
203
+ * public:
204
+ * explicit InlinedArray(size_t bytes) : size(bytes), byte_array(this + 1) {}
205
+ * void Trace(Visitor*) const {}
206
+
207
+ * size_t size;
208
+ * char* byte_array;
209
+ * };
210
+ *
211
+ * auto* inlined_array = MakeGarbageCollected<InlinedArray(
212
+ * GetAllocationHandle(), AdditionalBytes(4), 4);
213
+ * for (size_t i = 0; i < 4; i++) {
214
+ * Process(inlined_array->byte_array[i]);
215
+ * }
216
+ * \endcode
217
+ */
218
+ struct AdditionalBytes {
219
+ constexpr explicit AdditionalBytes(size_t bytes) : value(bytes) {}
220
+ const size_t value;
221
+ };
222
+
223
+ /**
224
+ * Default trait class that specifies how to construct an object of type T.
225
+ * Advanced users may override how an object is constructed using the utilities
226
+ * that are provided through MakeGarbageCollectedTraitBase.
227
+ *
228
+ * Any trait overriding construction must
229
+ * - allocate through `MakeGarbageCollectedTraitBase<T>::Allocate`;
230
+ * - mark the object as fully constructed using
231
+ * `MakeGarbageCollectedTraitBase<T>::MarkObjectAsFullyConstructed`;
232
+ */
233
+ template <typename T>
234
+ class MakeGarbageCollectedTrait : public MakeGarbageCollectedTraitBase<T> {
235
+ public:
236
+ template <typename... Args>
237
+ static T* Call(AllocationHandle& handle, Args&&... args) {
238
+ void* memory =
239
+ MakeGarbageCollectedTraitBase<T>::Allocate(handle, sizeof(T));
240
+ T* object = ::new (memory) T(std::forward<Args>(args)...);
241
+ MakeGarbageCollectedTraitBase<T>::MarkObjectAsFullyConstructed(object);
242
+ return object;
243
+ }
244
+
245
+ template <typename... Args>
246
+ static T* Call(AllocationHandle& handle, AdditionalBytes additional_bytes,
247
+ Args&&... args) {
248
+ void* memory = MakeGarbageCollectedTraitBase<T>::Allocate(
249
+ handle, sizeof(T) + additional_bytes.value);
250
+ T* object = ::new (memory) T(std::forward<Args>(args)...);
251
+ MakeGarbageCollectedTraitBase<T>::MarkObjectAsFullyConstructed(object);
252
+ return object;
253
+ }
254
+ };
255
+
256
+ /**
257
+ * Allows users to specify a post-construction callback for specific types. The
258
+ * callback is invoked on the instance of type T right after it has been
259
+ * constructed. This can be useful when the callback requires a
260
+ * fully-constructed object to be able to dispatch to virtual methods.
261
+ */
262
+ template <typename T, typename = void>
263
+ struct PostConstructionCallbackTrait {
264
+ static void Call(T*) {}
265
+ };
266
+
267
+ /**
268
+ * Constructs a managed object of type T where T transitively inherits from
269
+ * GarbageCollected.
270
+ *
271
+ * \param args List of arguments with which an instance of T will be
272
+ * constructed.
273
+ * \returns an instance of type T.
274
+ */
275
+ template <typename T, typename... Args>
276
+ V8_INLINE T* MakeGarbageCollected(AllocationHandle& handle, Args&&... args) {
277
+ T* object =
278
+ MakeGarbageCollectedTrait<T>::Call(handle, std::forward<Args>(args)...);
279
+ PostConstructionCallbackTrait<T>::Call(object);
280
+ return object;
281
+ }
282
+
283
+ /**
284
+ * Constructs a managed object of type T where T transitively inherits from
285
+ * GarbageCollected. Created objects will have additional bytes appended to
286
+ * it. Allocated memory would suffice for `sizeof(T) + additional_bytes`.
287
+ *
288
+ * \param additional_bytes Denotes how many bytes to append to T.
289
+ * \param args List of arguments with which an instance of T will be
290
+ * constructed.
291
+ * \returns an instance of type T.
292
+ */
293
+ template <typename T, typename... Args>
294
+ V8_INLINE T* MakeGarbageCollected(AllocationHandle& handle,
295
+ AdditionalBytes additional_bytes,
296
+ Args&&... args) {
297
+ T* object = MakeGarbageCollectedTrait<T>::Call(handle, additional_bytes,
298
+ std::forward<Args>(args)...);
299
+ PostConstructionCallbackTrait<T>::Call(object);
300
+ return object;
301
+ }
302
+
303
+ } // namespace cppgc
304
+
305
+ #undef CPPGC_DEFAULT_ALIGNED
306
+ #undef CPPGC_DOUBLE_WORD_ALIGNED
307
+
308
+ #endif // INCLUDE_CPPGC_ALLOCATION_H_
@@ -0,0 +1,28 @@
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_COMMON_H_
6
+ #define INCLUDE_CPPGC_COMMON_H_
7
+
8
+ #include "v8config.h" // NOLINT(build/include_directory)
9
+
10
+ namespace cppgc {
11
+
12
+ /**
13
+ * Indicator for the stack state of the embedder.
14
+ */
15
+ enum class EmbedderStackState {
16
+ /**
17
+ * Stack may contain interesting heap pointers.
18
+ */
19
+ kMayContainHeapPointers,
20
+ /**
21
+ * Stack does not contain any interesting heap pointers.
22
+ */
23
+ kNoHeapPointers,
24
+ };
25
+
26
+ } // namespace cppgc
27
+
28
+ #endif // INCLUDE_CPPGC_COMMON_H_