[build] Add build flag that enables pointer compression for 8GB heaps

Add the build flag `v8_enable_pointer_compression_8gb` which will enable
aligning all alocations to at least 8 bytes, instead of 4. The build
flag will affect tagged values (Smis and compressed pointers) that are
now aligned to 4 bytes. This new alignment is needed to support larger
V8 cages, with sizes of 8GB and larger.

Bug: v8:13070
Change-Id: I15fe1e0c8e0a105e831b756f502a4fcbf72f45a8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3757891
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Marja Hölttä <marja@chromium.org>
Commit-Queue: Teo Dutu <teodutu@google.com>
Cr-Commit-Position: refs/heads/main@{#81748}
This commit is contained in:
Teodor Dutu 2022-07-13 12:00:01 +00:00 committed by V8 LUCI CQ
parent 99208cdab2
commit 80d1dbe60b
2 changed files with 20 additions and 0 deletions

View File

@ -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") {

View File

@ -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);