mac arm64: Use the correct page size for this platform in PartitionAlloc
Cherrypick crrev.com/787452.
Bug: chromium:1128457
Change-Id: Ia0628eea8cbcd50369f4c6fb5d4dd207a2ef9c5a
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/73633
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/third_party/base/allocator/partition_allocator/page_allocator_constants.h b/third_party/base/allocator/partition_allocator/page_allocator_constants.h
index 567e3a3..77c065a 100644
--- a/third_party/base/allocator/partition_allocator/page_allocator_constants.h
+++ b/third_party/base/allocator/partition_allocator/page_allocator_constants.h
@@ -15,6 +15,8 @@
static constexpr size_t kPageAllocationGranularityShift = 16; // 64KB
#elif defined(_MIPS_ARCH_LOONGSON)
static constexpr size_t kPageAllocationGranularityShift = 14; // 16KB
+#elif defined(OS_APPLE) && defined(ARCH_CPU_ARM64)
+static constexpr size_t kPageAllocationGranularityShift = 14; // 16KB
#else
static constexpr size_t kPageAllocationGranularityShift = 12; // 4KB
#endif
@@ -33,6 +35,8 @@
// and binaries compiled for 64KB are likely to work on 4KB systems,
// 64KB is a good choice here.
static constexpr size_t kSystemPageSize = 65536;
+#elif defined(OS_APPLE) && defined(ARCH_CPU_ARM64)
+static constexpr size_t kSystemPageSize = 16384;
#else
static constexpr size_t kSystemPageSize = 4096;
#endif
diff --git a/third_party/base/allocator/partition_allocator/partition_alloc_constants.h b/third_party/base/allocator/partition_allocator/partition_alloc_constants.h
index 8ebc4f5..ef39b41 100644
--- a/third_party/base/allocator/partition_allocator/partition_alloc_constants.h
+++ b/third_party/base/allocator/partition_allocator/partition_alloc_constants.h
@@ -39,6 +39,8 @@
static const size_t kPartitionPageShift = 16; // 64 KiB
#elif defined(ARCH_CPU_PPC64)
static const size_t kPartitionPageShift = 18; // 256 KiB
+#elif defined(OS_APPLE) && defined(ARCH_CPU_ARM64)
+static const size_t kPartitionPageShift = 16; // 64 KiB
#else
static const size_t kPartitionPageShift = 14; // 16 KiB
#endif