File indexing completed on 2026-05-06 08:45:11
0001
0002
0003
0004
0005 #ifndef V8CONFIG_H_
0006 #define V8CONFIG_H_
0007
0008
0009
0010
0011
0012 #if __cplusplus <= 201703L
0013 #error "C++20 or later required."
0014 #endif
0015
0016 #ifdef V8_GN_HEADER
0017 #if !__has_include("v8-gn.h")
0018 #error Missing v8-gn.h. The configuration for v8 is missing from the include \
0019 path. Add it with -I<path> to the command line
0020 #endif
0021 #include "v8-gn.h" // NOLINT(build/include_directory)
0022 #endif
0023
0024 #include <memory>
0025
0026
0027
0028 #if defined(__ANDROID__)
0029 # include <sys/cdefs.h>
0030 #elif defined(__APPLE__)
0031 # include <TargetConditionals.h>
0032 #elif defined(__linux__)
0033 # include <features.h>
0034 #elif defined(__MVS__)
0035 # include "zos-base.h"
0036 #endif
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046 #if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
0047 # define V8_GLIBC_PREREQ(major, minor) \
0048 ((__GLIBC__ * 100 + __GLIBC_MINOR__) >= ((major) * 100 + (minor)))
0049 #else
0050 # define V8_GLIBC_PREREQ(major, minor) 0
0051 #endif
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061 #if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__)
0062 # define V8_GNUC_PREREQ(major, minor, patchlevel) \
0063 ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= \
0064 ((major) * 10000 + (minor) * 100 + (patchlevel)))
0065 #elif defined(__GNUC__) && defined(__GNUC_MINOR__)
0066 # define V8_GNUC_PREREQ(major, minor, patchlevel) \
0067 ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= \
0068 ((major) * 10000 + (minor) * 100 + (patchlevel)))
0069 #else
0070 # define V8_GNUC_PREREQ(major, minor, patchlevel) 0
0071 #endif
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098 #if defined(__ANDROID__)
0099 # define V8_OS_ANDROID 1
0100 # define V8_OS_LINUX 1
0101 # define V8_OS_POSIX 1
0102 # define V8_OS_STRING "android"
0103
0104 #elif defined(__APPLE__)
0105 # define V8_OS_POSIX 1
0106 # define V8_OS_BSD 1
0107 # define V8_OS_DARWIN 1
0108 # if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
0109 # define V8_OS_IOS 1
0110 # define V8_OS_STRING "ios"
0111 # else
0112 # define V8_OS_MACOS 1
0113 # define V8_OS_STRING "macos"
0114 # endif
0115
0116 #elif defined(__CYGWIN__)
0117 # define V8_OS_CYGWIN 1
0118 # define V8_OS_POSIX 1
0119 # define V8_OS_STRING "cygwin"
0120
0121 #elif defined(__linux__)
0122 # define V8_OS_LINUX 1
0123 # define V8_OS_POSIX 1
0124 # define V8_OS_STRING "linux"
0125
0126 #elif defined(__sun)
0127 # define V8_OS_POSIX 1
0128 # define V8_OS_SOLARIS 1
0129 # define V8_OS_STRING "sun"
0130
0131 #elif defined(STARBOARD)
0132 # define V8_OS_STARBOARD 1
0133 # define V8_OS_STRING "starboard"
0134
0135 #elif defined(_AIX)
0136 # define V8_OS_POSIX 1
0137 # define V8_OS_AIX 1
0138 # define V8_OS_STRING "aix"
0139
0140 #elif defined(__FreeBSD__)
0141 # define V8_OS_BSD 1
0142 # define V8_OS_FREEBSD 1
0143 # define V8_OS_POSIX 1
0144 # define V8_OS_STRING "freebsd"
0145
0146 #elif defined(__Fuchsia__)
0147 # define V8_OS_FUCHSIA 1
0148 # define V8_OS_POSIX 1
0149 # define V8_OS_STRING "fuchsia"
0150
0151 #elif defined(__DragonFly__)
0152 # define V8_OS_BSD 1
0153 # define V8_OS_DRAGONFLYBSD 1
0154 # define V8_OS_POSIX 1
0155 # define V8_OS_STRING "dragonflybsd"
0156
0157 #elif defined(__NetBSD__)
0158 # define V8_OS_BSD 1
0159 # define V8_OS_NETBSD 1
0160 # define V8_OS_POSIX 1
0161 # define V8_OS_STRING "netbsd"
0162
0163 #elif defined(__OpenBSD__)
0164 # define V8_OS_BSD 1
0165 # define V8_OS_OPENBSD 1
0166 # define V8_OS_POSIX 1
0167 # define V8_OS_STRING "openbsd"
0168
0169 #elif defined(__QNXNTO__)
0170 # define V8_OS_POSIX 1
0171 # define V8_OS_QNX 1
0172 # define V8_OS_STRING "qnx"
0173
0174 #elif defined(_WIN32)
0175 # define V8_OS_WIN 1
0176 # define V8_OS_STRING "windows"
0177
0178 #elif defined(__MVS__)
0179 # define V8_OS_POSIX 1
0180 # define V8_OS_ZOS 1
0181 # define V8_OS_STRING "zos"
0182 #endif
0183
0184
0185
0186
0187
0188
0189
0190
0191
0192
0193
0194
0195
0196
0197 #ifdef V8_HAVE_TARGET_OS
0198
0199
0200 # if !defined(V8_TARGET_OS_ANDROID) \
0201 && !defined(V8_TARGET_OS_FUCHSIA) \
0202 && !defined(V8_TARGET_OS_IOS) \
0203 && !defined(V8_TARGET_OS_LINUX) \
0204 && !defined(V8_TARGET_OS_MACOS) \
0205 && !defined(V8_TARGET_OS_WIN) \
0206 && !defined(V8_TARGET_OS_CHROMEOS)
0207 # error No known target OS defined.
0208 # endif
0209
0210 #else
0211
0212 # if defined(V8_TARGET_OS_ANDROID) \
0213 || defined(V8_TARGET_OS_FUCHSIA) \
0214 || defined(V8_TARGET_OS_IOS) \
0215 || defined(V8_TARGET_OS_LINUX) \
0216 || defined(V8_TARGET_OS_MACOS) \
0217 || defined(V8_TARGET_OS_WIN) \
0218 || defined(V8_TARGET_OS_CHROMEOS)
0219 # error A target OS is defined but V8_HAVE_TARGET_OS is unset.
0220 # endif
0221
0222
0223 #ifdef V8_OS_ANDROID
0224 # define V8_TARGET_OS_ANDROID
0225 #endif
0226
0227 #ifdef V8_OS_FUCHSIA
0228 # define V8_TARGET_OS_FUCHSIA
0229 #endif
0230
0231 #ifdef V8_OS_IOS
0232 # define V8_TARGET_OS_IOS
0233 #endif
0234
0235 #ifdef V8_OS_LINUX
0236 # define V8_TARGET_OS_LINUX
0237 #endif
0238
0239 #ifdef V8_OS_MACOS
0240 # define V8_TARGET_OS_MACOS
0241 #endif
0242
0243 #ifdef V8_OS_WIN
0244 # define V8_TARGET_OS_WIN
0245 #endif
0246
0247 #endif
0248
0249 #if defined(V8_TARGET_OS_ANDROID)
0250 # define V8_TARGET_OS_STRING "android"
0251 #elif defined(V8_TARGET_OS_FUCHSIA)
0252 # define V8_TARGET_OS_STRING "fuchsia"
0253 #elif defined(V8_TARGET_OS_IOS)
0254 # define V8_TARGET_OS_STRING "ios"
0255 #elif defined(V8_TARGET_OS_LINUX)
0256 # define V8_TARGET_OS_STRING "linux"
0257 #elif defined(V8_TARGET_OS_MACOS)
0258 # define V8_TARGET_OS_STRING "macos"
0259 #elif defined(V8_TARGET_OS_WINDOWS)
0260 # define V8_TARGET_OS_STRING "windows"
0261 #else
0262 # define V8_TARGET_OS_STRING "unknown"
0263 #endif
0264
0265
0266
0267
0268
0269
0270
0271
0272
0273
0274
0275
0276
0277
0278
0279
0280 #if defined (_MSC_VER)
0281 # define V8_LIBC_MSVCRT 1
0282 #elif defined(__BIONIC__)
0283 # define V8_LIBC_BIONIC 1
0284 # define V8_LIBC_BSD 1
0285 #elif defined(__UCLIBC__)
0286
0287 # define V8_LIBC_UCLIBC 1
0288 #elif defined(__GLIBC__) || defined(__GNU_LIBRARY__)
0289 # define V8_LIBC_GLIBC 1
0290 #else
0291 # define V8_LIBC_BSD V8_OS_BSD
0292 #endif
0293
0294
0295
0296
0297
0298
0299
0300
0301
0302
0303
0304
0305
0306
0307
0308
0309
0310
0311
0312
0313
0314
0315
0316
0317
0318
0319
0320
0321
0322
0323
0324
0325
0326
0327
0328
0329
0330
0331
0332
0333
0334
0335
0336
0337
0338
0339
0340
0341
0342
0343
0344
0345
0346
0347
0348
0349
0350
0351
0352
0353 #if defined(__has_cpp_attribute)
0354 #define V8_HAS_CPP_ATTRIBUTE(FEATURE) __has_cpp_attribute(FEATURE)
0355 #else
0356 #define V8_HAS_CPP_ATTRIBUTE(FEATURE) 0
0357 #endif
0358
0359 #if defined(__clang__)
0360
0361 #if defined(__GNUC__)
0362 # define V8_CC_GNU 1
0363 #endif
0364
0365 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline))
0366 # define V8_HAS_ATTRIBUTE_CONSTINIT \
0367 (__has_attribute(require_constant_initialization))
0368 # define V8_HAS_ATTRIBUTE_CONST (__has_attribute(const))
0369 # define V8_HAS_ATTRIBUTE_NONNULL (__has_attribute(nonnull))
0370 # define V8_HAS_ATTRIBUTE_NOINLINE (__has_attribute(noinline))
0371 # define V8_HAS_ATTRIBUTE_UNUSED (__has_attribute(unused))
0372 # define V8_HAS_ATTRIBUTE_USED (__has_attribute(used))
0373 # define V8_HAS_ATTRIBUTE_RETAIN (__has_attribute(retain))
0374 # define V8_HAS_ATTRIBUTE_OPTNONE (__has_attribute(optnone))
0375
0376
0377
0378
0379
0380
0381
0382
0383 #if (defined(_M_X64) || defined(__x86_64__) \
0384 || ((defined(__AARCH64EL__) || defined(_M_ARM64)) \
0385 && !defined(_WIN32))) \
0386 && !defined(COMPONENT_BUILD) \
0387 && __clang_major__ >= 17
0388 # define V8_HAS_ATTRIBUTE_PRESERVE_MOST (__has_attribute(preserve_most))
0389 #endif
0390 # define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility))
0391 # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
0392 (__has_attribute(warn_unused_result))
0393 # define V8_HAS_ATTRIBUTE_WEAK (__has_attribute(weak))
0394
0395 # define V8_HAS_CPP_ATTRIBUTE_NODISCARD (V8_HAS_CPP_ATTRIBUTE(nodiscard))
0396 #if defined(V8_CC_MSVC)
0397 # define V8_HAS_CPP_ATTRIBUTE_NO_UNIQUE_ADDRESS \
0398 (V8_HAS_CPP_ATTRIBUTE(msvc::no_unique_address) || \
0399 V8_HAS_CPP_ATTRIBUTE(no_unique_address))
0400 #else
0401 # define V8_HAS_CPP_ATTRIBUTE_NO_UNIQUE_ADDRESS \
0402 (V8_HAS_CPP_ATTRIBUTE(no_unique_address))
0403 #endif
0404
0405 # define V8_HAS_BUILTIN_ADD_OVERFLOW (__has_builtin(__builtin_add_overflow))
0406 # define V8_HAS_BUILTIN_ASSUME (__has_builtin(__builtin_assume))
0407 # define V8_HAS_BUILTIN_ASSUME_ALIGNED (__has_builtin(__builtin_assume_aligned))
0408 # define V8_HAS_BUILTIN_BIT_CAST (__has_builtin(__builtin_bit_cast))
0409 # define V8_HAS_BUILTIN_BSWAP16 (__has_builtin(__builtin_bswap16))
0410 # define V8_HAS_BUILTIN_BSWAP32 (__has_builtin(__builtin_bswap32))
0411 # define V8_HAS_BUILTIN_BSWAP64 (__has_builtin(__builtin_bswap64))
0412 # define V8_HAS_BUILTIN_CLZ (__has_builtin(__builtin_clz))
0413 # define V8_HAS_BUILTIN_CTZ (__has_builtin(__builtin_ctz))
0414 # define V8_HAS_BUILTIN_EXPECT (__has_builtin(__builtin_expect))
0415 # define V8_HAS_BUILTIN_FRAME_ADDRESS (__has_builtin(__builtin_frame_address))
0416 # define V8_HAS_BUILTIN_MUL_OVERFLOW (__has_builtin(__builtin_mul_overflow))
0417 # define V8_HAS_BUILTIN_POPCOUNT (__has_builtin(__builtin_popcount))
0418 # define V8_HAS_BUILTIN_SADD_OVERFLOW (__has_builtin(__builtin_sadd_overflow))
0419 # define V8_HAS_BUILTIN_SMUL_OVERFLOW (__has_builtin(__builtin_smul_overflow))
0420 # define V8_HAS_BUILTIN_SSUB_OVERFLOW (__has_builtin(__builtin_ssub_overflow))
0421 # define V8_HAS_BUILTIN_SUB_OVERFLOW (__has_builtin(__builtin_sub_overflow))
0422 # define V8_HAS_BUILTIN_UADD_OVERFLOW (__has_builtin(__builtin_uadd_overflow))
0423 # define V8_HAS_BUILTIN_UNREACHABLE (__has_builtin(__builtin_unreachable))
0424
0425
0426
0427 # define V8_HAS_COMPUTED_GOTO 1
0428
0429 #elif defined(__GNUC__)
0430
0431 # define V8_CC_GNU 1
0432 # if defined(__INTEL_COMPILER)
0433 # define V8_CC_INTEL 1
0434 # endif
0435 # if defined(__MINGW32__)
0436 # define V8_CC_MINGW32 1
0437 # endif
0438 # if defined(__MINGW64__)
0439 # define V8_CC_MINGW64 1
0440 # endif
0441 # define V8_CC_MINGW (V8_CC_MINGW32 || V8_CC_MINGW64)
0442
0443
0444
0445
0446
0447
0448
0449
0450
0451 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE 1
0452 # define V8_HAS_ATTRIBUTE_NOINLINE 1
0453 # define V8_HAS_ATTRIBUTE_UNUSED 1
0454 # define V8_HAS_ATTRIBUTE_VISIBILITY 1
0455 # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT (!V8_CC_INTEL)
0456 # define V8_HAS_ATTRIBUTE_WEAK 1
0457
0458
0459
0460
0461
0462 # define V8_HAS_BUILTIN_ASSUME_ALIGNED 1
0463 # if __GNUC__ >= 11
0464 # define V8_HAS_BUILTIN_BIT_CAST 1
0465 # endif
0466 # define V8_HAS_BUILTIN_CLZ 1
0467 # define V8_HAS_BUILTIN_CTZ 1
0468 # define V8_HAS_BUILTIN_EXPECT 1
0469 # define V8_HAS_BUILTIN_FRAME_ADDRESS 1
0470 # define V8_HAS_BUILTIN_POPCOUNT 1
0471 # define V8_HAS_BUILTIN_UNREACHABLE 1
0472
0473
0474 #define V8_HAS_COMPUTED_GOTO 1
0475
0476 #endif
0477
0478 #if defined(_MSC_VER)
0479 # define V8_CC_MSVC 1
0480
0481 # define V8_HAS_DECLSPEC_NOINLINE 1
0482 # define V8_HAS_DECLSPEC_SELECTANY 1
0483
0484 # define V8_HAS___FORCEINLINE 1
0485
0486 #endif
0487
0488
0489
0490
0491
0492
0493
0494
0495 #if !defined(DEBUG) && V8_HAS_ATTRIBUTE_ALWAYS_INLINE
0496 # define V8_INLINE inline __attribute__((always_inline))
0497 #elif !defined(DEBUG) && V8_HAS___FORCEINLINE
0498 # define V8_INLINE __forceinline
0499 #else
0500 # define V8_INLINE inline
0501 #endif
0502
0503
0504
0505
0506
0507 #if !defined(DEBUG) && defined(__clang__) && V8_HAS_ATTRIBUTE_ALWAYS_INLINE
0508 # define V8_INLINE_STATEMENT [[clang::always_inline]]
0509 #else
0510 # define V8_INLINE_STATEMENT
0511 #endif
0512
0513 #if V8_HAS_BUILTIN_ASSUME
0514 #ifdef DEBUG
0515
0516
0517
0518 # define V8_ASSUME(condition) \
0519 do { \
0520 DCHECK(condition); \
0521 __builtin_assume(condition); \
0522 } while (false)
0523 #else
0524 # define V8_ASSUME __builtin_assume
0525 #endif
0526 #elif V8_HAS_BUILTIN_UNREACHABLE
0527 # define V8_ASSUME(condition) \
0528 do { \
0529 DCHECK(condition); \
0530 if (!(condition)) __builtin_unreachable(); \
0531 } while (false)
0532 #else
0533 # define V8_ASSUME USE
0534 #endif
0535
0536
0537
0538 #if __cplusplus >= 202002L && defined(__cpp_lib_assume_aligned) && !V8_CC_MSVC
0539 # define V8_ASSUME_ALIGNED(ptr, alignment) \
0540 std::assume_aligned<(alignment)>(ptr)
0541 #elif V8_HAS_BUILTIN_ASSUME_ALIGNED
0542 # define V8_ASSUME_ALIGNED(ptr, alignment) \
0543 __builtin_assume_aligned((ptr), (alignment))
0544 #else
0545 # define V8_ASSUME_ALIGNED(ptr, alignment) (ptr)
0546 #endif
0547
0548
0549
0550
0551
0552 #if V8_HAS_ATTRIBUTE_CONST
0553 # define V8_CONST __attribute__((const))
0554 #else
0555 # define V8_CONST
0556 #endif
0557
0558
0559
0560
0561 #if V8_HAS_ATTRIBUTE_CONSTINIT
0562 # define V8_CONSTINIT __attribute__((require_constant_initialization))
0563 #else
0564 # define V8_CONSTINIT
0565 #endif
0566
0567
0568
0569
0570
0571 #if V8_HAS_ATTRIBUTE_NONNULL
0572 # define V8_NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
0573 #else
0574 # define V8_NONNULL(...)
0575 #endif
0576
0577
0578
0579
0580
0581 #if V8_HAS_ATTRIBUTE_NOINLINE
0582 # define V8_NOINLINE __attribute__((noinline))
0583 #elif V8_HAS_DECLSPEC_NOINLINE
0584 # define V8_NOINLINE __declspec(noinline)
0585 #else
0586 # define V8_NOINLINE
0587 #endif
0588
0589
0590
0591
0592
0593
0594
0595 #if V8_OS_WIN
0596 # define V8_PRESERVE_MOST
0597 #else
0598 #if V8_HAS_ATTRIBUTE_PRESERVE_MOST
0599 # define V8_PRESERVE_MOST __attribute__((preserve_most))
0600 #else
0601 # define V8_PRESERVE_MOST
0602 #endif
0603 #endif
0604
0605
0606
0607 #if defined(V8_DEPRECATION_WARNINGS)
0608 # define V8_DEPRECATED(message) [[deprecated(message)]]
0609 #else
0610 # define V8_DEPRECATED(message)
0611 #endif
0612
0613
0614
0615 #if defined(V8_IMMINENT_DEPRECATION_WARNINGS)
0616 # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
0617 #else
0618 # define V8_DEPRECATE_SOON(message)
0619 #endif
0620
0621
0622 #if defined(V8_IMMINENT_DEPRECATION_WARNINGS) || \
0623 defined(V8_DEPRECATION_WARNINGS)
0624 #if defined(V8_CC_MSVC)
0625 # define START_ALLOW_USE_DEPRECATED() \
0626 __pragma(warning(push)) \
0627 __pragma(warning(disable : 4996))
0628 # define END_ALLOW_USE_DEPRECATED() __pragma(warning(pop))
0629 #else
0630 # define START_ALLOW_USE_DEPRECATED() \
0631 _Pragma("GCC diagnostic push") \
0632 _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
0633 #define END_ALLOW_USE_DEPRECATED() _Pragma("GCC diagnostic pop")
0634 #endif
0635 #else
0636
0637 #define START_ALLOW_USE_DEPRECATED()
0638 #define END_ALLOW_USE_DEPRECATED()
0639 #endif
0640
0641 #define ALLOW_COPY_AND_MOVE_WITH_DEPRECATED_FIELDS(ClassName) \
0642 START_ALLOW_USE_DEPRECATED() \
0643 ClassName(const ClassName&) = default; \
0644 ClassName(ClassName&&) = default; \
0645 ClassName& operator=(const ClassName&) = default; \
0646 ClassName& operator=(ClassName&&) = default; \
0647 END_ALLOW_USE_DEPRECATED()
0648
0649
0650 #if defined(__GNUC__) && !defined(__clang__) && (__GNUC__ < 6)
0651 # define V8_ENUM_DEPRECATED(message)
0652 # define V8_ENUM_DEPRECATE_SOON(message)
0653 #else
0654 # define V8_ENUM_DEPRECATED(message) V8_DEPRECATED(message)
0655 # define V8_ENUM_DEPRECATE_SOON(message) V8_DEPRECATE_SOON(message)
0656 #endif
0657
0658
0659
0660 #if V8_HAS_BUILTIN_EXPECT
0661 # define V8_UNLIKELY(condition) (__builtin_expect(!!(condition), 0))
0662 # define V8_LIKELY(condition) (__builtin_expect(!!(condition), 1))
0663 #else
0664 # define V8_UNLIKELY(condition) (condition)
0665 # define V8_LIKELY(condition) (condition)
0666 #endif
0667
0668
0669
0670
0671
0672 #if V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT
0673 #define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
0674 #else
0675 #define V8_WARN_UNUSED_RESULT
0676 #endif
0677
0678
0679
0680 #if V8_HAS_ATTRIBUTE_WEAK
0681 #define V8_WEAK __attribute__((weak))
0682 #else
0683 #define V8_WEAK
0684 #endif
0685
0686
0687
0688
0689
0690
0691
0692
0693
0694 #if V8_HAS_CPP_ATTRIBUTE_NODISCARD
0695 #define V8_NODISCARD [[nodiscard]]
0696 #else
0697 #define V8_NODISCARD
0698 #endif
0699
0700
0701
0702
0703
0704
0705
0706
0707
0708
0709
0710
0711
0712
0713
0714
0715 #if V8_HAS_CPP_ATTRIBUTE_NO_UNIQUE_ADDRESS
0716 #if defined(V8_CC_MSVC) && V8_HAS_CPP_ATTRIBUTE(msvc::no_unique_address)
0717
0718
0719
0720
0721 #define V8_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]]
0722 #else
0723 #define V8_NO_UNIQUE_ADDRESS [[no_unique_address]]
0724 #endif
0725 #else
0726 #define V8_NO_UNIQUE_ADDRESS
0727 #endif
0728
0729
0730
0731
0732
0733
0734
0735
0736
0737
0738
0739
0740
0741
0742
0743
0744
0745
0746
0747
0748
0749
0750
0751 #if defined(__clang__) && defined(__has_attribute)
0752 #if __has_attribute(trivial_abi)
0753 #define V8_TRIVIAL_ABI [[clang::trivial_abi]]
0754 #define V8_HAS_ATTRIBUTE_TRIVIAL_ABI 1
0755 #endif
0756 #endif
0757 #if !defined(V8_TRIVIAL_ABI)
0758 #define V8_TRIVIAL_ABI
0759 #define V8_HAS_ATTRIBUTE_TRIVIAL_ABI 0
0760 #endif
0761
0762
0763 #if defined(__clang__) && defined(__has_attribute)
0764 #if __has_attribute(no_sanitize)
0765 #define V8_CLANG_NO_SANITIZE(what) __attribute__((no_sanitize(what)))
0766 #endif
0767 #endif
0768 #if !defined(V8_CLANG_NO_SANITIZE)
0769 #define V8_CLANG_NO_SANITIZE(what)
0770 #endif
0771
0772
0773 #ifdef BUILDING_V8_SHARED_PRIVATE
0774 #define BUILDING_V8_SHARED
0775 #endif
0776
0777 #if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
0778 #error Inconsistent build configuration: To build the V8 shared library \
0779 set BUILDING_V8_SHARED, to include its headers for linking against the \
0780 V8 shared library set USING_V8_SHARED.
0781 #endif
0782
0783 #ifdef V8_OS_WIN
0784
0785
0786
0787
0788
0789
0790 #ifdef BUILDING_V8_SHARED
0791 # define V8_EXPORT __declspec(dllexport)
0792 #elif USING_V8_SHARED
0793 # define V8_EXPORT __declspec(dllimport)
0794 #else
0795 # define V8_EXPORT
0796 #endif
0797
0798 #else
0799
0800
0801 #if V8_HAS_ATTRIBUTE_VISIBILITY && (defined(BUILDING_V8_SHARED) || USING_V8_SHARED)
0802 # define V8_EXPORT __attribute__((visibility("default")))
0803 #else
0804 # define V8_EXPORT
0805 # endif
0806
0807 #endif
0808
0809
0810
0811
0812
0813
0814
0815
0816
0817
0818 #if defined(_M_X64) || defined(__x86_64__)
0819 #define V8_HOST_ARCH_X64 1
0820 #if defined(__x86_64__) && __SIZEOF_POINTER__ == 4
0821 #define V8_HOST_ARCH_32_BIT 1
0822 #else
0823 #define V8_HOST_ARCH_64_BIT 1
0824 #endif
0825 #elif defined(_M_IX86) || defined(__i386__)
0826 #define V8_HOST_ARCH_IA32 1
0827 #define V8_HOST_ARCH_32_BIT 1
0828 #elif defined(__AARCH64EL__) || defined(_M_ARM64)
0829 #define V8_HOST_ARCH_ARM64 1
0830 #define V8_HOST_ARCH_64_BIT 1
0831 #elif defined(__ARMEL__)
0832 #define V8_HOST_ARCH_ARM 1
0833 #define V8_HOST_ARCH_32_BIT 1
0834 #elif defined(__mips64)
0835 #define V8_HOST_ARCH_MIPS64 1
0836 #define V8_HOST_ARCH_64_BIT 1
0837 #elif defined(__loongarch_lp64)
0838 #define V8_HOST_ARCH_LOONG64 1
0839 #define V8_HOST_ARCH_64_BIT 1
0840 #elif defined(__PPC64__) || defined(_ARCH_PPC64)
0841 #define V8_HOST_ARCH_PPC64 1
0842 #define V8_HOST_ARCH_64_BIT 1
0843 #elif defined(__s390x__)
0844 #define V8_HOST_ARCH_S390X 1
0845 #define V8_HOST_ARCH_64_BIT 1
0846 #elif defined(__riscv) || defined(__riscv__)
0847 #if __riscv_xlen == 64
0848 #define V8_HOST_ARCH_RISCV64 1
0849 #define V8_HOST_ARCH_64_BIT 1
0850 #elif __riscv_xlen == 32
0851 #define V8_HOST_ARCH_RISCV32 1
0852 #define V8_HOST_ARCH_32_BIT 1
0853 #else
0854 #error "Cannot detect Riscv's bitwidth"
0855 #endif
0856 #else
0857 #error "Host architecture was not detected as supported by v8"
0858 #endif
0859
0860
0861
0862
0863
0864
0865 #if !V8_TARGET_ARCH_X64 && !V8_TARGET_ARCH_IA32 && !V8_TARGET_ARCH_ARM && \
0866 !V8_TARGET_ARCH_ARM64 && !V8_TARGET_ARCH_MIPS64 && \
0867 !V8_TARGET_ARCH_PPC64 && !V8_TARGET_ARCH_S390X && \
0868 !V8_TARGET_ARCH_RISCV64 && !V8_TARGET_ARCH_LOONG64 && \
0869 !V8_TARGET_ARCH_RISCV32
0870 #if defined(_M_X64) || defined(__x86_64__)
0871 #define V8_TARGET_ARCH_X64 1
0872 #elif defined(_M_IX86) || defined(__i386__)
0873 #define V8_TARGET_ARCH_IA32 1
0874 #elif defined(__AARCH64EL__) || defined(_M_ARM64)
0875 #define V8_TARGET_ARCH_ARM64 1
0876 #elif defined(__ARMEL__)
0877 #define V8_TARGET_ARCH_ARM 1
0878 #elif defined(__mips64)
0879 #define V8_TARGET_ARCH_MIPS64 1
0880 #elif defined(__loongarch_lp64)
0881 #define V8_TARGET_ARCH_LOONG64 1
0882 #elif defined(_ARCH_PPC64)
0883 #define V8_TARGET_ARCH_PPC64 1
0884 #elif defined(__s390x__)
0885 #define V8_TARGET_ARCH_S390X 1
0886 #elif defined(__riscv) || defined(__riscv__)
0887 #if __riscv_xlen == 64
0888 #define V8_TARGET_ARCH_RISCV64 1
0889 #elif __riscv_xlen == 32
0890 #define V8_TARGET_ARCH_RISCV32 1
0891 #endif
0892 #else
0893 #error Target architecture was not detected as supported by v8
0894 #endif
0895 #endif
0896
0897
0898 #if V8_TARGET_ARCH_IA32
0899 #define V8_TARGET_ARCH_32_BIT 1
0900 #elif V8_TARGET_ARCH_X64
0901 #if !V8_TARGET_ARCH_32_BIT && !V8_TARGET_ARCH_64_BIT
0902 #if defined(__x86_64__) && __SIZEOF_POINTER__ == 4
0903 #define V8_TARGET_ARCH_32_BIT 1
0904 #else
0905 #define V8_TARGET_ARCH_64_BIT 1
0906 #endif
0907 #endif
0908 #elif V8_TARGET_ARCH_ARM
0909 #define V8_TARGET_ARCH_32_BIT 1
0910 #elif V8_TARGET_ARCH_ARM64
0911 #define V8_TARGET_ARCH_64_BIT 1
0912 #elif V8_TARGET_ARCH_MIPS
0913 #define V8_TARGET_ARCH_32_BIT 1
0914 #elif V8_TARGET_ARCH_MIPS64
0915 #define V8_TARGET_ARCH_64_BIT 1
0916 #elif V8_TARGET_ARCH_LOONG64
0917 #define V8_TARGET_ARCH_64_BIT 1
0918 #elif V8_TARGET_ARCH_PPC64
0919 #define V8_TARGET_ARCH_64_BIT 1
0920 #elif V8_TARGET_ARCH_S390X
0921 #define V8_TARGET_ARCH_64_BIT 1
0922 #elif V8_TARGET_ARCH_RISCV64
0923 #define V8_TARGET_ARCH_64_BIT 1
0924 #elif V8_TARGET_ARCH_RISCV32
0925 #define V8_TARGET_ARCH_32_BIT 1
0926 #else
0927 #error Unknown target architecture pointer size
0928 #endif
0929
0930
0931 #if V8_TARGET_ARCH_IA32 && !V8_HOST_ARCH_IA32
0932 #error Target architecture ia32 is only supported on ia32 host
0933 #endif
0934 #if (V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_64_BIT && \
0935 !((V8_HOST_ARCH_X64 || V8_HOST_ARCH_ARM64) && V8_HOST_ARCH_64_BIT))
0936 #error Target architecture x64 is only supported on x64 and arm64 host
0937 #endif
0938 #if (V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_32_BIT && \
0939 !(V8_HOST_ARCH_X64 && V8_HOST_ARCH_32_BIT))
0940 #error Target architecture x32 is only supported on x64 host with x32 support
0941 #endif
0942 #if (V8_TARGET_ARCH_ARM && !(V8_HOST_ARCH_IA32 || V8_HOST_ARCH_ARM))
0943 #error Target architecture arm is only supported on arm and ia32 host
0944 #endif
0945 #if (V8_TARGET_ARCH_ARM64 && !(V8_HOST_ARCH_X64 || V8_HOST_ARCH_ARM64))
0946 #error Target architecture arm64 is only supported on arm64 and x64 host
0947 #endif
0948 #if (V8_TARGET_ARCH_MIPS64 && !(V8_HOST_ARCH_X64 || V8_HOST_ARCH_MIPS64))
0949 #error Target architecture mips64 is only supported on mips64 and x64 host
0950 #endif
0951 #if (V8_TARGET_ARCH_RISCV64 && !(V8_HOST_ARCH_X64 || V8_HOST_ARCH_RISCV64))
0952 #error Target architecture riscv64 is only supported on riscv64 and x64 host
0953 #endif
0954 #if (V8_TARGET_ARCH_RISCV32 && !(V8_HOST_ARCH_IA32 || V8_HOST_ARCH_RISCV32))
0955 #error Target architecture riscv32 is only supported on riscv32 and ia32 host
0956 #endif
0957 #if (V8_TARGET_ARCH_LOONG64 && !(V8_HOST_ARCH_X64 || V8_HOST_ARCH_LOONG64))
0958 #error Target architecture loong64 is only supported on loong64 and x64 host
0959 #endif
0960
0961
0962 #if V8_TARGET_ARCH_IA32
0963 #define V8_TARGET_LITTLE_ENDIAN 1
0964 #elif V8_TARGET_ARCH_X64
0965 #define V8_TARGET_LITTLE_ENDIAN 1
0966 #elif V8_TARGET_ARCH_ARM
0967 #define V8_TARGET_LITTLE_ENDIAN 1
0968 #elif V8_TARGET_ARCH_ARM64
0969 #define V8_TARGET_LITTLE_ENDIAN 1
0970 #elif V8_TARGET_ARCH_LOONG64
0971 #define V8_TARGET_LITTLE_ENDIAN 1
0972 #elif V8_TARGET_ARCH_MIPS64
0973 #if defined(__MIPSEB__) || defined(V8_TARGET_ARCH_MIPS64_BE)
0974 #define V8_TARGET_BIG_ENDIAN 1
0975 #else
0976 #define V8_TARGET_LITTLE_ENDIAN 1
0977 #endif
0978 #elif V8_TARGET_ARCH_PPC64
0979 #if V8_OS_AIX
0980 #define V8_TARGET_BIG_ENDIAN 1
0981 #else
0982 #define V8_TARGET_LITTLE_ENDIAN 1
0983 #endif
0984 #elif V8_TARGET_ARCH_S390X
0985 #if V8_TARGET_ARCH_S390X_LE_SIM
0986 #define V8_TARGET_LITTLE_ENDIAN 1
0987 #else
0988 #define V8_TARGET_BIG_ENDIAN 1
0989 #endif
0990 #elif V8_TARGET_ARCH_RISCV32 || V8_TARGET_ARCH_RISCV64
0991 #define V8_TARGET_LITTLE_ENDIAN 1
0992 #elif defined(__BYTE_ORDER__)
0993 #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
0994 #define V8_TARGET_BIG_ENDIAN 1
0995 #else
0996 #define V8_TARGET_LITTLE_ENDIAN 1
0997 #endif
0998 #else
0999 #error Unknown target architecture endianness
1000 #endif
1001
1002 #undef V8_HAS_CPP_ATTRIBUTE
1003
1004 #if !defined(V8_STATIC_ROOTS)
1005 #define V8_STATIC_ROOTS_BOOL false
1006 #else
1007 #define V8_STATIC_ROOTS_BOOL true
1008 #endif
1009 #ifdef V8_TARGET_BIG_ENDIAN
1010 #define V8_TARGET_BIG_ENDIAN_BOOL true
1011 #else
1012 #define V8_TARGET_BIG_ENDIAN_BOOL false
1013 #endif
1014
1015 #endif