From eec5197741e7553c21589fc319ea7ca6a58f2fe1 Mon Sep 17 00:00:00 2001 From: barracuda156 Date: Thu, 9 Nov 2023 03:14:50 +0800 Subject: [PATCH 07/12] platform-posix.cc: for powerpc-darwin --- src/base/platform/platform-posix.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/base/platform/platform-posix.cc b/src/base/platform/platform-posix.cc index 1e600c7891b..305b570f1c1 100644 --- a/v8/src/base/platform/platform-posix.cc +++ b/v8/src/base/platform/platform-posix.cc @@ -395,7 +395,7 @@ bool OS::SetPermissions(void* address, size_t size, MemoryPermission access) { // The cost is a syscall that effectively no-ops. // TODO(erikchen): Fix this to only call MADV_FREE_REUSE when necessary. // https://crbug.com/823915 -#if defined(OS_MACOSX) +#if defined(OS_MACOSX) && !(V8_TARGET_ARCH_PPC || V8_TARGET_ARCH_PPC64) if (access != OS::MemoryPermission::kNoAccess) madvise(address, size, MADV_FREE_REUSE); #endif @@ -406,7 +406,7 @@ bool OS::SetPermissions(void* address, size_t size, MemoryPermission access) { bool OS::DiscardSystemPages(void* address, size_t size) { DCHECK_EQ(0, reinterpret_cast(address) % CommitPageSize()); DCHECK_EQ(0, size % CommitPageSize()); -#if defined(OS_MACOSX) +#if defined(OS_MACOSX) && !(V8_TARGET_ARCH_PPC || V8_TARGET_ARCH_PPC64) // On OSX, MADV_FREE_REUSABLE has comparable behavior to MADV_FREE, but also // marks the pages with the reusable bit, which allows both Activity Monitor // and memory-infra to correctly track the pages. @@ -471,7 +471,11 @@ void OS::DebugBreak() { #elif V8_HOST_ARCH_MIPS64 asm("break"); #elif V8_HOST_ARCH_PPC || V8_HOST_ARCH_PPC64 +#if defined(V8_OS_MACOSX) + __asm__("twge r2,r2"); +#else // AIX, ELF asm("twge 2,2"); +#endif #elif V8_HOST_ARCH_IA32 asm("int $3"); #elif V8_HOST_ARCH_X64