Add support for ppc64's 64k page sizes in Partition Alloc

Ideally page size would be detected at run-time on ppc64 systems,
but this would most likely require a significant refactor. Since
64k is the de-facto standard and binaries compiled for 64k are likely
to function on 4k systems, it was chosen to use 64k as the default
page size in the partition allocator on ppc64.

This change is part of the effort to upstream a set of patches
that allow chromium to build and run on ppc64le hosts available here:
https://wiki.raptorcs.com/wiki/Porting/Chromium

Change-Id: I23369f261766bdf7aab1b3dc730b94b7f4ba4a96
Reviewed-on: https://chromium-review.googlesource.com/c/1480970
Commit-Queue: Albert J. Wong <ajwong@chromium.org>
Reviewed-by: Albert J. Wong <ajwong@chromium.org>
Cr-Commit-Position: refs/heads/master@{#635426}
diff --git a/base/allocator/partition_allocator/page_allocator_constants.h b/base/allocator/partition_allocator/page_allocator_constants.h
index ac82360..555700a 100644
--- a/base/allocator/partition_allocator/page_allocator_constants.h
+++ b/base/allocator/partition_allocator/page_allocator_constants.h
@@ -10,7 +10,7 @@
 #include "build/build_config.h"
 
 namespace base {
-#if defined(OS_WIN)
+#if defined(OS_WIN) || defined(ARCH_CPU_PPC64)
 static constexpr size_t kPageAllocationGranularityShift = 16;  // 64KB
 #elif defined(_MIPS_ARCH_LOONGSON)
 static constexpr size_t kPageAllocationGranularityShift = 14;  // 16KB
@@ -26,6 +26,12 @@
 
 #if defined(_MIPS_ARCH_LOONGSON)
 static constexpr size_t kSystemPageSize = 16384;
+#elif defined(ARCH_CPU_PPC64)
+// Modern ppc64 systems support 4KB and 64KB page sizes.
+// Since 64KB is the de-facto standard on the platform
+// and binaries compiled for 64KB are likely to work on 4KB systems,
+// 64KB is a good choice here.
+static constexpr size_t kSystemPageSize = 65536;
 #else
 static constexpr size_t kSystemPageSize = 4096;
 #endif
diff --git a/base/allocator/partition_allocator/partition_alloc_constants.h b/base/allocator/partition_allocator/partition_alloc_constants.h
index 474405f0..fbc851c 100644
--- a/base/allocator/partition_allocator/partition_alloc_constants.h
+++ b/base/allocator/partition_allocator/partition_alloc_constants.h
@@ -10,6 +10,8 @@
 #include "base/allocator/partition_allocator/page_allocator_constants.h"
 #include "base/logging.h"
 
+#include "build/build_config.h"
+
 namespace base {
 
 // Allocation granularity of sizeof(void*) bytes.
@@ -35,6 +37,8 @@
 
 #if defined(_MIPS_ARCH_LOONGSON)
 static const size_t kPartitionPageShift = 16;  // 64 KiB
+#elif defined(ARCH_CPU_PPC64)
+static const size_t kPartitionPageShift = 18;  // 256 KiB
 #else
 static const size_t kPartitionPageShift = 14;  // 16 KiB
 #endif