@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,1077 @@
1
+ // Copyright 2013 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 V8CONFIG_H_
6
+ #define V8CONFIG_H_
7
+
8
+ // gcc 10 defines __cplusplus to "an unspecified value strictly larger than
9
+ // 201703L" for its experimental -std=gnu++2a config.
10
+ // TODO(leszeks): Change to `__cplusplus <= 202002L` once we only support
11
+ // compilers with full C++20 support.
12
+ #if __cplusplus <= 201703L
13
+ #error "C++20 or later required."
14
+ #endif
15
+
16
+ #ifdef V8_GN_HEADER
17
+ #if !__has_include("v8-gn.h")
18
+ #error Missing v8-gn.h. The configuration for v8 is missing from the include \
19
+ path. Add it with -I<path> to the command line
20
+ #endif
21
+ #include "v8-gn.h" // NOLINT(build/include_directory)
22
+ #endif
23
+
24
+ #include <memory>
25
+ // clang-format off
26
+
27
+ // Platform headers for feature detection below.
28
+ #if defined(__ANDROID__)
29
+ # include <sys/cdefs.h>
30
+ #elif defined(__APPLE__)
31
+ # include <TargetConditionals.h>
32
+ #elif defined(__linux__)
33
+ # include <features.h>
34
+ #elif defined(__MVS__)
35
+ # include "zos-base.h"
36
+ #endif
37
+
38
+
39
+ // This macro allows to test for the version of the GNU C library (or
40
+ // a compatible C library that masquerades as glibc). It evaluates to
41
+ // 0 if libc is not GNU libc or compatible.
42
+ // Use like:
43
+ // #if V8_GLIBC_PREREQ(2, 3)
44
+ // ...
45
+ // #endif
46
+ #if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
47
+ # define V8_GLIBC_PREREQ(major, minor) \
48
+ ((__GLIBC__ * 100 + __GLIBC_MINOR__) >= ((major) * 100 + (minor)))
49
+ #else
50
+ # define V8_GLIBC_PREREQ(major, minor) 0
51
+ #endif
52
+
53
+
54
+ // This macro allows to test for the version of the GNU C++ compiler.
55
+ // Note that this also applies to compilers that masquerade as GCC,
56
+ // for example clang and the Intel C++ compiler for Linux.
57
+ // Use like:
58
+ // #if V8_GNUC_PREREQ(4, 3, 1)
59
+ // ...
60
+ // #endif
61
+ #if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__)
62
+ # define V8_GNUC_PREREQ(major, minor, patchlevel) \
63
+ ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= \
64
+ ((major) * 10000 + (minor) * 100 + (patchlevel)))
65
+ #elif defined(__GNUC__) && defined(__GNUC_MINOR__)
66
+ # define V8_GNUC_PREREQ(major, minor, patchlevel) \
67
+ ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= \
68
+ ((major) * 10000 + (minor) * 100 + (patchlevel)))
69
+ #else
70
+ # define V8_GNUC_PREREQ(major, minor, patchlevel) 0
71
+ #endif
72
+
73
+
74
+
75
+ // -----------------------------------------------------------------------------
76
+ // Operating system detection (host)
77
+ //
78
+ // V8_OS_ANDROID - Android
79
+ // V8_OS_BSD - BSDish (macOS, Net/Free/Open/DragonFlyBSD)
80
+ // V8_OS_CYGWIN - Cygwin
81
+ // V8_OS_DRAGONFLYBSD - DragonFlyBSD
82
+ // V8_OS_FREEBSD - FreeBSD
83
+ // V8_OS_FUCHSIA - Fuchsia
84
+ // V8_OS_LINUX - Linux (Android, ChromeOS, Linux, ...)
85
+ // V8_OS_DARWIN - Darwin (macOS, iOS)
86
+ // V8_OS_MACOS - macOS
87
+ // V8_OS_IOS - iOS
88
+ // V8_OS_TVOS - tvOS (also sets V8_OS_IOS)
89
+ // V8_OS_NETBSD - NetBSD
90
+ // V8_OS_OPENBSD - OpenBSD
91
+ // V8_OS_POSIX - POSIX compatible (mostly everything except Windows)
92
+ // V8_OS_QNX - QNX Neutrino
93
+ // V8_OS_SOLARIS - Sun Solaris and OpenSolaris
94
+ // V8_OS_STARBOARD - Starboard (platform abstraction for Cobalt)
95
+ // V8_OS_AIX - AIX
96
+ // V8_OS_WIN - Microsoft Windows
97
+ // V8_OS_ZOS - z/OS
98
+
99
+ #if defined(__ANDROID__)
100
+ # define V8_OS_ANDROID 1
101
+ # define V8_OS_LINUX 1
102
+ # define V8_OS_POSIX 1
103
+ # define V8_OS_STRING "android"
104
+
105
+ #elif defined(__APPLE__)
106
+ # define V8_OS_POSIX 1
107
+ # define V8_OS_BSD 1
108
+ # define V8_OS_DARWIN 1
109
+ # if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
110
+ # define V8_OS_IOS 1
111
+ # define V8_OS_STRING "ios"
112
+ # if defined(TARGET_OS_TV) && TARGET_OS_TV
113
+ # define V8_OS_TVOS 1
114
+ # endif
115
+ # else
116
+ # define V8_OS_MACOS 1
117
+ # define V8_OS_STRING "macos"
118
+ # endif // defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
119
+
120
+ #elif defined(__CYGWIN__)
121
+ # define V8_OS_CYGWIN 1
122
+ # define V8_OS_POSIX 1
123
+ # define V8_OS_STRING "cygwin"
124
+
125
+ #elif defined(__linux__)
126
+ # define V8_OS_LINUX 1
127
+ # define V8_OS_POSIX 1
128
+ # define V8_OS_STRING "linux"
129
+
130
+ #elif defined(__sun)
131
+ # define V8_OS_POSIX 1
132
+ # define V8_OS_SOLARIS 1
133
+ # define V8_OS_STRING "sun"
134
+
135
+ #elif defined(STARBOARD)
136
+ # define V8_OS_STARBOARD 1
137
+ # define V8_OS_STRING "starboard"
138
+
139
+ #elif defined(_AIX)
140
+ # define V8_OS_POSIX 1
141
+ # define V8_OS_AIX 1
142
+ # define V8_OS_STRING "aix"
143
+
144
+ #elif defined(__FreeBSD__)
145
+ # define V8_OS_BSD 1
146
+ # define V8_OS_FREEBSD 1
147
+ # define V8_OS_POSIX 1
148
+ # define V8_OS_STRING "freebsd"
149
+
150
+ #elif defined(__Fuchsia__)
151
+ # define V8_OS_FUCHSIA 1
152
+ # define V8_OS_POSIX 1
153
+ # define V8_OS_STRING "fuchsia"
154
+
155
+ #elif defined(__DragonFly__)
156
+ # define V8_OS_BSD 1
157
+ # define V8_OS_DRAGONFLYBSD 1
158
+ # define V8_OS_POSIX 1
159
+ # define V8_OS_STRING "dragonflybsd"
160
+
161
+ #elif defined(__NetBSD__)
162
+ # define V8_OS_BSD 1
163
+ # define V8_OS_NETBSD 1
164
+ # define V8_OS_POSIX 1
165
+ # define V8_OS_STRING "netbsd"
166
+
167
+ #elif defined(__OpenBSD__)
168
+ # define V8_OS_BSD 1
169
+ # define V8_OS_OPENBSD 1
170
+ # define V8_OS_POSIX 1
171
+ # define V8_OS_STRING "openbsd"
172
+
173
+ #elif defined(__QNXNTO__)
174
+ # define V8_OS_POSIX 1
175
+ # define V8_OS_QNX 1
176
+ # define V8_OS_STRING "qnx"
177
+
178
+ #elif defined(_WIN32)
179
+ # define V8_OS_WIN 1
180
+ # define V8_OS_STRING "windows"
181
+
182
+ #elif defined(__MVS__)
183
+ # define V8_OS_POSIX 1
184
+ # define V8_OS_ZOS 1
185
+ # define V8_OS_STRING "zos"
186
+ #endif
187
+
188
+ // -----------------------------------------------------------------------------
189
+ // Operating system detection (target)
190
+ //
191
+ // V8_TARGET_OS_ANDROID
192
+ // V8_TARGET_OS_FUCHSIA
193
+ // V8_TARGET_OS_IOS
194
+ // V8_TARGET_OS_TVOS (also sets V8_TARGET_OS_IOS)
195
+ // V8_TARGET_OS_LINUX
196
+ // V8_TARGET_OS_MACOS
197
+ // V8_TARGET_OS_WIN
198
+ // V8_TARGET_OS_CHROMEOS
199
+ //
200
+ // If not set explicitly, these fall back to corresponding V8_OS_ values.
201
+
202
+ #ifdef V8_HAVE_TARGET_OS
203
+
204
+ // The target OS is provided, just check that at least one known value is set.
205
+ # if !defined(V8_TARGET_OS_ANDROID) \
206
+ && !defined(V8_TARGET_OS_FUCHSIA) \
207
+ && !defined(V8_TARGET_OS_IOS) \
208
+ && !defined(V8_TARGET_OS_TVOS) \
209
+ && !defined(V8_TARGET_OS_LINUX) \
210
+ && !defined(V8_TARGET_OS_MACOS) \
211
+ && !defined(V8_TARGET_OS_WIN) \
212
+ && !defined(V8_TARGET_OS_CHROMEOS)
213
+ # error No known target OS defined.
214
+ # endif
215
+
216
+ #else // V8_HAVE_TARGET_OS
217
+
218
+ # if defined(V8_TARGET_OS_ANDROID) \
219
+ || defined(V8_TARGET_OS_FUCHSIA) \
220
+ || defined(V8_TARGET_OS_IOS) \
221
+ || defined(V8_TARGET_OS_TVOS) \
222
+ || defined(V8_TARGET_OS_LINUX) \
223
+ || defined(V8_TARGET_OS_MACOS) \
224
+ || defined(V8_TARGET_OS_WIN) \
225
+ || defined(V8_TARGET_OS_CHROMEOS)
226
+ # error A target OS is defined but V8_HAVE_TARGET_OS is unset.
227
+ # endif
228
+
229
+ // Fall back to the detected host OS.
230
+ #ifdef V8_OS_ANDROID
231
+ # define V8_TARGET_OS_ANDROID
232
+ #endif
233
+
234
+ #ifdef V8_OS_FUCHSIA
235
+ # define V8_TARGET_OS_FUCHSIA
236
+ #endif
237
+
238
+ #ifdef V8_OS_IOS
239
+ # define V8_TARGET_OS_IOS
240
+ #endif
241
+
242
+ #ifdef V8_OS_TVOS
243
+ # define V8_TARGET_OS_TVOS
244
+ #endif
245
+
246
+ #ifdef V8_OS_LINUX
247
+ # define V8_TARGET_OS_LINUX
248
+ #endif
249
+
250
+ #ifdef V8_OS_MACOS
251
+ # define V8_TARGET_OS_MACOS
252
+ #endif
253
+
254
+ #ifdef V8_OS_WIN
255
+ # define V8_TARGET_OS_WIN
256
+ #endif
257
+
258
+ #endif // V8_HAVE_TARGET_OS
259
+
260
+ #if defined(V8_TARGET_OS_ANDROID)
261
+ # define V8_TARGET_OS_STRING "android"
262
+ #elif defined(V8_TARGET_OS_FUCHSIA)
263
+ # define V8_TARGET_OS_STRING "fuchsia"
264
+ #elif defined(V8_TARGET_OS_IOS)
265
+ # define V8_TARGET_OS_STRING "ios"
266
+ #elif defined(V8_TARGET_OS_LINUX)
267
+ # define V8_TARGET_OS_STRING "linux"
268
+ #elif defined(V8_TARGET_OS_MACOS)
269
+ # define V8_TARGET_OS_STRING "macos"
270
+ #elif defined(V8_TARGET_OS_WINDOWS)
271
+ # define V8_TARGET_OS_STRING "windows"
272
+ #else
273
+ # define V8_TARGET_OS_STRING "unknown"
274
+ #endif
275
+
276
+ // -----------------------------------------------------------------------------
277
+ // C library detection
278
+ //
279
+ // V8_LIBC_MSVCRT - MSVC libc
280
+ // V8_LIBC_BIONIC - Bionic libc
281
+ // V8_LIBC_BSD - BSD libc derivate
282
+ // V8_LIBC_GLIBC - GNU C library
283
+ // V8_LIBC_UCLIBC - uClibc
284
+ //
285
+ // Note that testing for libc must be done using #if not #ifdef. For example,
286
+ // to test for the GNU C library, use:
287
+ // #if V8_LIBC_GLIBC
288
+ // ...
289
+ // #endif
290
+
291
+ #if defined (_MSC_VER)
292
+ # define V8_LIBC_MSVCRT 1
293
+ #elif defined(__BIONIC__)
294
+ # define V8_LIBC_BIONIC 1
295
+ # define V8_LIBC_BSD 1
296
+ #elif defined(__UCLIBC__)
297
+ // Must test for UCLIBC before GLIBC, as UCLIBC pretends to be GLIBC.
298
+ # define V8_LIBC_UCLIBC 1
299
+ #elif defined(__GLIBC__) || defined(__GNU_LIBRARY__)
300
+ # define V8_LIBC_GLIBC 1
301
+ #else
302
+ # define V8_LIBC_BSD V8_OS_BSD
303
+ #endif
304
+
305
+
306
+ // -----------------------------------------------------------------------------
307
+ // Compiler detection
308
+ //
309
+ // V8_CC_GNU - GCC, or clang in gcc mode
310
+ // V8_CC_INTEL - Intel C++
311
+ // V8_CC_MINGW - Minimalist GNU for Windows
312
+ // V8_CC_MINGW32 - Minimalist GNU for Windows (mingw32)
313
+ // V8_CC_MINGW64 - Minimalist GNU for Windows (mingw-w64)
314
+ // V8_CC_MSVC - Microsoft Visual C/C++, or clang in cl.exe mode
315
+ //
316
+ // C++11 feature detection
317
+ //
318
+ // Compiler-specific feature detection
319
+ //
320
+ // V8_HAS_ATTRIBUTE_ALWAYS_INLINE - __attribute__((always_inline))
321
+ // supported
322
+ // V8_HAS_ATTRIBUTE_CONSTINIT - __attribute__((require_constant_
323
+ // initialization))
324
+ // supported
325
+ // V8_HAS_ATTRIBUTE_NONNULL - __attribute__((nonnull)) supported
326
+ // V8_HAS_ATTRIBUTE_NOINLINE - __attribute__((noinline)) supported
327
+ // V8_HAS_ATTRIBUTE_UNUSED - __attribute__((unused)) supported
328
+ // V8_HAS_ATTRIBUTE_USED - __attribute__((used)) supported
329
+ // V8_HAS_ATTRIBUTE_RETAIN - __attribute__((retain)) supported
330
+ // V8_HAS_ATTRIBUTE_VISIBILITY - __attribute__((visibility)) supported
331
+ // V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT - __attribute__((warn_unused_result))
332
+ // supported
333
+ // V8_HAS_CPP_ATTRIBUTE_NODISCARD - [[nodiscard]] supported
334
+ // V8_HAS_CPP_ATTRIBUTE_NO_UNIQUE_ADDRESS
335
+ // - [[no_unique_address]] supported
336
+ // V8_HAS_CPP_ATTRIBUTE_LIFETIME_BOUND - [[clang::lifetimebound]] supported
337
+ // V8_HAS_BUILTIN_ADD_OVERFLOW - __builtin_add_overflow() supported
338
+ // V8_HAS_BUILTIN_BSWAP16 - __builtin_bswap16() supported
339
+ // V8_HAS_BUILTIN_BSWAP32 - __builtin_bswap32() supported
340
+ // V8_HAS_BUILTIN_BSWAP64 - __builtin_bswap64() supported
341
+ // V8_HAS_BUILTIN_CLZ - __builtin_clz() supported
342
+ // V8_HAS_BUILTIN_CTZ - __builtin_ctz() supported
343
+ // V8_HAS_BUILTIN_EXPECT - __builtin_expect() supported
344
+ // V8_HAS_BUILTIN_FRAME_ADDRESS - __builtin_frame_address() supported
345
+ // V8_HAS_BUILTIN_MUL_OVERFLOW - __builtin_mul_overflow() supported
346
+ // V8_HAS_BUILTIN_POPCOUNT - __builtin_popcount() supported
347
+ // V8_HAS_BUILTIN_SADD_OVERFLOW - __builtin_sadd_overflow() supported
348
+ // V8_HAS_BUILTIN_SMUL_OVERFLOW - __builtin_smul_overflow() supported
349
+ // V8_HAS_BUILTIN_SSUB_OVERFLOW - __builtin_ssub_overflow() supported
350
+ // V8_HAS_BUILTIN_SUB_OVERFLOW - __builtin_sub_overflow() supported
351
+ // V8_HAS_BUILTIN_UADD_OVERFLOW - __builtin_uadd_overflow() supported
352
+ // V8_HAS_COMPUTED_GOTO - computed goto/labels as values
353
+ // supported
354
+ // V8_HAS_DECLSPEC_NOINLINE - __declspec(noinline) supported
355
+ // V8_HAS_DECLSPEC_SELECTANY - __declspec(selectany) supported
356
+ // V8_HAS___FORCEINLINE - __forceinline supported
357
+ //
358
+ // Note that testing for compilers and/or features must be done using #if
359
+ // not #ifdef. For example, to test for Intel C++ Compiler, use:
360
+ // #if V8_CC_INTEL
361
+ // ...
362
+ // #endif
363
+
364
+ #if defined(__has_cpp_attribute)
365
+ #define V8_HAS_CPP_ATTRIBUTE(FEATURE) __has_cpp_attribute(FEATURE)
366
+ #else
367
+ #define V8_HAS_CPP_ATTRIBUTE(FEATURE) 0
368
+ #endif
369
+
370
+ #if defined(__clang__)
371
+
372
+ #if defined(__GNUC__) // Clang in gcc mode.
373
+ # define V8_CC_GNU 1
374
+ #endif
375
+
376
+ # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline))
377
+ # define V8_HAS_ATTRIBUTE_CONSTINIT \
378
+ (__has_attribute(require_constant_initialization))
379
+ # define V8_HAS_ATTRIBUTE_CONST (__has_attribute(const))
380
+ # define V8_HAS_ATTRIBUTE_NONNULL (__has_attribute(nonnull))
381
+ # define V8_HAS_ATTRIBUTE_NOINLINE (__has_attribute(noinline))
382
+ # define V8_HAS_ATTRIBUTE_UNUSED (__has_attribute(unused))
383
+ # define V8_HAS_ATTRIBUTE_USED (__has_attribute(used))
384
+ # define V8_HAS_ATTRIBUTE_RETAIN (__has_attribute(retain))
385
+ # define V8_HAS_ATTRIBUTE_OPTNONE (__has_attribute(optnone))
386
+ // Support for the "preserve_most" attribute is limited:
387
+ // - 32-bit platforms do not implement it,
388
+ // - component builds fail because _dl_runtime_resolve clobbers registers,
389
+ // - we see crashes on arm64 on Windows (https://crbug.com/1409934), which can
390
+ // hopefully be fixed in the future.
391
+ // Additionally, the initial implementation in clang <= 16 overwrote the return
392
+ // register(s) in the epilogue of a preserve_most function, so we only use
393
+ // preserve_most in clang >= 17 (see https://reviews.llvm.org/D143425).
394
+ #if (defined(_M_X64) || defined(__x86_64__) /* x64 (everywhere) */ \
395
+ || ((defined(__AARCH64EL__) || defined(_M_ARM64)) /* arm64, but ... */ \
396
+ && !defined(_WIN32))) /* not on windows */ \
397
+ && !defined(COMPONENT_BUILD) /* no component build */\
398
+ && __clang_major__ >= 17 /* clang >= 17 */
399
+ # define V8_HAS_ATTRIBUTE_PRESERVE_MOST (__has_attribute(preserve_most))
400
+ #endif
401
+ # define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility))
402
+ # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
403
+ (__has_attribute(warn_unused_result))
404
+ # define V8_HAS_ATTRIBUTE_WEAK (__has_attribute(weak))
405
+
406
+ # define V8_HAS_CPP_ATTRIBUTE_NODISCARD (V8_HAS_CPP_ATTRIBUTE(nodiscard))
407
+ #if defined(V8_CC_MSVC)
408
+ # define V8_HAS_CPP_ATTRIBUTE_NO_UNIQUE_ADDRESS \
409
+ (V8_HAS_CPP_ATTRIBUTE(msvc::no_unique_address) || \
410
+ V8_HAS_CPP_ATTRIBUTE(no_unique_address))
411
+ #else
412
+ # define V8_HAS_CPP_ATTRIBUTE_NO_UNIQUE_ADDRESS \
413
+ (V8_HAS_CPP_ATTRIBUTE(no_unique_address))
414
+ #endif
415
+ # define V8_HAS_CPP_ATTRIBUTE_LIFETIME_BOUND (V8_HAS_CPP_ATTRIBUTE(clang::lifetimebound))
416
+
417
+ # define V8_HAS_BUILTIN_ADD_OVERFLOW (__has_builtin(__builtin_add_overflow))
418
+ # define V8_HAS_BUILTIN_ASSUME (__has_builtin(__builtin_assume))
419
+ # define V8_HAS_BUILTIN_ASSUME_ALIGNED (__has_builtin(__builtin_assume_aligned))
420
+ # define V8_HAS_BUILTIN_BSWAP16 (__has_builtin(__builtin_bswap16))
421
+ # define V8_HAS_BUILTIN_BSWAP32 (__has_builtin(__builtin_bswap32))
422
+ # define V8_HAS_BUILTIN_BSWAP64 (__has_builtin(__builtin_bswap64))
423
+ # define V8_HAS_BUILTIN_CLZ (__has_builtin(__builtin_clz))
424
+ # define V8_HAS_BUILTIN_CTZ (__has_builtin(__builtin_ctz))
425
+ # define V8_HAS_BUILTIN_EXPECT (__has_builtin(__builtin_expect))
426
+ # define V8_HAS_BUILTIN_FRAME_ADDRESS (__has_builtin(__builtin_frame_address))
427
+ # define V8_HAS_BUILTIN_MUL_OVERFLOW (__has_builtin(__builtin_mul_overflow))
428
+ # define V8_HAS_BUILTIN_POPCOUNT (__has_builtin(__builtin_popcount))
429
+ # define V8_HAS_BUILTIN_SADD_OVERFLOW (__has_builtin(__builtin_sadd_overflow))
430
+ # define V8_HAS_BUILTIN_SMUL_OVERFLOW (__has_builtin(__builtin_smul_overflow))
431
+ # define V8_HAS_BUILTIN_SSUB_OVERFLOW (__has_builtin(__builtin_ssub_overflow))
432
+ # define V8_HAS_BUILTIN_SUB_OVERFLOW (__has_builtin(__builtin_sub_overflow))
433
+ # define V8_HAS_BUILTIN_UADD_OVERFLOW (__has_builtin(__builtin_uadd_overflow))
434
+ # define V8_HAS_BUILTIN_UNREACHABLE (__has_builtin(__builtin_unreachable))
435
+
436
+ // Clang has no __has_feature for computed gotos.
437
+ // GCC doc: https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
438
+ # define V8_HAS_COMPUTED_GOTO 1
439
+
440
+ #elif defined(__GNUC__)
441
+
442
+ # define V8_CC_GNU 1
443
+ # if defined(__INTEL_COMPILER) // Intel C++ also masquerades as GCC 3.2.0
444
+ # define V8_CC_INTEL 1
445
+ # endif
446
+ # if defined(__MINGW32__)
447
+ # define V8_CC_MINGW32 1
448
+ # endif
449
+ # if defined(__MINGW64__)
450
+ # define V8_CC_MINGW64 1
451
+ # endif
452
+ # define V8_CC_MINGW (V8_CC_MINGW32 || V8_CC_MINGW64)
453
+
454
+ // FYI: __has_builtin is only available with GCC 10 and later, so explicitly
455
+ // check GCC version numbers to enable features. TODO(leszeks): Merge feature
456
+ // enabling for GCC 10 and later into the Clang section above, and leave this
457
+ // section for GCC 9 and earlier.
458
+
459
+ // always_inline is available in gcc 4.0 but not very reliable until 4.4.
460
+ // Works around "sorry, unimplemented: inlining failed" build errors with
461
+ // older compilers.
462
+ # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE 1
463
+ # define V8_HAS_ATTRIBUTE_NOINLINE 1
464
+ # define V8_HAS_ATTRIBUTE_UNUSED 1
465
+ # define V8_HAS_ATTRIBUTE_VISIBILITY 1
466
+ # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT (!V8_CC_INTEL)
467
+ # define V8_HAS_ATTRIBUTE_WEAK 1
468
+
469
+ // [[nodiscard]] does not work together with with
470
+ // __attribute__((visibility(""))) on GCC 7.4 which is why there is no define
471
+ // for V8_HAS_CPP_ATTRIBUTE_NODISCARD. See https://crbug.com/v8/11707.
472
+
473
+ # define V8_HAS_BUILTIN_ASSUME_ALIGNED 1
474
+ # define V8_HAS_BUILTIN_CLZ 1
475
+ # define V8_HAS_BUILTIN_CTZ 1
476
+ # define V8_HAS_BUILTIN_EXPECT 1
477
+ # define V8_HAS_BUILTIN_FRAME_ADDRESS 1
478
+ # define V8_HAS_BUILTIN_POPCOUNT 1
479
+ # define V8_HAS_BUILTIN_UNREACHABLE 1
480
+
481
+ // GCC doc: https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
482
+ #define V8_HAS_COMPUTED_GOTO 1
483
+
484
+ #endif
485
+
486
+ #if defined(_MSC_VER)
487
+ # define V8_CC_MSVC 1
488
+
489
+ # define V8_HAS_DECLSPEC_NOINLINE 1
490
+ # define V8_HAS_DECLSPEC_SELECTANY 1
491
+
492
+ # define V8_HAS___FORCEINLINE 1
493
+
494
+ #endif
495
+
496
+
497
+ // -----------------------------------------------------------------------------
498
+ // Helper macros
499
+
500
+ // A macro used to make better inlining. Don't bother for debug builds.
501
+ // Use like:
502
+ // V8_INLINE int GetZero() { return 0; }
503
+ #if !defined(DEBUG) && V8_HAS_ATTRIBUTE_ALWAYS_INLINE
504
+ # define V8_INLINE inline __attribute__((always_inline))
505
+ #elif !defined(DEBUG) && V8_HAS___FORCEINLINE
506
+ # define V8_INLINE __forceinline
507
+ #else
508
+ # define V8_INLINE inline
509
+ #endif
510
+
511
+ // A macro to force better inlining of calls in a statement. Don't bother for
512
+ // debug builds.
513
+ // Use like:
514
+ // V8_INLINE_STATEMENT foo = bar(); // Will force inlining the bar() call.
515
+ #if !defined(DEBUG) && defined(__clang__) && V8_HAS_ATTRIBUTE_ALWAYS_INLINE
516
+ # define V8_INLINE_STATEMENT [[clang::always_inline]]
517
+ #else
518
+ # define V8_INLINE_STATEMENT
519
+ #endif
520
+
521
+ #if V8_HAS_BUILTIN_ASSUME
522
+ #ifdef DEBUG
523
+ // In debug mode, check assumptions in addition to adding annotations.
524
+ // This helps GCC (and maybe other compilers) figure out that certain
525
+ // situations are unreachable.
526
+ # define V8_ASSUME(condition) \
527
+ do { \
528
+ DCHECK(condition); \
529
+ __builtin_assume(condition); \
530
+ } while (false)
531
+ #else // DEBUG
532
+ # define V8_ASSUME __builtin_assume
533
+ #endif // DEBUG
534
+ #elif V8_HAS_BUILTIN_UNREACHABLE
535
+ # define V8_ASSUME(condition) \
536
+ do { \
537
+ DCHECK(condition); \
538
+ if (!(condition)) __builtin_unreachable(); \
539
+ } while (false)
540
+ #else
541
+ # define V8_ASSUME USE
542
+ #endif
543
+
544
+ // Prefer c++20 std::assume_aligned.
545
+ #if __cplusplus >= 202002L && defined(__cpp_lib_assume_aligned)
546
+ # define V8_ASSUME_ALIGNED(ptr, alignment) \
547
+ std::assume_aligned<(alignment)>(ptr)
548
+ #elif V8_HAS_BUILTIN_ASSUME_ALIGNED
549
+ # define V8_ASSUME_ALIGNED(ptr, alignment) \
550
+ __builtin_assume_aligned((ptr), (alignment))
551
+ #else
552
+ # define V8_ASSUME_ALIGNED(ptr, alignment) (ptr)
553
+ #endif
554
+
555
+ // A macro to mark functions whose values don't change (e.g. across calls)
556
+ // and thereby compiler is free to hoist and fold multiple calls together.
557
+ // Use like:
558
+ // V8_CONST int foo() { ... }
559
+ #if V8_HAS_ATTRIBUTE_CONST
560
+ # define V8_CONST __attribute__((const))
561
+ #else
562
+ # define V8_CONST
563
+ #endif
564
+
565
+ // A macro to mark a declaration as requiring constant initialization.
566
+ // Use like:
567
+ // int* foo V8_CONSTINIT;
568
+ #if V8_HAS_ATTRIBUTE_CONSTINIT
569
+ # define V8_CONSTINIT __attribute__((require_constant_initialization))
570
+ #else
571
+ # define V8_CONSTINIT
572
+ #endif
573
+
574
+
575
+ // A macro to mark specific arguments as non-null.
576
+ // Use like:
577
+ // int add(int* x, int y, int* z) V8_NONNULL(1, 3) { return *x + y + *z; }
578
+ #if V8_HAS_ATTRIBUTE_NONNULL
579
+ # define V8_NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
580
+ #else
581
+ # define V8_NONNULL(...) /* NOT SUPPORTED */
582
+ #endif
583
+
584
+
585
+ // A macro used to tell the compiler to never inline a particular function.
586
+ // Use like:
587
+ // V8_NOINLINE int GetMinusOne() { return -1; }
588
+ #if V8_HAS_ATTRIBUTE_NOINLINE
589
+ # define V8_NOINLINE __attribute__((noinline))
590
+ #elif V8_HAS_DECLSPEC_NOINLINE
591
+ # define V8_NOINLINE __declspec(noinline)
592
+ #else
593
+ # define V8_NOINLINE /* NOT SUPPORTED */
594
+ #endif
595
+
596
+
597
+ // A macro used to change the calling conventions to preserve all registers (no
598
+ // caller-saved registers). Use this for cold functions called from hot
599
+ // functions.
600
+ // Use like:
601
+ // V8_NOINLINE V8_PRESERVE_MOST void UnlikelyMethod();
602
+ #if V8_OS_WIN
603
+ # define V8_PRESERVE_MOST
604
+ #else
605
+ #if V8_HAS_ATTRIBUTE_PRESERVE_MOST
606
+ # define V8_PRESERVE_MOST __attribute__((preserve_most))
607
+ #else
608
+ # define V8_PRESERVE_MOST /* NOT SUPPORTED */
609
+ #endif
610
+ #endif
611
+
612
+
613
+ // A macro (V8_DEPRECATED) to mark classes or functions as deprecated.
614
+ #if defined(V8_DEPRECATION_WARNINGS)
615
+ # define V8_DEPRECATED(message) [[deprecated(message)]]
616
+ #else
617
+ # define V8_DEPRECATED(message)
618
+ #endif
619
+
620
+
621
+ // A macro (V8_DEPRECATE_SOON) to make it easier to see what will be deprecated.
622
+ #if defined(V8_IMMINENT_DEPRECATION_WARNINGS)
623
+ # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
624
+ #else
625
+ # define V8_DEPRECATE_SOON(message)
626
+ #endif
627
+
628
+
629
+ #if defined(V8_IMMINENT_DEPRECATION_WARNINGS) || \
630
+ defined(V8_DEPRECATION_WARNINGS)
631
+ #if defined(V8_CC_MSVC)
632
+ # define START_ALLOW_USE_DEPRECATED() \
633
+ __pragma(warning(push)) \
634
+ __pragma(warning(disable : 4996))
635
+ # define END_ALLOW_USE_DEPRECATED() __pragma(warning(pop))
636
+ #else // !defined(V8_CC_MSVC)
637
+ # define START_ALLOW_USE_DEPRECATED() \
638
+ _Pragma("GCC diagnostic push") \
639
+ _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
640
+ #define END_ALLOW_USE_DEPRECATED() _Pragma("GCC diagnostic pop")
641
+ #endif // !defined(V8_CC_MSVC)
642
+ #else // !(defined(V8_IMMINENT_DEPRECATION_WARNINGS) ||
643
+ // defined(V8_DEPRECATION_WARNINGS))
644
+ #define START_ALLOW_USE_DEPRECATED()
645
+ #define END_ALLOW_USE_DEPRECATED()
646
+ #endif // !(defined(V8_IMMINENT_DEPRECATION_WARNINGS) ||
647
+ // defined(V8_DEPRECATION_WARNINGS))
648
+ #define ALLOW_COPY_AND_MOVE_WITH_DEPRECATED_FIELDS(ClassName) \
649
+ START_ALLOW_USE_DEPRECATED() \
650
+ ClassName(const ClassName&) = default; \
651
+ ClassName(ClassName&&) = default; \
652
+ ClassName& operator=(const ClassName&) = default; \
653
+ ClassName& operator=(ClassName&&) = default; \
654
+ END_ALLOW_USE_DEPRECATED()
655
+
656
+
657
+ #if defined(__GNUC__) && !defined(__clang__) && (__GNUC__ < 6)
658
+ # define V8_ENUM_DEPRECATED(message)
659
+ # define V8_ENUM_DEPRECATE_SOON(message)
660
+ #else
661
+ # define V8_ENUM_DEPRECATED(message) V8_DEPRECATED(message)
662
+ # define V8_ENUM_DEPRECATE_SOON(message) V8_DEPRECATE_SOON(message)
663
+ #endif
664
+
665
+
666
+ // A macro to provide the compiler with branch prediction information.
667
+ #if V8_HAS_BUILTIN_EXPECT
668
+ # define V8_UNLIKELY(condition) (__builtin_expect(!!(condition), 0))
669
+ # define V8_LIKELY(condition) (__builtin_expect(!!(condition), 1))
670
+ #else
671
+ # define V8_UNLIKELY(condition) (condition)
672
+ # define V8_LIKELY(condition) (condition)
673
+ #endif
674
+
675
+
676
+ // Annotate a function indicating the caller must examine the return value.
677
+ // Use like:
678
+ // int foo() V8_WARN_UNUSED_RESULT;
679
+ #if V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT
680
+ #define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
681
+ #else
682
+ #define V8_WARN_UNUSED_RESULT /* NOT SUPPORTED */
683
+ #endif
684
+
685
+
686
+ // Annotate functions/variables as weak to allow overriding the symbol.
687
+ #if V8_HAS_ATTRIBUTE_WEAK
688
+ #define V8_WEAK __attribute__((weak))
689
+ #else
690
+ #define V8_WEAK /* NOT SUPPORTED */
691
+ #endif
692
+
693
+
694
+ // Annotate a class or constructor indicating the caller must assign the
695
+ // constructed instances.
696
+ // Apply to the whole class like:
697
+ // class V8_NODISCARD Foo() { ... };
698
+ // or apply to just one constructor like:
699
+ // V8_NODISCARD Foo() { ... };
700
+ // [[nodiscard]] comes in C++17 but supported in clang with -std >= c++11.
701
+ #if V8_HAS_CPP_ATTRIBUTE_NODISCARD
702
+ #define V8_NODISCARD [[nodiscard]]
703
+ #else
704
+ #define V8_NODISCARD /* NOT SUPPORTED */
705
+ #endif
706
+
707
+
708
+ // Annotate a function to ensure the function is retained in the compiled binary
709
+ // even if it appears to be unused to the compiler.
710
+ #if V8_HAS_ATTRIBUTE_USED && V8_HAS_ATTRIBUTE_VISIBILITY
711
+ #define V8_SYMBOL_USED \
712
+ __attribute__((used, visibility("default")))
713
+ #else
714
+ #define V8_SYMBOL_USED /* NOT SUPPORTED */
715
+ #endif
716
+
717
+
718
+ // The no_unique_address attribute allows tail padding in a non-static data
719
+ // member to overlap other members of the enclosing class (and in the special
720
+ // case when the type is empty, permits it to fully overlap other members). The
721
+ // field is laid out as if a base class were encountered at the corresponding
722
+ // point within the class (except that it does not share a vptr with the
723
+ // enclosing object).
724
+ //
725
+ // Apply to a data member like:
726
+ //
727
+ // class Foo {
728
+ // V8_NO_UNIQUE_ADDRESS Bar bar_;
729
+ // };
730
+ //
731
+ // [[no_unique_address]] comes in C++20 but supported in clang with
732
+ // -std >= c++11.
733
+ #if V8_HAS_CPP_ATTRIBUTE_NO_UNIQUE_ADDRESS
734
+ #if defined(V8_CC_MSVC) && V8_HAS_CPP_ATTRIBUTE(msvc::no_unique_address)
735
+ // Unfortunately MSVC ignores [[no_unique_address]] (see
736
+ // https://devblogs.microsoft.com/cppblog/msvc-cpp20-and-the-std-cpp20-switch/#msvc-extensions-and-abi),
737
+ // and clang-cl matches it for ABI compatibility reasons. We need to prefer
738
+ // [[msvc::no_unique_address]] when available if we actually want any effect.
739
+ #define V8_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]]
740
+ #else
741
+ #define V8_NO_UNIQUE_ADDRESS [[no_unique_address]]
742
+ #endif
743
+ #else
744
+ #define V8_NO_UNIQUE_ADDRESS /* NOT SUPPORTED */
745
+ #endif
746
+
747
+ // Annotates a pointer or reference parameter or return value for a member
748
+ // function as having lifetime intertwined with the instance on which the
749
+ // function is called. For parameters, the function is assumed to store the
750
+ // value into the called-on object, so if the referred-to object is later
751
+ // destroyed, the called-on object is also considered to be dangling. For return
752
+ // values, the value is assumed to point into the called-on object, so if that
753
+ // object is destroyed, the returned value is also considered to be dangling.
754
+ // Useful to diagnose some cases of lifetime errors.
755
+ //
756
+ // See also:
757
+ // https://clang.llvm.org/docs/AttributeReference.html#lifetimebound
758
+ //
759
+ // Usage:
760
+ // ```
761
+ // struct S {
762
+ // S(int* p V8_LIFETIME_BOUND);
763
+ // int* Get() V8_LIFETIME_BOUND;
764
+ // };
765
+ // S Func1() {
766
+ // int i = 0;
767
+ // // The following return will not compile; diagnosed as returning address
768
+ // // of a stack object.
769
+ // return S(&i);
770
+ // }
771
+ // int* Func2(int* p) {
772
+ // // The following return will not compile; diagnosed as returning address
773
+ // // of a local temporary.
774
+ // return S(p).Get();
775
+ // }
776
+ #if V8_HAS_CPP_ATTRIBUTE_LIFETIME_BOUND
777
+ #define V8_LIFETIME_BOUND [[clang::lifetimebound]]
778
+ #else
779
+ #define V8_LIFETIME_BOUND /* NOT SUPPORTED */
780
+ #endif
781
+
782
+ // Marks a type as being eligible for the "trivial" ABI despite having a
783
+ // non-trivial destructor or copy/move constructor. Such types can be relocated
784
+ // after construction by simply copying their memory, which makes them eligible
785
+ // to be passed in registers. The canonical example is std::unique_ptr.
786
+ //
787
+ // Use with caution; this has some subtle effects on constructor/destructor
788
+ // ordering and will be very incorrect if the type relies on its address
789
+ // remaining constant. When used as a function argument (by value), the value
790
+ // may be constructed in the caller's stack frame, passed in a register, and
791
+ // then used and destructed in the callee's stack frame. A similar thing can
792
+ // occur when values are returned.
793
+ //
794
+ // TRIVIAL_ABI is not needed for types which have a trivial destructor and
795
+ // copy/move constructors, since those are automatically trivial by the ABI
796
+ // spec.
797
+ //
798
+ // It is also not likely to be effective on types too large to be passed in one
799
+ // or two registers on typical target ABIs.
800
+ //
801
+ // See also:
802
+ // https://clang.llvm.org/docs/AttributeReference.html#trivial-abi
803
+ // https://libcxx.llvm.org/docs/DesignDocs/UniquePtrTrivialAbi.html
804
+ #if defined(__clang__) && defined(__has_attribute)
805
+ #if __has_attribute(trivial_abi)
806
+ #define V8_TRIVIAL_ABI [[clang::trivial_abi]]
807
+ #define V8_HAS_ATTRIBUTE_TRIVIAL_ABI 1
808
+ #endif // __has_attribute(trivial_abi)
809
+ #endif // defined(__clang__) && defined(__has_attribute)
810
+ #if !defined(V8_TRIVIAL_ABI)
811
+ #define V8_TRIVIAL_ABI
812
+ #define V8_HAS_ATTRIBUTE_TRIVIAL_ABI 0
813
+ #endif //!defined(V8_TRIVIAL_ABI)
814
+
815
+ // Helper macro to define no_sanitize attributes only with clang.
816
+ #if defined(__clang__) && defined(__has_attribute)
817
+ #if __has_attribute(no_sanitize)
818
+ #define V8_CLANG_NO_SANITIZE(what) __attribute__((no_sanitize(what)))
819
+ #endif
820
+ #endif
821
+ #if !defined(V8_CLANG_NO_SANITIZE)
822
+ #define V8_CLANG_NO_SANITIZE(what)
823
+ #endif
824
+
825
+ // Exposing private symbols requires exposing public symbols too.
826
+ #ifdef BUILDING_V8_SHARED_PRIVATE
827
+ #define BUILDING_V8_SHARED
828
+ #endif
829
+
830
+ #if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
831
+ #error Inconsistent build configuration: To build the V8 shared library \
832
+ set BUILDING_V8_SHARED, to include its headers for linking against the \
833
+ V8 shared library set USING_V8_SHARED.
834
+ #endif
835
+
836
+ #ifdef V8_OS_WIN
837
+
838
+ // Setup for Windows DLL export/import. When building the V8 DLL the
839
+ // BUILDING_V8_SHARED needs to be defined. When building a program which uses
840
+ // the V8 DLL USING_V8_SHARED needs to be defined. When either building the V8
841
+ // static library or building a program which uses the V8 static library neither
842
+ // BUILDING_V8_SHARED nor USING_V8_SHARED should be defined.
843
+ #ifdef BUILDING_V8_SHARED
844
+ # define V8_EXPORT __declspec(dllexport)
845
+ #elif USING_V8_SHARED
846
+ # define V8_EXPORT __declspec(dllimport)
847
+ #else
848
+ # define V8_EXPORT
849
+ #endif // BUILDING_V8_SHARED
850
+
851
+ #else // V8_OS_WIN
852
+
853
+ // Setup for Linux shared library export.
854
+ #if (V8_HAS_ATTRIBUTE_VISIBILITY && \
855
+ (defined(BUILDING_V8_SHARED) || USING_V8_SHARED))
856
+ # define V8_EXPORT __attribute__((visibility("default")))
857
+ #else
858
+ # define V8_EXPORT
859
+ # endif // V8_HAS_ATTRIBUTE_VISIBILITY && ...
860
+
861
+ #endif // V8_OS_WIN
862
+
863
+ // clang-format on
864
+
865
+ // Processor architecture detection. For more info on what's defined, see:
866
+ // http://msdn.microsoft.com/en-us/library/b0084kay.aspx
867
+ // http://www.agner.org/optimize/calling_conventions.pdf
868
+ // or with gcc, run: "echo | gcc -E -dM -"
869
+ // The V8_HOST_ARCH_* macros correspond to the architecture on which V8, as a
870
+ // virtual machine and compiler, runs. Don't confuse this with the architecture
871
+ // on which V8 is built.
872
+ #if defined(_M_X64) || defined(__x86_64__)
873
+ #define V8_HOST_ARCH_X64 1
874
+ #if defined(__x86_64__) && __SIZEOF_POINTER__ == 4 // Check for x32.
875
+ #define V8_HOST_ARCH_32_BIT 1
876
+ #else
877
+ #define V8_HOST_ARCH_64_BIT 1
878
+ #endif
879
+ #elif defined(_M_IX86) || defined(__i386__)
880
+ #define V8_HOST_ARCH_IA32 1
881
+ #define V8_HOST_ARCH_32_BIT 1
882
+ #elif defined(__AARCH64EL__) || defined(_M_ARM64)
883
+ #define V8_HOST_ARCH_ARM64 1
884
+ #define V8_HOST_ARCH_64_BIT 1
885
+ #elif defined(__ARMEL__)
886
+ #define V8_HOST_ARCH_ARM 1
887
+ #define V8_HOST_ARCH_32_BIT 1
888
+ #elif defined(__mips64)
889
+ #define V8_HOST_ARCH_MIPS64 1
890
+ #define V8_HOST_ARCH_64_BIT 1
891
+ #elif defined(__loongarch_lp64)
892
+ #define V8_HOST_ARCH_LOONG64 1
893
+ #define V8_HOST_ARCH_64_BIT 1
894
+ #elif defined(__PPC64__) || defined(_ARCH_PPC64)
895
+ #define V8_HOST_ARCH_PPC64 1
896
+ #define V8_HOST_ARCH_64_BIT 1
897
+ #elif defined(__s390x__)
898
+ #define V8_HOST_ARCH_S390X 1
899
+ #define V8_HOST_ARCH_64_BIT 1
900
+ #elif defined(__riscv) || defined(__riscv__)
901
+ #if __riscv_xlen == 64
902
+ #define V8_HOST_ARCH_RISCV64 1
903
+ #define V8_HOST_ARCH_64_BIT 1
904
+ #elif __riscv_xlen == 32
905
+ #define V8_HOST_ARCH_RISCV32 1
906
+ #define V8_HOST_ARCH_32_BIT 1
907
+ #else
908
+ #error "Cannot detect Riscv's bitwidth"
909
+ #endif
910
+ #else
911
+ #error "Host architecture was not detected as supported by v8"
912
+ #endif
913
+
914
+ // Target architecture detection. This corresponds to the architecture for which
915
+ // V8's JIT will generate code (the last stage of the canadian cross-compiler).
916
+ // The macros may be set externally. If not, detect in the same way as the host
917
+ // architecture, that is, target the native environment as presented by the
918
+ // compiler.
919
+ #if !V8_TARGET_ARCH_X64 && !V8_TARGET_ARCH_IA32 && !V8_TARGET_ARCH_ARM && \
920
+ !V8_TARGET_ARCH_ARM64 && !V8_TARGET_ARCH_MIPS64 && \
921
+ !V8_TARGET_ARCH_PPC64 && !V8_TARGET_ARCH_S390X && \
922
+ !V8_TARGET_ARCH_RISCV64 && !V8_TARGET_ARCH_LOONG64 && \
923
+ !V8_TARGET_ARCH_RISCV32
924
+ #if defined(_M_X64) || defined(__x86_64__)
925
+ #define V8_TARGET_ARCH_X64 1
926
+ #elif defined(_M_IX86) || defined(__i386__)
927
+ #define V8_TARGET_ARCH_IA32 1
928
+ #elif defined(__AARCH64EL__) || defined(_M_ARM64)
929
+ #define V8_TARGET_ARCH_ARM64 1
930
+ #elif defined(__ARMEL__)
931
+ #define V8_TARGET_ARCH_ARM 1
932
+ #elif defined(__mips64)
933
+ #define V8_TARGET_ARCH_MIPS64 1
934
+ #elif defined(__loongarch_lp64)
935
+ #define V8_TARGET_ARCH_LOONG64 1
936
+ #elif defined(_ARCH_PPC64)
937
+ #define V8_TARGET_ARCH_PPC64 1
938
+ #elif defined(__s390x__)
939
+ #define V8_TARGET_ARCH_S390X 1
940
+ #elif defined(__riscv) || defined(__riscv__)
941
+ #if __riscv_xlen == 64
942
+ #define V8_TARGET_ARCH_RISCV64 1
943
+ #elif __riscv_xlen == 32
944
+ #define V8_TARGET_ARCH_RISCV32 1
945
+ #endif
946
+ #else
947
+ #error Target architecture was not detected as supported by v8
948
+ #endif
949
+ #endif
950
+
951
+ // Determine architecture pointer size.
952
+ #if V8_TARGET_ARCH_IA32
953
+ #define V8_TARGET_ARCH_32_BIT 1
954
+ #elif V8_TARGET_ARCH_X64
955
+ #if !V8_TARGET_ARCH_32_BIT && !V8_TARGET_ARCH_64_BIT
956
+ #if defined(__x86_64__) && __SIZEOF_POINTER__ == 4 // Check for x32.
957
+ #define V8_TARGET_ARCH_32_BIT 1
958
+ #else
959
+ #define V8_TARGET_ARCH_64_BIT 1
960
+ #endif
961
+ #endif
962
+ #elif V8_TARGET_ARCH_ARM
963
+ #define V8_TARGET_ARCH_32_BIT 1
964
+ #elif V8_TARGET_ARCH_ARM64
965
+ #define V8_TARGET_ARCH_64_BIT 1
966
+ #elif V8_TARGET_ARCH_MIPS64
967
+ #define V8_TARGET_ARCH_64_BIT 1
968
+ #elif V8_TARGET_ARCH_LOONG64
969
+ #define V8_TARGET_ARCH_64_BIT 1
970
+ #elif V8_TARGET_ARCH_PPC64
971
+ #define V8_TARGET_ARCH_64_BIT 1
972
+ #elif V8_TARGET_ARCH_S390X
973
+ #define V8_TARGET_ARCH_64_BIT 1
974
+ #elif V8_TARGET_ARCH_RISCV64
975
+ #define V8_TARGET_ARCH_64_BIT 1
976
+ #elif V8_TARGET_ARCH_RISCV32
977
+ #define V8_TARGET_ARCH_32_BIT 1
978
+ #else
979
+ #error Unknown target architecture pointer size
980
+ #endif
981
+
982
+ // Check for supported combinations of host and target architectures.
983
+ #if V8_TARGET_ARCH_IA32 && !V8_HOST_ARCH_IA32
984
+ #error Target architecture ia32 is only supported on ia32 host
985
+ #endif
986
+ #if (V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_64_BIT && \
987
+ !((V8_HOST_ARCH_X64 || V8_HOST_ARCH_ARM64) && V8_HOST_ARCH_64_BIT))
988
+ #error Target architecture x64 is only supported on x64 and arm64 host
989
+ #endif
990
+ #if (V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_32_BIT && \
991
+ !(V8_HOST_ARCH_X64 && V8_HOST_ARCH_32_BIT))
992
+ #error Target architecture x32 is only supported on x64 host with x32 support
993
+ #endif
994
+ #if (V8_TARGET_ARCH_ARM && !(V8_HOST_ARCH_IA32 || V8_HOST_ARCH_ARM))
995
+ #error Target architecture arm is only supported on arm and ia32 host
996
+ #endif
997
+ #if (V8_TARGET_ARCH_ARM64 && !(V8_HOST_ARCH_X64 || V8_HOST_ARCH_ARM64))
998
+ #error Target architecture arm64 is only supported on arm64 and x64 host
999
+ #endif
1000
+ #if (V8_TARGET_ARCH_MIPS64 && !(V8_HOST_ARCH_X64 || V8_HOST_ARCH_MIPS64))
1001
+ #error Target architecture mips64 is only supported on mips64 and x64 host
1002
+ #endif
1003
+ #if (V8_TARGET_ARCH_RISCV64 && \
1004
+ !(V8_HOST_ARCH_X64 || V8_HOST_ARCH_ARM64 || V8_HOST_ARCH_RISCV64))
1005
+ #error Target architecture riscv64 is only supported on riscv64, x64, and \
1006
+ arm64 host
1007
+ #endif
1008
+ #if (V8_TARGET_ARCH_RISCV32 && !(V8_HOST_ARCH_IA32 || V8_HOST_ARCH_RISCV32))
1009
+ #error Target architecture riscv32 is only supported on riscv32 and ia32 host
1010
+ #endif
1011
+ #if (V8_TARGET_ARCH_LOONG64 && !(V8_HOST_ARCH_X64 || V8_HOST_ARCH_LOONG64))
1012
+ #error Target architecture loong64 is only supported on loong64 and x64 host
1013
+ #endif
1014
+
1015
+ // Determine architecture endianness.
1016
+ #if V8_TARGET_ARCH_IA32
1017
+ #define V8_TARGET_LITTLE_ENDIAN 1
1018
+ #elif V8_TARGET_ARCH_X64
1019
+ #define V8_TARGET_LITTLE_ENDIAN 1
1020
+ #elif V8_TARGET_ARCH_ARM
1021
+ #define V8_TARGET_LITTLE_ENDIAN 1
1022
+ #elif V8_TARGET_ARCH_ARM64
1023
+ #define V8_TARGET_LITTLE_ENDIAN 1
1024
+ #elif V8_TARGET_ARCH_LOONG64
1025
+ #define V8_TARGET_LITTLE_ENDIAN 1
1026
+ #elif V8_TARGET_ARCH_MIPS64
1027
+ #if defined(__MIPSEB__) || defined(V8_TARGET_ARCH_MIPS64_BE)
1028
+ #define V8_TARGET_BIG_ENDIAN 1
1029
+ #else
1030
+ #define V8_TARGET_LITTLE_ENDIAN 1
1031
+ #endif
1032
+ #elif V8_TARGET_ARCH_PPC64
1033
+ #if V8_OS_AIX
1034
+ #define V8_TARGET_BIG_ENDIAN 1
1035
+ #else
1036
+ #define V8_TARGET_LITTLE_ENDIAN 1
1037
+ #endif
1038
+ #elif V8_TARGET_ARCH_S390X
1039
+ #if V8_TARGET_ARCH_S390X_LE_SIM
1040
+ #define V8_TARGET_LITTLE_ENDIAN 1
1041
+ #else
1042
+ #define V8_TARGET_BIG_ENDIAN 1
1043
+ #endif
1044
+ #elif V8_TARGET_ARCH_RISCV32 || V8_TARGET_ARCH_RISCV64
1045
+ #define V8_TARGET_LITTLE_ENDIAN 1
1046
+ #elif defined(__BYTE_ORDER__)
1047
+ #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
1048
+ #define V8_TARGET_BIG_ENDIAN 1
1049
+ #else
1050
+ #define V8_TARGET_LITTLE_ENDIAN 1
1051
+ #endif
1052
+ #else
1053
+ #error Unknown target architecture endianness
1054
+ #endif
1055
+
1056
+ #undef V8_HAS_CPP_ATTRIBUTE
1057
+
1058
+ #if !defined(V8_STATIC_ROOTS)
1059
+ #define V8_STATIC_ROOTS_BOOL false
1060
+ #else
1061
+ #define V8_STATIC_ROOTS_BOOL true
1062
+ #endif
1063
+ #ifdef V8_TARGET_BIG_ENDIAN
1064
+ #define V8_TARGET_BIG_ENDIAN_BOOL true
1065
+ #else
1066
+ #define V8_TARGET_BIG_ENDIAN_BOOL false
1067
+ #endif
1068
+
1069
+ // V8_USE_PERFETTO_SDK and V8_USE_PERFETTO_JSON_EXPORT must imply
1070
+ // V8_USE_PERFETTO.
1071
+ #if (defined(V8_USE_PERFETTO_SDK) || defined(V8_USE_PERFETTO_JSON_EXPORT)) && \
1072
+ !defined(V8_USE_PERFETTO)
1073
+ #error Inconsistent build configuration: To build the V8 with Perfetto \
1074
+ features, set V8_USE_PERFETTO as well.
1075
+ #endif
1076
+
1077
+ #endif // V8CONFIG_H_