diff --git a/BUILD.gn b/BUILD.gn index 548c2bb156..c918081b31 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -370,6 +370,10 @@ declare_args() { # TODO(victorgomes): Remove this flag once Chormium no longer needs # the deprecated feature. v8_fuchsia_use_vmex_resource = is_fuchsia && !build_with_chromium + + # Enables pointer compression for 8GB heaps. + # Sets -DV8_COMPRESS_POINTERS_8GB. + v8_enable_pointer_compression_8gb = "" } # Derived defaults. @@ -418,6 +422,9 @@ if (v8_enable_pointer_compression == "") { if (v8_enable_pointer_compression_shared_cage == "") { v8_enable_pointer_compression_shared_cage = v8_enable_pointer_compression } +if (v8_enable_pointer_compression_8gb == "") { + v8_enable_pointer_compression_8gb = false +} if (v8_enable_fast_torque == "") { v8_enable_fast_torque = v8_enable_fast_mksnapshot } @@ -539,6 +546,9 @@ assert(!v8_enable_map_packing || v8_current_cpu == "x64", assert(!v8_enable_external_code_space || v8_enable_pointer_compression, "External code space feature requires pointer compression") +assert(!v8_enable_pointer_compression_8gb || v8_enable_pointer_compression, + "Pointer compression for 8GB cages requires pointer compression") + assert(!v8_enable_sandbox || v8_enable_pointer_compression_shared_cage, "The sandbox requires the shared pointer compression cage") @@ -1036,6 +1046,9 @@ config("features") { if (v8_expose_memory_corruption_api) { defines += [ "V8_EXPOSE_MEMORY_CORRUPTION_API" ] } + if (v8_enable_pointer_compression_8gb) { + defines += [ "V8_COMPRESS_POINTERS_8GB" ] + } } config("toolchain") { diff --git a/src/common/globals.h b/src/common/globals.h index 1c70a83103..994b972704 100644 --- a/src/common/globals.h +++ b/src/common/globals.h @@ -397,6 +397,13 @@ constexpr int kPointerSizeLog2 = kSystemPointerSizeLog2; static_assert(kPointerSize == (1 << kPointerSizeLog2)); #endif +#ifdef V8_COMPRESS_POINTERS_8GB +// To support 8GB heaps, all alocations are aligned to at least 8 bytes. +#define V8_COMPRESS_POINTERS_8GB_BOOL true +#else +#define V8_COMPRESS_POINTERS_8GB_BOOL false +#endif + // This type defines raw storage type for external (or off-V8 heap) pointers // stored on V8 heap. constexpr int kExternalPointerSlotSize = sizeof(ExternalPointer_t);