Don't use page allocator hints in MemoryAllocator::AllocateBasicChunk

When pointer compression is enabled, the heap layout inside the pointer
compression region is expected to be predictable (see mkgrokdump) and so
random page allocator hints should not be used when allocating the
pages. This used to work before crrev.com/c/3220151 as the
BoundedPageAllocator would simply ignore any hints.

Bug: v8:12334
Change-Id: I6e10f1a60728fb88a7a99a2a435090b063a03f6a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3236546
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Samuel Groß <saelo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77538}
This commit is contained in:
Samuel Groß 2021-10-21 14:06:21 +02:00 committed by V8 LUCI CQ
parent 38d59f9f5e
commit cfee5e889a

View File

@ -280,8 +280,15 @@ V8_EXPORT_PRIVATE BasicMemoryChunk* MemoryAllocator::AllocateBasicChunk(
VirtualMemory reservation;
Address area_start = kNullAddress;
Address area_end = kNullAddress;
#ifdef V8_COMPRESS_POINTERS
// When pointer compression is enabled, spaces are expected to be at a
// predictable address (see mkgrokdump) so we don't supply a hint and rely on
// the deterministic behaviour of the BoundedPageAllocator.
void* address_hint = nullptr;
#else
void* address_hint =
AlignedAddress(heap->GetRandomMmapAddr(), MemoryChunk::kAlignment);
#endif
//
// MemoryChunk layout: