Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 10:05:27

0001 // Copyright 2013 the V8 project authors. All rights reserved.
0002 // Use of this source code is governed by a BSD-style license that can be
0003 // found in the LICENSE file.
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 // clang-format off
0018 
0019 // Platform headers for feature detection below.
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 // This macro allows to test for the version of the GNU C library (or
0030 // a compatible C library that masquerades as glibc). It evaluates to
0031 // 0 if libc is not GNU libc or compatible.
0032 // Use like:
0033 //  #if V8_GLIBC_PREREQ(2, 3)
0034 //   ...
0035 //  #endif
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 // This macro allows to test for the version of the GNU C++ compiler.
0045 // Note that this also applies to compilers that masquerade as GCC,
0046 // for example clang and the Intel C++ compiler for Linux.
0047 // Use like:
0048 //  #if V8_GNUC_PREREQ(4, 3, 1)
0049 //   ...
0050 //  #endif
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 // Operating system detection (host)
0067 //
0068 //  V8_OS_ANDROID       - Android
0069 //  V8_OS_BSD           - BSDish (macOS, Net/Free/Open/DragonFlyBSD)
0070 //  V8_OS_CYGWIN        - Cygwin
0071 //  V8_OS_DRAGONFLYBSD  - DragonFlyBSD
0072 //  V8_OS_FREEBSD       - FreeBSD
0073 //  V8_OS_FUCHSIA       - Fuchsia
0074 //  V8_OS_LINUX         - Linux (Android, ChromeOS, Linux, ...)
0075 //  V8_OS_DARWIN        - Darwin (macOS, iOS)
0076 //  V8_OS_MACOS         - macOS
0077 //  V8_OS_IOS           - iOS
0078 //  V8_OS_NETBSD        - NetBSD
0079 //  V8_OS_OPENBSD       - OpenBSD
0080 //  V8_OS_POSIX         - POSIX compatible (mostly everything except Windows)
0081 //  V8_OS_QNX           - QNX Neutrino
0082 //  V8_OS_SOLARIS       - Sun Solaris and OpenSolaris
0083 //  V8_OS_STARBOARD     - Starboard (platform abstraction for Cobalt)
0084 //  V8_OS_AIX           - AIX
0085 //  V8_OS_WIN           - Microsoft Windows
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  // defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
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 // Operating system detection (target)
0170 //
0171 //  V8_TARGET_OS_ANDROID
0172 //  V8_TARGET_OS_FUCHSIA
0173 //  V8_TARGET_OS_IOS
0174 //  V8_TARGET_OS_LINUX
0175 //  V8_TARGET_OS_MACOS
0176 //  V8_TARGET_OS_WIN
0177 //  V8_TARGET_OS_CHROMEOS
0178 //
0179 // If not set explicitly, these fall back to corresponding V8_OS_ values.
0180 
0181 #ifdef V8_HAVE_TARGET_OS
0182 
0183 // The target OS is provided, just check that at least one known value is set.
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  // V8_HAVE_TARGET_OS
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 // Fall back to the detected host OS.
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  // V8_HAVE_TARGET_OS
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 // C library detection
0251 //
0252 //  V8_LIBC_MSVCRT  - MSVC libc
0253 //  V8_LIBC_BIONIC  - Bionic libc
0254 //  V8_LIBC_BSD     - BSD libc derivate
0255 //  V8_LIBC_GLIBC   - GNU C library
0256 //  V8_LIBC_UCLIBC  - uClibc
0257 //
0258 // Note that testing for libc must be done using #if not #ifdef. For example,
0259 // to test for the GNU C library, use:
0260 //  #if V8_LIBC_GLIBC
0261 //   ...
0262 //  #endif
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 // Must test for UCLIBC before GLIBC, as UCLIBC pretends to be GLIBC.
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 // Compiler detection
0281 //
0282 //  V8_CC_GNU     - GCC, or clang in gcc mode
0283 //  V8_CC_INTEL   - Intel C++
0284 //  V8_CC_MINGW   - Minimalist GNU for Windows
0285 //  V8_CC_MINGW32 - Minimalist GNU for Windows (mingw32)
0286 //  V8_CC_MINGW64 - Minimalist GNU for Windows (mingw-w64)
0287 //  V8_CC_MSVC    - Microsoft Visual C/C++, or clang in cl.exe mode
0288 //
0289 // C++11 feature detection
0290 //
0291 // Compiler-specific feature detection
0292 //
0293 //  V8_HAS_ATTRIBUTE_ALWAYS_INLINE      - __attribute__((always_inline))
0294 //                                        supported
0295 //  V8_HAS_ATTRIBUTE_CONSTINIT          - __attribute__((require_constant_
0296 //                                                       initialization))
0297 //                                        supported
0298 //  V8_HAS_ATTRIBUTE_NONNULL            - __attribute__((nonnull)) supported
0299 //  V8_HAS_ATTRIBUTE_NOINLINE           - __attribute__((noinline)) supported
0300 //  V8_HAS_ATTRIBUTE_UNUSED             - __attribute__((unused)) supported
0301 //  V8_HAS_ATTRIBUTE_USED               - __attribute__((used)) supported
0302 //  V8_HAS_ATTRIBUTE_RETAIN             - __attribute__((retain)) supported
0303 //  V8_HAS_ATTRIBUTE_VISIBILITY         - __attribute__((visibility)) supported
0304 //  V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT - __attribute__((warn_unused_result))
0305 //                                        supported
0306 //  V8_HAS_CPP_ATTRIBUTE_NODISCARD      - [[nodiscard]] supported
0307 //  V8_HAS_CPP_ATTRIBUTE_NO_UNIQUE_ADDRESS
0308 //                                      - [[no_unique_address]] supported
0309 //  V8_HAS_BUILTIN_ADD_OVERFLOW         - __builtin_add_overflow() supported
0310 //  V8_HAS_BUILTIN_BIT_CAST             - __builtin_bit_cast() supported
0311 //  V8_HAS_BUILTIN_BSWAP16              - __builtin_bswap16() supported
0312 //  V8_HAS_BUILTIN_BSWAP32              - __builtin_bswap32() supported
0313 //  V8_HAS_BUILTIN_BSWAP64              - __builtin_bswap64() supported
0314 //  V8_HAS_BUILTIN_CLZ                  - __builtin_clz() supported
0315 //  V8_HAS_BUILTIN_CTZ                  - __builtin_ctz() supported
0316 //  V8_HAS_BUILTIN_EXPECT               - __builtin_expect() supported
0317 //  V8_HAS_BUILTIN_FRAME_ADDRESS        - __builtin_frame_address() supported
0318 //  V8_HAS_BUILTIN_MUL_OVERFLOW         - __builtin_mul_overflow() supported
0319 //  V8_HAS_BUILTIN_POPCOUNT             - __builtin_popcount() supported
0320 //  V8_HAS_BUILTIN_SADD_OVERFLOW        - __builtin_sadd_overflow() supported
0321 //  V8_HAS_BUILTIN_SMUL_OVERFLOW        - __builtin_smul_overflow() supported
0322 //  V8_HAS_BUILTIN_SSUB_OVERFLOW        - __builtin_ssub_overflow() supported
0323 //  V8_HAS_BUILTIN_SUB_OVERFLOW         - __builtin_sub_overflow() supported
0324 //  V8_HAS_BUILTIN_UADD_OVERFLOW        - __builtin_uadd_overflow() supported
0325 //  V8_HAS_COMPUTED_GOTO                - computed goto/labels as values
0326 //                                        supported
0327 //  V8_HAS_DECLSPEC_NOINLINE            - __declspec(noinline) supported
0328 //  V8_HAS_DECLSPEC_SELECTANY           - __declspec(selectany) supported
0329 //  V8_HAS___FORCEINLINE                - __forceinline supported
0330 //
0331 // Note that testing for compilers and/or features must be done using #if
0332 // not #ifdef. For example, to test for Intel C++ Compiler, use:
0333 //  #if V8_CC_INTEL
0334 //   ...
0335 //  #endif
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__)  // Clang in gcc mode.
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 // Support for the "preserve_most" attribute is limited:
0359 // - 32-bit platforms do not implement it,
0360 // - component builds fail because _dl_runtime_resolve clobbers registers,
0361 // - we see crashes on arm64 on Windows (https://crbug.com/1409934), which can
0362 //   hopefully be fixed in the future.
0363 // Additionally, the initial implementation in clang <= 16 overwrote the return
0364 // register(s) in the epilogue of a preserve_most function, so we only use
0365 // preserve_most in clang >= 17 (see https://reviews.llvm.org/D143425).
0366 #if (defined(_M_X64) || defined(__x86_64__)            /* x64 (everywhere) */  \
0367      || ((defined(__AARCH64EL__) || defined(_M_ARM64)) /* arm64, but ... */    \
0368          && !defined(_WIN32)))                         /* not on windows */    \
0369      && !defined(COMPONENT_BUILD)                      /* no component build */\
0370      && __clang_major__ >= 17                          /* clang >= 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 // Clang has no __has_feature for computed gotos.
0403 // GCC doc: https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
0404 # define V8_HAS_COMPUTED_GOTO 1
0405 
0406 #elif defined(__GNUC__)
0407 
0408 # define V8_CC_GNU 1
0409 # if defined(__INTEL_COMPILER)  // Intel C++ also masquerades as GCC 3.2.0
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 // FYI: __has_builtin is only available with GCC 10 and later, so explicitly
0421 // check GCC version numbers to enable features. TODO(leszeks): Merge feature
0422 // enabling for GCC 10 and later into the Clang section above, and leave this
0423 // section for GCC 9 and earlier.
0424 
0425 // always_inline is available in gcc 4.0 but not very reliable until 4.4.
0426 // Works around "sorry, unimplemented: inlining failed" build errors with
0427 // older compilers.
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 // [[nodiscard]] does not work together with with
0436 // __attribute__((visibility(""))) on GCC 7.4 which is why there is no define
0437 // for V8_HAS_CPP_ATTRIBUTE_NODISCARD. See https://crbug.com/v8/11707.
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 // GCC doc: https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
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 // Helper macros
0468 
0469 // A macro used to make better inlining. Don't bother for debug builds.
0470 // Use like:
0471 //   V8_INLINE int GetZero() { return 0; }
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 // In debug mode, check assumptions instead of actually adding annotations.
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 // Prefer c++20 std::assume_aligned
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 // A macro to mark functions whose values don't change (e.g. across calls)
0506 // and thereby compiler is free to hoist and fold multiple calls together.
0507 // Use like:
0508 //   V8_CONST int foo() { ... }
0509 #if V8_HAS_ATTRIBUTE_CONST
0510 # define V8_CONST __attribute__((const))
0511 #else
0512 # define V8_CONST
0513 #endif
0514 
0515 // A macro to mark a declaration as requiring constant initialization.
0516 // Use like:
0517 //   int* foo V8_CONSTINIT;
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 // A macro to mark specific arguments as non-null.
0526 // Use like:
0527 //   int add(int* x, int y, int* z) V8_NONNULL(1, 3) { return *x + y + *z; }
0528 #if V8_HAS_ATTRIBUTE_NONNULL
0529 # define V8_NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
0530 #else
0531 # define V8_NONNULL(...) /* NOT SUPPORTED */
0532 #endif
0533 
0534 
0535 // A macro used to tell the compiler to never inline a particular function.
0536 // Use like:
0537 //   V8_NOINLINE int GetMinusOne() { return -1; }
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 /* NOT SUPPORTED */
0544 #endif
0545 
0546 
0547 // A macro used to change the calling conventions to preserve all registers (no
0548 // caller-saved registers). Use this for cold functions called from hot
0549 // functions.
0550 // Use like:
0551 //   V8_NOINLINE V8_PRESERVE_MOST void UnlikelyMethod();
0552 #if V8_HAS_ATTRIBUTE_PRESERVE_MOST
0553 # define V8_PRESERVE_MOST __attribute__((preserve_most))
0554 #else
0555 # define V8_PRESERVE_MOST /* NOT SUPPORTED */
0556 #endif
0557 
0558 
0559 // A macro (V8_DEPRECATED) to mark classes or functions as deprecated.
0560 #if defined(V8_DEPRECATION_WARNINGS)
0561 # define V8_DEPRECATED(message) [[deprecated(message)]]
0562 #else
0563 # define V8_DEPRECATED(message)
0564 #endif
0565 
0566 
0567 // A macro (V8_DEPRECATE_SOON) to make it easier to see what will be deprecated.
0568 #if defined(V8_IMMINENT_DEPRECATION_WARNINGS)
0569 # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
0570 #else
0571 # define V8_DEPRECATE_SOON(message)
0572 #endif
0573 
0574 
0575 #if defined(V8_IMMINENT_DEPRECATION_WARNINGS) || \
0576     defined(V8_DEPRECATION_WARNINGS)
0577 #if defined(V8_CC_MSVC)
0578 # define START_ALLOW_USE_DEPRECATED() \
0579     __pragma(warning(push))           \
0580     __pragma(warning(disable : 4996))
0581 # define END_ALLOW_USE_DEPRECATED() __pragma(warning(pop))
0582 #else  // !defined(V8_CC_MSVC)
0583 # define START_ALLOW_USE_DEPRECATED()                               \
0584     _Pragma("GCC diagnostic push")                                  \
0585     _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
0586 #define END_ALLOW_USE_DEPRECATED() _Pragma("GCC diagnostic pop")
0587 #endif  // !defined(V8_CC_MSVC)
0588 #else  // !(defined(V8_IMMINENT_DEPRECATION_WARNINGS) ||
0589        // defined(V8_DEPRECATION_WARNINGS))
0590 #define START_ALLOW_USE_DEPRECATED()
0591 #define END_ALLOW_USE_DEPRECATED()
0592 #endif  // !(defined(V8_IMMINENT_DEPRECATION_WARNINGS) ||
0593         // defined(V8_DEPRECATION_WARNINGS))
0594 #define ALLOW_COPY_AND_MOVE_WITH_DEPRECATED_FIELDS(ClassName) \
0595   START_ALLOW_USE_DEPRECATED()                                \
0596   ClassName(const ClassName&) = default;                      \
0597   ClassName(ClassName&&) = default;                           \
0598   ClassName& operator=(const ClassName&) = default;           \
0599   ClassName& operator=(ClassName&&) = default;                \
0600   END_ALLOW_USE_DEPRECATED()
0601 
0602 
0603 #if defined(__GNUC__) && !defined(__clang__) && (__GNUC__ < 6)
0604 # define V8_ENUM_DEPRECATED(message)
0605 # define V8_ENUM_DEPRECATE_SOON(message)
0606 #else
0607 # define V8_ENUM_DEPRECATED(message) V8_DEPRECATED(message)
0608 # define V8_ENUM_DEPRECATE_SOON(message) V8_DEPRECATE_SOON(message)
0609 #endif
0610 
0611 
0612 // A macro to provide the compiler with branch prediction information.
0613 #if V8_HAS_BUILTIN_EXPECT
0614 # define V8_UNLIKELY(condition) (__builtin_expect(!!(condition), 0))
0615 # define V8_LIKELY(condition) (__builtin_expect(!!(condition), 1))
0616 #else
0617 # define V8_UNLIKELY(condition) (condition)
0618 # define V8_LIKELY(condition) (condition)
0619 #endif
0620 
0621 
0622 // Annotate a function indicating the caller must examine the return value.
0623 // Use like:
0624 //   int foo() V8_WARN_UNUSED_RESULT;
0625 #if V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT
0626 #define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
0627 #else
0628 #define V8_WARN_UNUSED_RESULT /* NOT SUPPORTED */
0629 #endif
0630 
0631 
0632 // Annotate functions/variables as weak to allow overriding the symbol.
0633 #if V8_HAS_ATTRIBUTE_WEAK
0634 #define V8_WEAK __attribute__((weak))
0635 #else
0636 #define V8_WEAK /* NOT SUPPORTED */
0637 #endif
0638 
0639 
0640 // Annotate a class or constructor indicating the caller must assign the
0641 // constructed instances.
0642 // Apply to the whole class like:
0643 //   class V8_NODISCARD Foo() { ... };
0644 // or apply to just one constructor like:
0645 //   V8_NODISCARD Foo() { ... };
0646 // [[nodiscard]] comes in C++17 but supported in clang with -std >= c++11.
0647 #if V8_HAS_CPP_ATTRIBUTE_NODISCARD
0648 #define V8_NODISCARD [[nodiscard]]
0649 #else
0650 #define V8_NODISCARD /* NOT SUPPORTED */
0651 #endif
0652 
0653 // The no_unique_address attribute allows tail padding in a non-static data
0654 // member to overlap other members of the enclosing class (and in the special
0655 // case when the type is empty, permits it to fully overlap other members). The
0656 // field is laid out as if a base class were encountered at the corresponding
0657 // point within the class (except that it does not share a vptr with the
0658 // enclosing object).
0659 //
0660 // Apply to a data member like:
0661 //
0662 //   class Foo {
0663 //    V8_NO_UNIQUE_ADDRESS Bar bar_;
0664 //   };
0665 //
0666 // [[no_unique_address]] comes in C++20 but supported in clang with
0667 // -std >= c++11.
0668 #if V8_HAS_CPP_ATTRIBUTE_NO_UNIQUE_ADDRESS
0669 #define V8_NO_UNIQUE_ADDRESS [[no_unique_address]]
0670 #else
0671 #define V8_NO_UNIQUE_ADDRESS /* NOT SUPPORTED */
0672 #endif
0673 
0674 // Marks a type as being eligible for the "trivial" ABI despite having a
0675 // non-trivial destructor or copy/move constructor. Such types can be relocated
0676 // after construction by simply copying their memory, which makes them eligible
0677 // to be passed in registers. The canonical example is std::unique_ptr.
0678 //
0679 // Use with caution; this has some subtle effects on constructor/destructor
0680 // ordering and will be very incorrect if the type relies on its address
0681 // remaining constant. When used as a function argument (by value), the value
0682 // may be constructed in the caller's stack frame, passed in a register, and
0683 // then used and destructed in the callee's stack frame. A similar thing can
0684 // occur when values are returned.
0685 //
0686 // TRIVIAL_ABI is not needed for types which have a trivial destructor and
0687 // copy/move constructors, since those are automatically trivial by the ABI
0688 // spec.
0689 //
0690 // It is also not likely to be effective on types too large to be passed in one
0691 // or two registers on typical target ABIs.
0692 //
0693 // See also:
0694 //   https://clang.llvm.org/docs/AttributeReference.html#trivial-abi
0695 //   https://libcxx.llvm.org/docs/DesignDocs/UniquePtrTrivialAbi.html
0696 #if defined(__clang__) && defined(__has_attribute)
0697 #if __has_attribute(trivial_abi)
0698 #define V8_TRIVIAL_ABI [[clang::trivial_abi]]
0699 #define V8_HAS_ATTRIBUTE_TRIVIAL_ABI 1
0700 #endif // __has_attribute(trivial_abi)
0701 #endif // defined(__clang__) && defined(__has_attribute)
0702 #if !defined(V8_TRIVIAL_ABI)
0703 #define V8_TRIVIAL_ABI
0704 #define V8_HAS_ATTRIBUTE_TRIVIAL_ABI 0
0705 #endif //!defined(V8_TRIVIAL_ABI)
0706 
0707 // Helper macro to define no_sanitize attributes only with clang.
0708 #if defined(__clang__) && defined(__has_attribute)
0709 #if __has_attribute(no_sanitize)
0710 #define V8_CLANG_NO_SANITIZE(what) __attribute__((no_sanitize(what)))
0711 #endif
0712 #endif
0713 #if !defined(V8_CLANG_NO_SANITIZE)
0714 #define V8_CLANG_NO_SANITIZE(what)
0715 #endif
0716 
0717 // Exposing private symbols requires exposing public symbols too.
0718 #ifdef BUILDING_V8_SHARED_PRIVATE
0719 #define BUILDING_V8_SHARED
0720 #endif
0721 
0722 #if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
0723 #error Inconsistent build configuration: To build the V8 shared library \
0724 set BUILDING_V8_SHARED, to include its headers for linking against the \
0725 V8 shared library set USING_V8_SHARED.
0726 #endif
0727 
0728 #ifdef V8_OS_WIN
0729 
0730 // Setup for Windows DLL export/import. When building the V8 DLL the
0731 // BUILDING_V8_SHARED needs to be defined. When building a program which uses
0732 // the V8 DLL USING_V8_SHARED needs to be defined. When either building the V8
0733 // static library or building a program which uses the V8 static library neither
0734 // BUILDING_V8_SHARED nor USING_V8_SHARED should be defined.
0735 #ifdef BUILDING_V8_SHARED
0736 # define V8_EXPORT __declspec(dllexport)
0737 #elif USING_V8_SHARED
0738 # define V8_EXPORT __declspec(dllimport)
0739 #else
0740 # define V8_EXPORT
0741 #endif  // BUILDING_V8_SHARED
0742 
0743 #else  // V8_OS_WIN
0744 
0745 // Setup for Linux shared library export.
0746 #if V8_HAS_ATTRIBUTE_VISIBILITY
0747 # ifdef BUILDING_V8_SHARED
0748 #  define V8_EXPORT __attribute__ ((visibility("default")))
0749 # else
0750 #  define V8_EXPORT
0751 # endif
0752 #else
0753 # define V8_EXPORT
0754 #endif
0755 
0756 #endif  // V8_OS_WIN
0757 
0758 // clang-format on
0759 
0760 // Processor architecture detection.  For more info on what's defined, see:
0761 //   http://msdn.microsoft.com/en-us/library/b0084kay.aspx
0762 //   http://www.agner.org/optimize/calling_conventions.pdf
0763 //   or with gcc, run: "echo | gcc -E -dM -"
0764 // The V8_HOST_ARCH_* macros correspond to the architecture on which V8, as a
0765 // virtual machine and compiler, runs. Don't confuse this with the architecture
0766 // on which V8 is built.
0767 #if defined(_M_X64) || defined(__x86_64__)
0768 #define V8_HOST_ARCH_X64 1
0769 #if defined(__x86_64__) && __SIZEOF_POINTER__ == 4  // Check for x32.
0770 #define V8_HOST_ARCH_32_BIT 1
0771 #else
0772 #define V8_HOST_ARCH_64_BIT 1
0773 #endif
0774 #elif defined(_M_IX86) || defined(__i386__)
0775 #define V8_HOST_ARCH_IA32 1
0776 #define V8_HOST_ARCH_32_BIT 1
0777 #elif defined(__AARCH64EL__) || defined(_M_ARM64)
0778 #define V8_HOST_ARCH_ARM64 1
0779 #define V8_HOST_ARCH_64_BIT 1
0780 #elif defined(__ARMEL__)
0781 #define V8_HOST_ARCH_ARM 1
0782 #define V8_HOST_ARCH_32_BIT 1
0783 #elif defined(__mips64)
0784 #define V8_HOST_ARCH_MIPS64 1
0785 #define V8_HOST_ARCH_64_BIT 1
0786 #elif defined(__loongarch_lp64)
0787 #define V8_HOST_ARCH_LOONG64 1
0788 #define V8_HOST_ARCH_64_BIT 1
0789 #elif defined(__PPC64__) || defined(_ARCH_PPC64)
0790 #define V8_HOST_ARCH_PPC64 1
0791 #define V8_HOST_ARCH_64_BIT 1
0792 #elif defined(__PPC__) || defined(_ARCH_PPC)
0793 #define V8_HOST_ARCH_PPC 1
0794 #define V8_HOST_ARCH_32_BIT 1
0795 #elif defined(__s390__) || defined(__s390x__)
0796 #define V8_HOST_ARCH_S390 1
0797 #if defined(__s390x__)
0798 #define V8_HOST_ARCH_64_BIT 1
0799 #else
0800 #define V8_HOST_ARCH_32_BIT 1
0801 #endif
0802 #elif defined(__riscv) || defined(__riscv__)
0803 #if __riscv_xlen == 64
0804 #define V8_HOST_ARCH_RISCV64 1
0805 #define V8_HOST_ARCH_64_BIT 1
0806 #elif __riscv_xlen == 32
0807 #define V8_HOST_ARCH_RISCV32 1
0808 #define V8_HOST_ARCH_32_BIT 1
0809 #else
0810 #error "Cannot detect Riscv's bitwidth"
0811 #endif
0812 #else
0813 #error "Host architecture was not detected as supported by v8"
0814 #endif
0815 
0816 // Target architecture detection. This corresponds to the architecture for which
0817 // V8's JIT will generate code (the last stage of the canadian cross-compiler).
0818 // The macros may be set externally. If not, detect in the same way as the host
0819 // architecture, that is, target the native environment as presented by the
0820 // compiler.
0821 #if !V8_TARGET_ARCH_X64 && !V8_TARGET_ARCH_IA32 && !V8_TARGET_ARCH_ARM &&     \
0822     !V8_TARGET_ARCH_ARM64 && !V8_TARGET_ARCH_MIPS64 && !V8_TARGET_ARCH_PPC && \
0823     !V8_TARGET_ARCH_PPC64 && !V8_TARGET_ARCH_S390 &&                          \
0824     !V8_TARGET_ARCH_RISCV64 && !V8_TARGET_ARCH_LOONG64 &&                     \
0825     !V8_TARGET_ARCH_RISCV32
0826 #if defined(_M_X64) || defined(__x86_64__)
0827 #define V8_TARGET_ARCH_X64 1
0828 #elif defined(_M_IX86) || defined(__i386__)
0829 #define V8_TARGET_ARCH_IA32 1
0830 #elif defined(__AARCH64EL__) || defined(_M_ARM64)
0831 #define V8_TARGET_ARCH_ARM64 1
0832 #elif defined(__ARMEL__)
0833 #define V8_TARGET_ARCH_ARM 1
0834 #elif defined(__mips64)
0835 #define V8_TARGET_ARCH_MIPS64 1
0836 #elif defined(__loongarch_lp64)
0837 #define V8_TARGET_ARCH_LOONG64 1
0838 #elif defined(_ARCH_PPC64)
0839 #define V8_TARGET_ARCH_PPC64 1
0840 #elif defined(_ARCH_PPC)
0841 #define V8_TARGET_ARCH_PPC 1
0842 #elif defined(__s390__)
0843 #define V8_TARGET_ARCH_S390 1
0844 #if defined(__s390x__)
0845 #define V8_TARGET_ARCH_S390X 1
0846 #endif
0847 #elif defined(__riscv) || defined(__riscv__)
0848 #if __riscv_xlen == 64
0849 #define V8_TARGET_ARCH_RISCV64 1
0850 #elif __riscv_xlen == 32
0851 #define V8_TARGET_ARCH_RISCV32 1
0852 #endif
0853 #else
0854 #error Target architecture was not detected as supported by v8
0855 #endif
0856 #endif
0857 
0858 // Determine architecture pointer size.
0859 #if V8_TARGET_ARCH_IA32
0860 #define V8_TARGET_ARCH_32_BIT 1
0861 #elif V8_TARGET_ARCH_X64
0862 #if !V8_TARGET_ARCH_32_BIT && !V8_TARGET_ARCH_64_BIT
0863 #if defined(__x86_64__) && __SIZEOF_POINTER__ == 4  // Check for x32.
0864 #define V8_TARGET_ARCH_32_BIT 1
0865 #else
0866 #define V8_TARGET_ARCH_64_BIT 1
0867 #endif
0868 #endif
0869 #elif V8_TARGET_ARCH_ARM
0870 #define V8_TARGET_ARCH_32_BIT 1
0871 #elif V8_TARGET_ARCH_ARM64
0872 #define V8_TARGET_ARCH_64_BIT 1
0873 #elif V8_TARGET_ARCH_MIPS
0874 #define V8_TARGET_ARCH_32_BIT 1
0875 #elif V8_TARGET_ARCH_MIPS64
0876 #define V8_TARGET_ARCH_64_BIT 1
0877 #elif V8_TARGET_ARCH_LOONG64
0878 #define V8_TARGET_ARCH_64_BIT 1
0879 #elif V8_TARGET_ARCH_PPC
0880 #define V8_TARGET_ARCH_32_BIT 1
0881 #elif V8_TARGET_ARCH_PPC64
0882 #define V8_TARGET_ARCH_64_BIT 1
0883 #elif V8_TARGET_ARCH_S390
0884 #if V8_TARGET_ARCH_S390X
0885 #define V8_TARGET_ARCH_64_BIT 1
0886 #else
0887 #define V8_TARGET_ARCH_32_BIT 1
0888 #endif
0889 #elif V8_TARGET_ARCH_RISCV64
0890 #define V8_TARGET_ARCH_64_BIT 1
0891 #elif V8_TARGET_ARCH_RISCV32
0892 #define V8_TARGET_ARCH_32_BIT 1
0893 #else
0894 #error Unknown target architecture pointer size
0895 #endif
0896 
0897 // Check for supported combinations of host and target architectures.
0898 #if V8_TARGET_ARCH_IA32 && !V8_HOST_ARCH_IA32
0899 #error Target architecture ia32 is only supported on ia32 host
0900 #endif
0901 #if (V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_64_BIT && \
0902      !((V8_HOST_ARCH_X64 || V8_HOST_ARCH_ARM64) && V8_HOST_ARCH_64_BIT))
0903 #error Target architecture x64 is only supported on x64 and arm64 host
0904 #endif
0905 #if (V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_32_BIT && \
0906      !(V8_HOST_ARCH_X64 && V8_HOST_ARCH_32_BIT))
0907 #error Target architecture x32 is only supported on x64 host with x32 support
0908 #endif
0909 #if (V8_TARGET_ARCH_ARM && !(V8_HOST_ARCH_IA32 || V8_HOST_ARCH_ARM))
0910 #error Target architecture arm is only supported on arm and ia32 host
0911 #endif
0912 #if (V8_TARGET_ARCH_ARM64 && !(V8_HOST_ARCH_X64 || V8_HOST_ARCH_ARM64))
0913 #error Target architecture arm64 is only supported on arm64 and x64 host
0914 #endif
0915 #if (V8_TARGET_ARCH_MIPS64 && !(V8_HOST_ARCH_X64 || V8_HOST_ARCH_MIPS64))
0916 #error Target architecture mips64 is only supported on mips64 and x64 host
0917 #endif
0918 #if (V8_TARGET_ARCH_RISCV64 && !(V8_HOST_ARCH_X64 || V8_HOST_ARCH_RISCV64))
0919 #error Target architecture riscv64 is only supported on riscv64 and x64 host
0920 #endif
0921 #if (V8_TARGET_ARCH_RISCV32 && !(V8_HOST_ARCH_IA32 || V8_HOST_ARCH_RISCV32))
0922 #error Target architecture riscv32 is only supported on riscv32 and ia32 host
0923 #endif
0924 #if (V8_TARGET_ARCH_LOONG64 && !(V8_HOST_ARCH_X64 || V8_HOST_ARCH_LOONG64))
0925 #error Target architecture loong64 is only supported on loong64 and x64 host
0926 #endif
0927 
0928 // Determine architecture endianness.
0929 #if V8_TARGET_ARCH_IA32
0930 #define V8_TARGET_LITTLE_ENDIAN 1
0931 #elif V8_TARGET_ARCH_X64
0932 #define V8_TARGET_LITTLE_ENDIAN 1
0933 #elif V8_TARGET_ARCH_ARM
0934 #define V8_TARGET_LITTLE_ENDIAN 1
0935 #elif V8_TARGET_ARCH_ARM64
0936 #define V8_TARGET_LITTLE_ENDIAN 1
0937 #elif V8_TARGET_ARCH_LOONG64
0938 #define V8_TARGET_LITTLE_ENDIAN 1
0939 #elif V8_TARGET_ARCH_MIPS64
0940 #if defined(__MIPSEB__) || defined(V8_TARGET_ARCH_MIPS64_BE)
0941 #define V8_TARGET_BIG_ENDIAN 1
0942 #else
0943 #define V8_TARGET_LITTLE_ENDIAN 1
0944 #endif
0945 #elif defined(__BIG_ENDIAN__)  // FOR PPCGR on AIX
0946 #define V8_TARGET_BIG_ENDIAN 1
0947 #elif V8_TARGET_ARCH_PPC_LE
0948 #define V8_TARGET_LITTLE_ENDIAN 1
0949 #elif V8_TARGET_ARCH_PPC_BE
0950 #define V8_TARGET_BIG_ENDIAN 1
0951 #elif V8_TARGET_ARCH_S390
0952 #if V8_TARGET_ARCH_S390_LE_SIM
0953 #define V8_TARGET_LITTLE_ENDIAN 1
0954 #else
0955 #define V8_TARGET_BIG_ENDIAN 1
0956 #endif
0957 #elif V8_TARGET_ARCH_RISCV32 || V8_TARGET_ARCH_RISCV64
0958 #define V8_TARGET_LITTLE_ENDIAN 1
0959 #elif defined(__BYTE_ORDER__)
0960 #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
0961 #define V8_TARGET_BIG_ENDIAN 1
0962 #else
0963 #define V8_TARGET_LITTLE_ENDIAN 1
0964 #endif
0965 #else
0966 #error Unknown target architecture endianness
0967 #endif
0968 
0969 #undef V8_HAS_CPP_ATTRIBUTE
0970 
0971 #if !defined(V8_STATIC_ROOTS)
0972 #define V8_STATIC_ROOTS_BOOL false
0973 #else
0974 #define V8_STATIC_ROOTS_BOOL true
0975 #endif
0976 
0977 #endif  // V8CONFIG_H_