From cfee5e889a16ce5b059422f6714a01d4277a8e48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Gro=C3=9F?= Date: Thu, 21 Oct 2021 14:06:21 +0200 Subject: [PATCH] Don't use page allocator hints in MemoryAllocator::AllocateBasicChunk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Michael Lippautz Commit-Queue: Samuel Groß Cr-Commit-Position: refs/heads/main@{#77538} --- src/heap/memory-allocator.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/heap/memory-allocator.cc b/src/heap/memory-allocator.cc index 5783f2d04b..c2cff9fc66 100644 --- a/src/heap/memory-allocator.cc +++ b/src/heap/memory-allocator.cc @@ -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: