Commit 9ada2284 authored by Jakob Kummerow's avatar Jakob Kummerow Committed by Commit Bot

[mac] Fix arm64 simulator builds on x64 Mac HW

Choose the page size based on V8_HOST_ARCH_ARM64 (i.e. we're building
an arm64 binary) instead of V8_TARGET_ARCH_ARM64 (i.e. V8's compilers
are emitting arm64 instructions, which is the case in simulator builds
as well).
Drive-by:
- use V8_TARGET_OS_MACOSX instead of __APPLE__
- drop implementation difference between AllocatePageSize and
  CommitPageSize on POSIX (they must return the same value anyway)

This continues and obsoletes the work at
https://chromium-review.googlesource.com/c/v8/v8/+/2314102 .

Bug: chromium:1107945, chromium:1128932
Change-Id: Iaaa509dd496ff581ddda4d957bc3d35d806cf81e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2421817
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70047}
parent 4f5ea814
......@@ -111,7 +111,7 @@ const int kMmapFd = VM_MAKE_TAG(255);
const int kMmapFd = -1;
#endif // !V8_OS_MACOSX
#if defined(__APPLE__) && V8_TARGET_ARCH_ARM64
#if defined(V8_TARGET_OS_MACOSX) && V8_HOST_ARCH_ARM64
// During snapshot generation in cross builds, sysconf() runs on the Intel
// host and returns host page size, while the snapshot needs to use the
// target page size.
......@@ -246,21 +246,18 @@ int OS::ActivationFrameAlignment() {
// static
size_t OS::AllocatePageSize() {
#if defined(__APPLE__) && V8_TARGET_ARCH_ARM64
#if defined(V8_TARGET_OS_MACOSX) && V8_HOST_ARCH_ARM64
return kAppleArmPageSize;
#else
return static_cast<size_t>(sysconf(_SC_PAGESIZE));
static size_t page_size = static_cast<size_t>(sysconf(_SC_PAGESIZE));
return page_size;
#endif
}
// static
size_t OS::CommitPageSize() {
#if defined(__APPLE__) && V8_TARGET_ARCH_ARM64
static size_t page_size = kAppleArmPageSize;
#else
static size_t page_size = getpagesize();
#endif
return page_size;
// Commit and allocate page size are the same on posix.
return OS::AllocatePageSize();
}
// static
......@@ -278,8 +275,8 @@ void* OS::GetRandomMmapAddr() {
MutexGuard guard(rng_mutex.Pointer());
GetPlatformRandomNumberGenerator()->NextBytes(&raw_addr, sizeof(raw_addr));
}
#if V8_TARGET_ARCH_ARM64
#if defined(__APPLE__)
#if V8_HOST_ARCH_ARM64
#if defined(V8_TARGET_OS_MACOSX)
DCHECK_EQ(1 << 14, AllocatePageSize());
#endif
// Keep the address page-aligned, AArch64 supports 4K, 16K and 64K
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment