[cleanup] Move various xxx_BOOL macros from flag-definitions.h

... to globals.h. The latter is included into flags.h and thus
the flag-defnitions.h can rely on those values to be defined.
The xxx_BOOL macros that were used in #if expressions in
flag-definitions.h are now explicitly checked for being defined.

This change allows using the constants also in the globals.h header.

Bug: v8:12689
Change-Id: I2498502284ab1e8dc8a3526229613ea1ce6624bc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3849377
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82662}
This commit is contained in:
ishell@chromium.org 2022-08-23 14:18:34 +02:00 committed by V8 LUCI CQ
parent 568221ee19
commit 3dab0e7156
2 changed files with 79 additions and 68 deletions

View File

@ -80,6 +80,76 @@ namespace internal {
#define V8_EMBEDDED_CONSTANT_POOL false
#endif
#ifdef DEBUG
#define DEBUG_BOOL true
#else
#define DEBUG_BOOL false
#endif
#ifdef V8_MAP_PACKING
#define V8_MAP_PACKING_BOOL true
#else
#define V8_MAP_PACKING_BOOL false
#endif
#ifdef V8_COMPRESS_POINTERS
#define COMPRESS_POINTERS_BOOL true
#else
#define COMPRESS_POINTERS_BOOL false
#endif
#if COMPRESS_POINTERS_BOOL && V8_TARGET_ARCH_X64
#define DECOMPRESS_POINTER_BY_ADDRESSING_MODE true
#else
#define DECOMPRESS_POINTER_BY_ADDRESSING_MODE false
#endif
#ifdef V8_COMPRESS_POINTERS_IN_ISOLATE_CAGE
#define COMPRESS_POINTERS_IN_ISOLATE_CAGE_BOOL true
#else
#define COMPRESS_POINTERS_IN_ISOLATE_CAGE_BOOL false
#endif
#ifdef V8_COMPRESS_POINTERS_IN_SHARED_CAGE
#define COMPRESS_POINTERS_IN_SHARED_CAGE_BOOL true
#else
#define COMPRESS_POINTERS_IN_SHARED_CAGE_BOOL false
#endif
#ifdef V8_SANDBOXED_EXTERNAL_POINTERS
#define V8_SANDBOXED_EXTERNAL_POINTERS_BOOL true
#else
#define V8_SANDBOXED_EXTERNAL_POINTERS_BOOL false
#endif
#ifdef V8_ENABLE_SANDBOX
#define V8_ENABLE_SANDBOX_BOOL true
#else
#define V8_ENABLE_SANDBOX_BOOL false
#endif
// D8's MultiMappedAllocator is only available on Linux, and only if the sandbox
// is not enabled.
#if V8_OS_LINUX && !V8_ENABLE_SANDBOX_BOOL
#define MULTI_MAPPED_ALLOCATOR_AVAILABLE true
#else
#define MULTI_MAPPED_ALLOCATOR_AVAILABLE false
#endif
#ifdef V8_ENABLE_CONTROL_FLOW_INTEGRITY
#define ENABLE_CONTROL_FLOW_INTEGRITY_BOOL true
#else
#define ENABLE_CONTROL_FLOW_INTEGRITY_BOOL false
#endif
#if (V8_TARGET_ARCH_PPC64 && COMPRESS_POINTERS_BOOL) || \
(V8_TARGET_ARCH_S390X && COMPRESS_POINTERS_BOOL)
// TODO(v8:11421): Enable Sparkplug for these architectures.
#define ENABLE_SPARKPLUG false
#else
#define ENABLE_SPARKPLUG true
#endif
#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64
// Set stack limit lower for ARM and ARM64 than for other architectures because:
// - on Arm stack allocating MacroAssembler takes 120K bytes.

View File

@ -119,75 +119,13 @@
#define DEFINE_NEG_VALUE_IMPLICATION(whenflag, thenflag, value)
#endif
#ifdef DEBUG
#define DEBUG_BOOL true
#else
#define DEBUG_BOOL false
#endif
#ifndef DEBUG_BOOL
#error DEBUG_BOOL must be defined at this point.
#endif // DEBUG_BOOL
#ifdef V8_COMPRESS_POINTERS
#define COMPRESS_POINTERS_BOOL true
#else
#define COMPRESS_POINTERS_BOOL false
#endif
#if COMPRESS_POINTERS_BOOL && V8_TARGET_ARCH_X64
#define DECOMPRESS_POINTER_BY_ADDRESSING_MODE true
#else
#define DECOMPRESS_POINTER_BY_ADDRESSING_MODE false
#endif
#ifdef V8_MAP_PACKING
#define V8_MAP_PACKING_BOOL true
#else
#define V8_MAP_PACKING_BOOL false
#endif
#ifdef V8_COMPRESS_POINTERS_IN_ISOLATE_CAGE
#define COMPRESS_POINTERS_IN_ISOLATE_CAGE_BOOL true
#else
#define COMPRESS_POINTERS_IN_ISOLATE_CAGE_BOOL false
#endif
#ifdef V8_COMPRESS_POINTERS_IN_SHARED_CAGE
#define COMPRESS_POINTERS_IN_SHARED_CAGE_BOOL true
#else
#define COMPRESS_POINTERS_IN_SHARED_CAGE_BOOL false
#endif
#ifdef V8_SANDBOXED_EXTERNAL_POINTERS
#define V8_SANDBOXED_EXTERNAL_POINTERS_BOOL true
#else
#define V8_SANDBOXED_EXTERNAL_POINTERS_BOOL false
#endif
#ifdef V8_ENABLE_SANDBOX
#define V8_ENABLE_SANDBOX_BOOL true
#else
#define V8_ENABLE_SANDBOX_BOOL false
#endif
// D8's MultiMappedAllocator is only available on Linux, and only if the sandbox
// is not enabled.
#if V8_OS_LINUX && !V8_ENABLE_SANDBOX_BOOL
#define MULTI_MAPPED_ALLOCATOR_AVAILABLE true
#else
#define MULTI_MAPPED_ALLOCATOR_AVAILABLE false
#endif
#ifdef V8_ENABLE_CONTROL_FLOW_INTEGRITY
#define ENABLE_CONTROL_FLOW_INTEGRITY_BOOL true
#else
#define ENABLE_CONTROL_FLOW_INTEGRITY_BOOL false
#endif
#if (V8_TARGET_ARCH_PPC64 && COMPRESS_POINTERS_BOOL) || \
(V8_TARGET_ARCH_S390X && COMPRESS_POINTERS_BOOL)
// TODO(v8:11421): Enable Sparkplug for these architectures.
#define ENABLE_SPARKPLUG false
#else
#define ENABLE_SPARKPLUG true
#endif
#ifndef ENABLE_SPARKPLUG
#error ENABLE_SPARKPLUG must be defined at this point.
#endif // ENABLE_SPARKPLUG
#if ENABLE_SPARKPLUG && !defined(ANDROID)
// Enable Sparkplug by default on desktop-only.
@ -1997,6 +1935,9 @@ DEFINE_BOOL(mock_arraybuffer_allocator, false,
DEFINE_SIZE_T(mock_arraybuffer_allocator_limit, 0,
"Memory limit for mock ArrayBuffer allocator used to simulate "
"OOM for testing.")
#ifndef MULTI_MAPPED_ALLOCATOR_AVAILABLE
#error MULTI_MAPPED_ALLOCATOR_AVAILABLE must be defined at this point.
#endif // MULTI_MAPPED_ALLOCATOR_AVAILABLE
#if MULTI_MAPPED_ALLOCATOR_AVAILABLE
DEFINE_BOOL(multi_mapped_mock_allocator, false,
"Use a multi-mapped mock ArrayBuffer allocator for testing.")