From e606d03c043df0c72c7f7af6607386f794feece0 Mon Sep 17 00:00:00 2001 From: "bmeurer@chromium.org" Date: Thu, 9 Jan 2014 07:57:11 +0000 Subject: [PATCH] Convert some ifdefs to use their V8_OS_* macros equivalents. R=bmeurer@chromium.org Review URL: https://codereview.chromium.org/127643002 Patch from Thiago Farina . git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18507 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/platform-posix.cc | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/platform-posix.cc b/src/platform-posix.cc index 087625a..b897930 100644 --- a/src/platform-posix.cc +++ b/src/platform-posix.cc @@ -183,10 +183,10 @@ void OS::Free(void* address, const size_t size) { // Get rid of writable permission on code allocations. void OS::ProtectCode(void* address, const size_t size) { -#if defined(__CYGWIN__) +#if V8_OS_CYGWIN DWORD old_protect; VirtualProtect(address, size, PAGE_EXECUTE_READ, &old_protect); -#elif defined(__native_client__) +#elif V8_OS_NACL // The Native Client port of V8 uses an interpreter, so // code pages don't need PROT_EXEC. mprotect(address, size, PROT_READ); @@ -198,7 +198,7 @@ void OS::ProtectCode(void* address, const size_t size) { // Create guard pages. void OS::Guard(void* address, const size_t size) { -#if defined(__CYGWIN__) +#if V8_OS_CYGWIN DWORD oldprotect; VirtualProtect(address, size, PAGE_NOACCESS, &oldprotect); #else @@ -208,7 +208,7 @@ void OS::Guard(void* address, const size_t size) { void* OS::GetRandomMmapAddr() { -#if defined(__native_client__) +#if V8_OS_NACL // TODO(bradchen): restore randomization once Native Client gets // smarter about using mmap address hints. // See http://code.google.com/p/nativeclient/issues/3341 @@ -492,8 +492,8 @@ void OS::MemMove(void* dest, const void* src, size_t size) { #elif defined(V8_HOST_ARCH_ARM) void OS::MemCopyUint16Uint8Wrapper(uint16_t* dest, - const uint8_t* src, - size_t chars) { + const uint8_t* src, + size_t chars) { uint16_t *limit = dest + chars; while (dest < limit) { *dest++ = static_cast(*src++); @@ -579,12 +579,12 @@ Thread::~Thread() { static void SetThreadName(const char* name) { -#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if V8_OS_DRAGONFLYBSD || V8_OS_FREEBSD || V8_OS_OPENBSD pthread_set_name_np(pthread_self(), name); -#elif defined(__NetBSD__) +#elif V8_OS_NETBSD STATIC_ASSERT(Thread::kMaxThreadNameLength <= PTHREAD_MAX_NAMELEN_NP); pthread_setname_np(pthread_self(), "%s", name); -#elif defined(__APPLE__) +#elif V8_OS_MACOSX // pthread_setname_np is only available in 10.6 or later, so test // for it at runtime. int (*dynamic_pthread_setname_np)(const char*); @@ -631,7 +631,7 @@ void Thread::Start() { result = pthread_attr_init(&attr); ASSERT_EQ(0, result); // Native client uses default stack size. -#if !defined(__native_client__) +#if !V8_OS_NACL if (stack_size_ > 0) { result = pthread_attr_setstacksize(&attr, static_cast(stack_size_)); ASSERT_EQ(0, result); @@ -659,7 +659,7 @@ void Thread::YieldCPU() { static Thread::LocalStorageKey PthreadKeyToLocalKey(pthread_key_t pthread_key) { -#if defined(__CYGWIN__) +#if V8_OS_CYGWIN // We need to cast pthread_key_t to Thread::LocalStorageKey in two steps // because pthread_key_t is a pointer type on Cygwin. This will probably not // work on 64-bit platforms, but Cygwin doesn't support 64-bit anyway. @@ -673,7 +673,7 @@ static Thread::LocalStorageKey PthreadKeyToLocalKey(pthread_key_t pthread_key) { static pthread_key_t LocalKeyToPthreadKey(Thread::LocalStorageKey local_key) { -#if defined(__CYGWIN__) +#if V8_OS_CYGWIN STATIC_ASSERT(sizeof(Thread::LocalStorageKey) == sizeof(pthread_key_t)); intptr_t ptr_key = static_cast(local_key); return reinterpret_cast(ptr_key); -- 2.7.4