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