@downdraft/native-mobile-android-arm64 0.0.0 → 0.1.1

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 (138) hide show
  1. package/README.md +7 -0
  2. package/include/node/cppgc/allocation.h +308 -0
  3. package/include/node/cppgc/common.h +28 -0
  4. package/include/node/cppgc/cross-thread-persistent.h +462 -0
  5. package/include/node/cppgc/custom-space.h +97 -0
  6. package/include/node/cppgc/default-platform.h +68 -0
  7. package/include/node/cppgc/explicit-management.h +100 -0
  8. package/include/node/cppgc/garbage-collected.h +114 -0
  9. package/include/node/cppgc/heap-consistency.h +309 -0
  10. package/include/node/cppgc/heap-handle.h +48 -0
  11. package/include/node/cppgc/heap-state.h +82 -0
  12. package/include/node/cppgc/heap-statistics.h +126 -0
  13. package/include/node/cppgc/heap.h +202 -0
  14. package/include/node/cppgc/internal/api-constants.h +75 -0
  15. package/include/node/cppgc/internal/atomic-entry-flag.h +48 -0
  16. package/include/node/cppgc/internal/base-page-handle.h +43 -0
  17. package/include/node/cppgc/internal/caged-heap-local-data.h +117 -0
  18. package/include/node/cppgc/internal/caged-heap.h +64 -0
  19. package/include/node/cppgc/internal/compiler-specific.h +46 -0
  20. package/include/node/cppgc/internal/conditional-stack-allocated.h +41 -0
  21. package/include/node/cppgc/internal/finalizer-trait.h +93 -0
  22. package/include/node/cppgc/internal/gc-info.h +150 -0
  23. package/include/node/cppgc/internal/logging.h +50 -0
  24. package/include/node/cppgc/internal/member-storage.h +305 -0
  25. package/include/node/cppgc/internal/name-trait.h +141 -0
  26. package/include/node/cppgc/internal/persistent-node.h +219 -0
  27. package/include/node/cppgc/internal/pointer-policies.h +280 -0
  28. package/include/node/cppgc/internal/write-barrier.h +487 -0
  29. package/include/node/cppgc/liveness-broker.h +78 -0
  30. package/include/node/cppgc/macros.h +56 -0
  31. package/include/node/cppgc/member.h +669 -0
  32. package/include/node/cppgc/name-provider.h +75 -0
  33. package/include/node/cppgc/object-size-trait.h +58 -0
  34. package/include/node/cppgc/persistent.h +376 -0
  35. package/include/node/cppgc/platform.h +174 -0
  36. package/include/node/cppgc/prefinalizer.h +75 -0
  37. package/include/node/cppgc/process-heap-statistics.h +36 -0
  38. package/include/node/cppgc/sentinel-pointer.h +39 -0
  39. package/include/node/cppgc/source-location.h +16 -0
  40. package/include/node/cppgc/tagged-member.h +114 -0
  41. package/include/node/cppgc/testing.h +106 -0
  42. package/include/node/cppgc/trace-trait.h +127 -0
  43. package/include/node/cppgc/type-traits.h +272 -0
  44. package/include/node/cppgc/visitor.h +534 -0
  45. package/include/node/js_native_api.h +634 -0
  46. package/include/node/js_native_api_types.h +244 -0
  47. package/include/node/libplatform/libplatform-export.h +29 -0
  48. package/include/node/libplatform/libplatform.h +112 -0
  49. package/include/node/libplatform/v8-tracing.h +343 -0
  50. package/include/node/node.h +1744 -0
  51. package/include/node/node_api.h +265 -0
  52. package/include/node/node_api_types.h +58 -0
  53. package/include/node/node_buffer.h +94 -0
  54. package/include/node/node_object_wrap.h +145 -0
  55. package/include/node/node_version.h +116 -0
  56. package/include/node/uv/aix.h +32 -0
  57. package/include/node/uv/bsd.h +34 -0
  58. package/include/node/uv/darwin.h +61 -0
  59. package/include/node/uv/errno.h +483 -0
  60. package/include/node/uv/linux.h +34 -0
  61. package/include/node/uv/os390.h +33 -0
  62. package/include/node/uv/posix.h +31 -0
  63. package/include/node/uv/sunos.h +44 -0
  64. package/include/node/uv/threadpool.h +37 -0
  65. package/include/node/uv/tree.h +521 -0
  66. package/include/node/uv/unix.h +509 -0
  67. package/include/node/uv/version.h +43 -0
  68. package/include/node/uv/win.h +698 -0
  69. package/include/node/uv.h +1994 -0
  70. package/include/node/v8-array-buffer.h +646 -0
  71. package/include/node/v8-callbacks.h +533 -0
  72. package/include/node/v8-container.h +183 -0
  73. package/include/node/v8-context.h +580 -0
  74. package/include/node/v8-cpp-heap-external.h +56 -0
  75. package/include/node/v8-cppgc.h +194 -0
  76. package/include/node/v8-data.h +96 -0
  77. package/include/node/v8-date.h +57 -0
  78. package/include/node/v8-debug.h +210 -0
  79. package/include/node/v8-embedder-heap.h +54 -0
  80. package/include/node/v8-embedder-state-scope.h +52 -0
  81. package/include/node/v8-exception.h +298 -0
  82. package/include/node/v8-extension.h +60 -0
  83. package/include/node/v8-external-memory-accounter.h +60 -0
  84. package/include/node/v8-external.h +73 -0
  85. package/include/node/v8-fast-api-calls.h +784 -0
  86. package/include/node/v8-forward.h +82 -0
  87. package/include/node/v8-function-callback.h +708 -0
  88. package/include/node/v8-function.h +148 -0
  89. package/include/node/v8-handle-base.h +155 -0
  90. package/include/node/v8-initialization.h +343 -0
  91. package/include/node/v8-inspector-protocol.h +13 -0
  92. package/include/node/v8-inspector.h +458 -0
  93. package/include/node/v8-internal.h +1827 -0
  94. package/include/node/v8-isolate.h +1925 -0
  95. package/include/node/v8-json.h +54 -0
  96. package/include/node/v8-local-handle.h +884 -0
  97. package/include/node/v8-locker.h +138 -0
  98. package/include/node/v8-maybe.h +185 -0
  99. package/include/node/v8-memory-span.h +273 -0
  100. package/include/node/v8-message.h +215 -0
  101. package/include/node/v8-metrics.h +273 -0
  102. package/include/node/v8-microtask-queue.h +152 -0
  103. package/include/node/v8-microtask.h +28 -0
  104. package/include/node/v8-object.h +1134 -0
  105. package/include/node/v8-persistent-handle.h +556 -0
  106. package/include/node/v8-platform.h +1552 -0
  107. package/include/node/v8-primitive-object.h +118 -0
  108. package/include/node/v8-primitive.h +1056 -0
  109. package/include/node/v8-profiler.h +1401 -0
  110. package/include/node/v8-promise.h +185 -0
  111. package/include/node/v8-proxy.h +49 -0
  112. package/include/node/v8-regexp.h +105 -0
  113. package/include/node/v8-sandbox.h +170 -0
  114. package/include/node/v8-script.h +996 -0
  115. package/include/node/v8-snapshot.h +302 -0
  116. package/include/node/v8-source-location.h +91 -0
  117. package/include/node/v8-statistics.h +246 -0
  118. package/include/node/v8-template.h +1096 -0
  119. package/include/node/v8-trace-categories.h +28 -0
  120. package/include/node/v8-traced-handle.h +420 -0
  121. package/include/node/v8-typed-array.h +386 -0
  122. package/include/node/v8-unwinder-state.h +30 -0
  123. package/include/node/v8-unwinder.h +146 -0
  124. package/include/node/v8-util.h +549 -0
  125. package/include/node/v8-value-serializer-version.h +24 -0
  126. package/include/node/v8-value-serializer.h +316 -0
  127. package/include/node/v8-value.h +674 -0
  128. package/include/node/v8-version-string.h +38 -0
  129. package/include/node/v8-version.h +20 -0
  130. package/include/node/v8-wasm-trap-handler-posix.h +31 -0
  131. package/include/node/v8-wasm-trap-handler-win.h +28 -0
  132. package/include/node/v8-wasm.h +325 -0
  133. package/include/node/v8-weak-callback-info.h +88 -0
  134. package/include/node/v8.h +88 -0
  135. package/include/node/v8config.h +1077 -0
  136. package/lib/libc++_shared.so +0 -0
  137. package/lib/libnode.so +4 -0
  138. package/package.json +23 -3
@@ -0,0 +1,386 @@
1
+ // Copyright 2021 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_V8_TYPED_ARRAY_H_
6
+ #define INCLUDE_V8_TYPED_ARRAY_H_
7
+
8
+ #include <limits>
9
+
10
+ #include "v8-array-buffer.h" // NOLINT(build/include_directory)
11
+ #include "v8-local-handle.h" // NOLINT(build/include_directory)
12
+ #include "v8config.h" // NOLINT(build/include_directory)
13
+
14
+ namespace v8 {
15
+
16
+ /**
17
+ * A base class for an instance of TypedArray series of constructors
18
+ * (ES6 draft 15.13.6).
19
+ */
20
+ class V8_EXPORT TypedArray : public ArrayBufferView {
21
+ public:
22
+ /*
23
+ * The largest supported typed array byte size. Each subclass defines a
24
+ * type-specific kMaxLength for the maximum length that can be passed to New.
25
+ */
26
+ static constexpr size_t kMaxByteLength = ArrayBuffer::kMaxByteLength;
27
+
28
+ #ifdef V8_ENABLE_SANDBOX
29
+ static_assert(v8::TypedArray::kMaxByteLength <=
30
+ v8::internal::kMaxSafeBufferSizeForSandbox);
31
+ #endif
32
+
33
+ /**
34
+ * Number of elements in this typed array
35
+ * (e.g. for Int16Array, |ByteLength|/2).
36
+ */
37
+ size_t Length();
38
+
39
+ V8_INLINE static TypedArray* Cast(Value* value) {
40
+ #ifdef V8_ENABLE_CHECKS
41
+ CheckCast(value);
42
+ #endif
43
+ return static_cast<TypedArray*>(value);
44
+ }
45
+
46
+ private:
47
+ TypedArray();
48
+ static void CheckCast(Value* obj);
49
+ };
50
+
51
+ /**
52
+ * An instance of Uint8Array constructor (ES6 draft 15.13.6).
53
+ */
54
+ class V8_EXPORT Uint8Array : public TypedArray {
55
+ public:
56
+ /*
57
+ * The largest Uint8Array size that can be constructed using New.
58
+ */
59
+ static constexpr size_t kMaxLength =
60
+ TypedArray::kMaxByteLength / sizeof(uint8_t);
61
+ static_assert(sizeof(uint8_t) == 1);
62
+
63
+ static Local<Uint8Array> New(Local<ArrayBuffer> array_buffer,
64
+ size_t byte_offset, size_t length);
65
+ static Local<Uint8Array> New(Local<SharedArrayBuffer> shared_array_buffer,
66
+ size_t byte_offset, size_t length);
67
+ V8_INLINE static Uint8Array* Cast(Value* value) {
68
+ #ifdef V8_ENABLE_CHECKS
69
+ CheckCast(value);
70
+ #endif
71
+ return static_cast<Uint8Array*>(value);
72
+ }
73
+
74
+ private:
75
+ Uint8Array();
76
+ static void CheckCast(Value* obj);
77
+ };
78
+
79
+ /**
80
+ * An instance of Uint8ClampedArray constructor (ES6 draft 15.13.6).
81
+ */
82
+ class V8_EXPORT Uint8ClampedArray : public TypedArray {
83
+ public:
84
+ /*
85
+ * The largest Uint8ClampedArray size that can be constructed using New.
86
+ */
87
+ static constexpr size_t kMaxLength =
88
+ TypedArray::kMaxByteLength / sizeof(uint8_t);
89
+ static_assert(sizeof(uint8_t) == 1);
90
+
91
+ static Local<Uint8ClampedArray> New(Local<ArrayBuffer> array_buffer,
92
+ size_t byte_offset, size_t length);
93
+ static Local<Uint8ClampedArray> New(
94
+ Local<SharedArrayBuffer> shared_array_buffer, size_t byte_offset,
95
+ size_t length);
96
+ V8_INLINE static Uint8ClampedArray* Cast(Value* value) {
97
+ #ifdef V8_ENABLE_CHECKS
98
+ CheckCast(value);
99
+ #endif
100
+ return static_cast<Uint8ClampedArray*>(value);
101
+ }
102
+
103
+ private:
104
+ Uint8ClampedArray();
105
+ static void CheckCast(Value* obj);
106
+ };
107
+
108
+ /**
109
+ * An instance of Int8Array constructor (ES6 draft 15.13.6).
110
+ */
111
+ class V8_EXPORT Int8Array : public TypedArray {
112
+ public:
113
+ /*
114
+ * The largest Int8Array size that can be constructed using New.
115
+ */
116
+ static constexpr size_t kMaxLength =
117
+ TypedArray::kMaxByteLength / sizeof(int8_t);
118
+ static_assert(sizeof(int8_t) == 1);
119
+
120
+ static Local<Int8Array> New(Local<ArrayBuffer> array_buffer,
121
+ size_t byte_offset, size_t length);
122
+ static Local<Int8Array> New(Local<SharedArrayBuffer> shared_array_buffer,
123
+ size_t byte_offset, size_t length);
124
+ V8_INLINE static Int8Array* Cast(Value* value) {
125
+ #ifdef V8_ENABLE_CHECKS
126
+ CheckCast(value);
127
+ #endif
128
+ return static_cast<Int8Array*>(value);
129
+ }
130
+
131
+ private:
132
+ Int8Array();
133
+ static void CheckCast(Value* obj);
134
+ };
135
+
136
+ /**
137
+ * An instance of Uint16Array constructor (ES6 draft 15.13.6).
138
+ */
139
+ class V8_EXPORT Uint16Array : public TypedArray {
140
+ public:
141
+ /*
142
+ * The largest Uint16Array size that can be constructed using New.
143
+ */
144
+ static constexpr size_t kMaxLength =
145
+ TypedArray::kMaxByteLength / sizeof(uint16_t);
146
+ static_assert(sizeof(uint16_t) == 2);
147
+
148
+ static Local<Uint16Array> New(Local<ArrayBuffer> array_buffer,
149
+ size_t byte_offset, size_t length);
150
+ static Local<Uint16Array> New(Local<SharedArrayBuffer> shared_array_buffer,
151
+ size_t byte_offset, size_t length);
152
+ V8_INLINE static Uint16Array* Cast(Value* value) {
153
+ #ifdef V8_ENABLE_CHECKS
154
+ CheckCast(value);
155
+ #endif
156
+ return static_cast<Uint16Array*>(value);
157
+ }
158
+
159
+ private:
160
+ Uint16Array();
161
+ static void CheckCast(Value* obj);
162
+ };
163
+
164
+ /**
165
+ * An instance of Int16Array constructor (ES6 draft 15.13.6).
166
+ */
167
+ class V8_EXPORT Int16Array : public TypedArray {
168
+ public:
169
+ /*
170
+ * The largest Int16Array size that can be constructed using New.
171
+ */
172
+ static constexpr size_t kMaxLength =
173
+ TypedArray::kMaxByteLength / sizeof(int16_t);
174
+ static_assert(sizeof(int16_t) == 2);
175
+
176
+ static Local<Int16Array> New(Local<ArrayBuffer> array_buffer,
177
+ size_t byte_offset, size_t length);
178
+ static Local<Int16Array> New(Local<SharedArrayBuffer> shared_array_buffer,
179
+ size_t byte_offset, size_t length);
180
+ V8_INLINE static Int16Array* Cast(Value* value) {
181
+ #ifdef V8_ENABLE_CHECKS
182
+ CheckCast(value);
183
+ #endif
184
+ return static_cast<Int16Array*>(value);
185
+ }
186
+
187
+ private:
188
+ Int16Array();
189
+ static void CheckCast(Value* obj);
190
+ };
191
+
192
+ /**
193
+ * An instance of Uint32Array constructor (ES6 draft 15.13.6).
194
+ */
195
+ class V8_EXPORT Uint32Array : public TypedArray {
196
+ public:
197
+ /*
198
+ * The largest Uint32Array size that can be constructed using New.
199
+ */
200
+ static constexpr size_t kMaxLength =
201
+ TypedArray::kMaxByteLength / sizeof(uint32_t);
202
+ static_assert(sizeof(uint32_t) == 4);
203
+
204
+ static Local<Uint32Array> New(Local<ArrayBuffer> array_buffer,
205
+ size_t byte_offset, size_t length);
206
+ static Local<Uint32Array> New(Local<SharedArrayBuffer> shared_array_buffer,
207
+ size_t byte_offset, size_t length);
208
+ V8_INLINE static Uint32Array* Cast(Value* value) {
209
+ #ifdef V8_ENABLE_CHECKS
210
+ CheckCast(value);
211
+ #endif
212
+ return static_cast<Uint32Array*>(value);
213
+ }
214
+
215
+ private:
216
+ Uint32Array();
217
+ static void CheckCast(Value* obj);
218
+ };
219
+
220
+ /**
221
+ * An instance of Int32Array constructor (ES6 draft 15.13.6).
222
+ */
223
+ class V8_EXPORT Int32Array : public TypedArray {
224
+ public:
225
+ /*
226
+ * The largest Int32Array size that can be constructed using New.
227
+ */
228
+ static constexpr size_t kMaxLength =
229
+ TypedArray::kMaxByteLength / sizeof(int32_t);
230
+ static_assert(sizeof(int32_t) == 4);
231
+
232
+ static Local<Int32Array> New(Local<ArrayBuffer> array_buffer,
233
+ size_t byte_offset, size_t length);
234
+ static Local<Int32Array> New(Local<SharedArrayBuffer> shared_array_buffer,
235
+ size_t byte_offset, size_t length);
236
+ V8_INLINE static Int32Array* Cast(Value* value) {
237
+ #ifdef V8_ENABLE_CHECKS
238
+ CheckCast(value);
239
+ #endif
240
+ return static_cast<Int32Array*>(value);
241
+ }
242
+
243
+ private:
244
+ Int32Array();
245
+ static void CheckCast(Value* obj);
246
+ };
247
+
248
+ /**
249
+ * An instance of Float16Array constructor.
250
+ */
251
+ class V8_EXPORT Float16Array : public TypedArray {
252
+ public:
253
+ static constexpr size_t kMaxLength =
254
+ TypedArray::kMaxByteLength / sizeof(uint16_t);
255
+
256
+ static Local<Float16Array> New(Local<ArrayBuffer> array_buffer,
257
+ size_t byte_offset, size_t length);
258
+ static Local<Float16Array> New(Local<SharedArrayBuffer> shared_array_buffer,
259
+ size_t byte_offset, size_t length);
260
+ V8_INLINE static Float16Array* Cast(Value* value) {
261
+ #ifdef V8_ENABLE_CHECKS
262
+ CheckCast(value);
263
+ #endif
264
+ return static_cast<Float16Array*>(value);
265
+ }
266
+
267
+ private:
268
+ Float16Array();
269
+ static void CheckCast(Value* obj);
270
+ };
271
+
272
+ /**
273
+ * An instance of Float32Array constructor (ES6 draft 15.13.6).
274
+ */
275
+ class V8_EXPORT Float32Array : public TypedArray {
276
+ public:
277
+ /*
278
+ * The largest Float32Array size that can be constructed using New.
279
+ */
280
+ static constexpr size_t kMaxLength =
281
+ TypedArray::kMaxByteLength / sizeof(float);
282
+ static_assert(sizeof(float) == 4);
283
+
284
+ static Local<Float32Array> New(Local<ArrayBuffer> array_buffer,
285
+ size_t byte_offset, size_t length);
286
+ static Local<Float32Array> New(Local<SharedArrayBuffer> shared_array_buffer,
287
+ size_t byte_offset, size_t length);
288
+ V8_INLINE static Float32Array* Cast(Value* value) {
289
+ #ifdef V8_ENABLE_CHECKS
290
+ CheckCast(value);
291
+ #endif
292
+ return static_cast<Float32Array*>(value);
293
+ }
294
+
295
+ private:
296
+ Float32Array();
297
+ static void CheckCast(Value* obj);
298
+ };
299
+
300
+ /**
301
+ * An instance of Float64Array constructor (ES6 draft 15.13.6).
302
+ */
303
+ class V8_EXPORT Float64Array : public TypedArray {
304
+ public:
305
+ /*
306
+ * The largest Float64Array size that can be constructed using New.
307
+ */
308
+ static constexpr size_t kMaxLength =
309
+ TypedArray::kMaxByteLength / sizeof(double);
310
+ static_assert(sizeof(double) == 8);
311
+
312
+ static Local<Float64Array> New(Local<ArrayBuffer> array_buffer,
313
+ size_t byte_offset, size_t length);
314
+ static Local<Float64Array> New(Local<SharedArrayBuffer> shared_array_buffer,
315
+ size_t byte_offset, size_t length);
316
+ V8_INLINE static Float64Array* Cast(Value* value) {
317
+ #ifdef V8_ENABLE_CHECKS
318
+ CheckCast(value);
319
+ #endif
320
+ return static_cast<Float64Array*>(value);
321
+ }
322
+
323
+ private:
324
+ Float64Array();
325
+ static void CheckCast(Value* obj);
326
+ };
327
+
328
+ /**
329
+ * An instance of BigInt64Array constructor.
330
+ */
331
+ class V8_EXPORT BigInt64Array : public TypedArray {
332
+ public:
333
+ /*
334
+ * The largest BigInt64Array size that can be constructed using New.
335
+ */
336
+ static constexpr size_t kMaxLength =
337
+ TypedArray::kMaxByteLength / sizeof(int64_t);
338
+ static_assert(sizeof(int64_t) == 8);
339
+
340
+ static Local<BigInt64Array> New(Local<ArrayBuffer> array_buffer,
341
+ size_t byte_offset, size_t length);
342
+ static Local<BigInt64Array> New(Local<SharedArrayBuffer> shared_array_buffer,
343
+ size_t byte_offset, size_t length);
344
+ V8_INLINE static BigInt64Array* Cast(Value* value) {
345
+ #ifdef V8_ENABLE_CHECKS
346
+ CheckCast(value);
347
+ #endif
348
+ return static_cast<BigInt64Array*>(value);
349
+ }
350
+
351
+ private:
352
+ BigInt64Array();
353
+ static void CheckCast(Value* obj);
354
+ };
355
+
356
+ /**
357
+ * An instance of BigUint64Array constructor.
358
+ */
359
+ class V8_EXPORT BigUint64Array : public TypedArray {
360
+ public:
361
+ /*
362
+ * The largest BigUint64Array size that can be constructed using New.
363
+ */
364
+ static constexpr size_t kMaxLength =
365
+ TypedArray::kMaxByteLength / sizeof(uint64_t);
366
+ static_assert(sizeof(uint64_t) == 8);
367
+
368
+ static Local<BigUint64Array> New(Local<ArrayBuffer> array_buffer,
369
+ size_t byte_offset, size_t length);
370
+ static Local<BigUint64Array> New(Local<SharedArrayBuffer> shared_array_buffer,
371
+ size_t byte_offset, size_t length);
372
+ V8_INLINE static BigUint64Array* Cast(Value* value) {
373
+ #ifdef V8_ENABLE_CHECKS
374
+ CheckCast(value);
375
+ #endif
376
+ return static_cast<BigUint64Array*>(value);
377
+ }
378
+
379
+ private:
380
+ BigUint64Array();
381
+ static void CheckCast(Value* obj);
382
+ };
383
+
384
+ } // namespace v8
385
+
386
+ #endif // INCLUDE_V8_TYPED_ARRAY_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_V8_UNWINDER_STATE_H_
6
+ #define INCLUDE_V8_UNWINDER_STATE_H_
7
+
8
+ namespace v8 {
9
+
10
+ #ifdef V8_TARGET_ARCH_ARM
11
+ struct CalleeSavedRegisters {
12
+ void* arm_r4;
13
+ void* arm_r5;
14
+ void* arm_r6;
15
+ void* arm_r7;
16
+ void* arm_r8;
17
+ void* arm_r9;
18
+ void* arm_r10;
19
+ };
20
+ #elif V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_ARM64 || \
21
+ V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_PPC64 || V8_TARGET_ARCH_RISCV64 || \
22
+ V8_TARGET_ARCH_S390X || V8_TARGET_ARCH_LOONG64 || V8_TARGET_ARCH_RISCV32
23
+ struct CalleeSavedRegisters {};
24
+ #else
25
+ #error Target architecture was not detected as supported by v8
26
+ #endif
27
+
28
+ } // namespace v8
29
+
30
+ #endif // INCLUDE_V8_UNWINDER _STATE_H_
@@ -0,0 +1,146 @@
1
+ // Copyright 2021 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_V8_UNWINDER_H_
6
+ #define INCLUDE_V8_UNWINDER_H_
7
+
8
+ #include <memory>
9
+
10
+ #include "v8-embedder-state-scope.h" // NOLINT(build/include_directory)
11
+ #include "v8config.h" // NOLINT(build/include_directory)
12
+
13
+ namespace v8 {
14
+ // Holds the callee saved registers needed for the stack unwinder. It is the
15
+ // empty struct if no registers are required. Implemented in
16
+ // include/v8-unwinder-state.h.
17
+ struct CalleeSavedRegisters;
18
+
19
+ // A RegisterState represents the current state of registers used
20
+ // by the sampling profiler API.
21
+ struct V8_EXPORT RegisterState {
22
+ RegisterState();
23
+ ~RegisterState();
24
+ RegisterState(const RegisterState& other);
25
+ RegisterState& operator=(const RegisterState& other);
26
+
27
+ void* pc; // Instruction pointer.
28
+ void* sp; // Stack pointer.
29
+ void* fp; // Frame pointer.
30
+ void* lr; // Link register (or nullptr on platforms without a link register).
31
+ // Callee saved registers (or null if no callee saved registers were stored)
32
+ std::unique_ptr<CalleeSavedRegisters> callee_saved;
33
+ };
34
+
35
+ // A StateTag represents a possible state of the VM.
36
+ // This enum is append-only to preserve compatibility with historical logs.
37
+ // Add new states only at the end and do not reorder or remove existing values.
38
+ // LINT.IfChange
39
+ enum StateTag : uint16_t {
40
+ JS,
41
+ GC,
42
+ PARSER,
43
+ BYTECODE_COMPILER,
44
+ COMPILER,
45
+ OTHER,
46
+ EXTERNAL,
47
+ ATOMICS_WAIT,
48
+ IDLE,
49
+ LOGGING,
50
+ IDLE_EXTERNAL,
51
+ };
52
+ // LINT.ThenChange(../tools/profile.mjs, ../tools/tickprocessor.mjs)
53
+
54
+ constexpr bool IsExternal(StateTag state) {
55
+ return state == EXTERNAL || state == IDLE_EXTERNAL;
56
+ }
57
+
58
+ constexpr bool IsIdle(StateTag state) {
59
+ return state == IDLE || state == IDLE_EXTERNAL;
60
+ }
61
+
62
+ // The output structure filled up by GetStackSample API function.
63
+ struct SampleInfo {
64
+ size_t frames_count; // Number of frames collected.
65
+ void* external_callback_entry; // External callback address if VM is
66
+ // executing an external callback.
67
+ void* context; // Incumbent native context address.
68
+ void* embedder_context; // Native context address for embedder state
69
+ StateTag vm_state; // Current VM state.
70
+ EmbedderStateTag embedder_state; // Current Embedder state
71
+ };
72
+
73
+ struct MemoryRange {
74
+ const void* start = nullptr;
75
+ size_t length_in_bytes = 0;
76
+ };
77
+
78
+ struct JSEntryStub {
79
+ MemoryRange code;
80
+ };
81
+
82
+ struct JSEntryStubs {
83
+ JSEntryStub js_entry_stub;
84
+ JSEntryStub js_construct_entry_stub;
85
+ JSEntryStub js_run_microtasks_entry_stub;
86
+ };
87
+
88
+ /**
89
+ * Various helpers for skipping over V8 frames in a given stack.
90
+ *
91
+ * The unwinder API is only supported on the x64, ARM64 and ARM32 architectures.
92
+ */
93
+ class V8_EXPORT Unwinder {
94
+ public:
95
+ /**
96
+ * Attempt to unwind the stack to the most recent C++ frame. This function is
97
+ * signal-safe and does not access any V8 state and thus doesn't require an
98
+ * Isolate.
99
+ *
100
+ * The unwinder needs to know the location of the JS Entry Stub (a piece of
101
+ * code that is run when C++ code calls into generated JS code). This is used
102
+ * for edge cases where the current frame is being constructed or torn down
103
+ * when the stack sample occurs.
104
+ *
105
+ * The unwinder also needs the virtual memory range of all possible V8 code
106
+ * objects. There are two ranges required - the heap code range and the range
107
+ * for code embedded in the binary.
108
+ *
109
+ * Available on x64, ARM64 and ARM32.
110
+ *
111
+ * \param code_pages A list of all of the ranges in which V8 has allocated
112
+ * executable code. The caller should obtain this list by calling
113
+ * Isolate::CopyCodePages() during the same interrupt/thread suspension that
114
+ * captures the stack.
115
+ * \param register_state The current registers. This is an in-out param that
116
+ * will be overwritten with the register values after unwinding, on success.
117
+ * \param stack_base The resulting stack pointer and frame pointer values are
118
+ * bounds-checked against the stack_base and the original stack pointer value
119
+ * to ensure that they are valid locations in the given stack. If these values
120
+ * or any intermediate frame pointer values used during unwinding are ever out
121
+ * of these bounds, unwinding will fail.
122
+ *
123
+ * \return True on success.
124
+ */
125
+ static bool TryUnwindV8Frames(const JSEntryStubs& entry_stubs,
126
+ size_t code_pages_length,
127
+ const MemoryRange* code_pages,
128
+ RegisterState* register_state,
129
+ const void* stack_base);
130
+
131
+ /**
132
+ * Whether the PC is within the V8 code range represented by code_pages.
133
+ *
134
+ * If this returns false, then calling UnwindV8Frames() with the same PC
135
+ * and unwind_state will always fail. If it returns true, then unwinding may
136
+ * (but not necessarily) be successful.
137
+ *
138
+ * Available on x64, ARM64 and ARM32
139
+ */
140
+ static bool PCIsInV8(size_t code_pages_length, const MemoryRange* code_pages,
141
+ void* pc);
142
+ };
143
+
144
+ } // namespace v8
145
+
146
+ #endif // INCLUDE_V8_UNWINDER_H_