| Index: src/platform-posix.cc
 | 
| diff --git a/src/platform-posix.cc b/src/platform-posix.cc
 | 
| index 13b819bd1e79c1452979961fd082c2af73171e56..2265955aa3284ff6e0e3037fe37e1940e36a4546 100644
 | 
| --- a/src/platform-posix.cc
 | 
| +++ b/src/platform-posix.cc
 | 
| @@ -33,7 +33,7 @@
 | 
|  
 | 
|  #include <dlfcn.h>
 | 
|  #include <pthread.h>
 | 
| -#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__)
 | 
| +#if V8_OS_FREEBSD || V8_OS_OPENBSD
 | 
|  #include <pthread_np.h>  // for pthread_set_name_np
 | 
|  #endif
 | 
|  #include <sched.h>  // for sched_yield
 | 
| @@ -47,11 +47,9 @@
 | 
|  #include <sys/time.h>
 | 
|  #include <sys/types.h>
 | 
|  #include <sys/stat.h>
 | 
| -#if defined(__linux__)
 | 
| +#if V8_OS_LINUX
 | 
|  #include <sys/prctl.h>  // for prctl
 | 
| -#endif
 | 
| -#if defined(__APPLE__) || defined(__DragonFly__) || defined(__FreeBSD__) || \
 | 
| -    defined(__NetBSD__) || defined(__OpenBSD__)
 | 
| +#elif V8_OS_BSD4
 | 
|  #include <sys/sysctl.h>  // for sysctl
 | 
|  #endif
 | 
|  
 | 
| @@ -61,7 +59,7 @@
 | 
|  
 | 
|  #undef MAP_TYPE
 | 
|  
 | 
| -#if defined(ANDROID) && !defined(V8_ANDROID_LOG_STDOUT)
 | 
| +#if V8_OS_ANDROID && !defined(V8_ANDROID_LOG_STDOUT)
 | 
|  #define LOG_TAG "v8"
 | 
|  #include <android/log.h>
 | 
|  #endif
 | 
| @@ -79,7 +77,7 @@ static const pthread_t kNoThread = (pthread_t) 0;
 | 
|  
 | 
|  
 | 
|  uint64_t OS::CpuFeaturesImpliedByPlatform() {
 | 
| -#if defined(__APPLE__)
 | 
| +#if V8_OS_DARWIN
 | 
|    // Mac OS X requires all these to install so we can assume they are present.
 | 
|    // These constants are defined by the CPUid instructions.
 | 
|    const uint64_t one = 1;
 | 
| @@ -135,10 +133,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);
 | 
| @@ -150,7 +148,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_READONLY | PAGE_GUARD, &oldprotect);
 | 
|  #else
 | 
| @@ -160,7 +158,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
 | 
| @@ -171,7 +169,7 @@ void* OS::GetRandomMmapAddr() {
 | 
|    // CpuFeatures::Probe. We don't care about randomization in this case because
 | 
|    // the code page is immediately freed.
 | 
|    if (isolate != NULL) {
 | 
| -#if V8_TARGET_ARCH_X64
 | 
| +#if V8_HOST_ARCH_64_BIT
 | 
|      uint64_t rnd1 = V8::RandomPrivate(isolate);
 | 
|      uint64_t rnd2 = V8::RandomPrivate(isolate);
 | 
|      uint64_t raw_addr = (rnd1 << 32) ^ rnd2;
 | 
| @@ -184,7 +182,7 @@ void* OS::GetRandomMmapAddr() {
 | 
|  
 | 
|      raw_addr &= 0x3ffff000;
 | 
|  
 | 
| -# ifdef __sun
 | 
| +#if V8_OS_SOLARIS
 | 
|      // For our Solaris/illumos mmap hint, we pick a random address in the bottom
 | 
|      // half of the top half of the address space (that is, the third quarter).
 | 
|      // Because we do not MAP_FIXED, this will be treated only as a hint -- the
 | 
| @@ -195,13 +193,13 @@ void* OS::GetRandomMmapAddr() {
 | 
|      // no hint at all. The high hint prevents the break from getting hemmed in
 | 
|      // at low values, ceding half of the address space to the system heap.
 | 
|      raw_addr += 0x80000000;
 | 
| -# else
 | 
| +#else
 | 
|      // The range 0x20000000 - 0x60000000 is relatively unpopulated across a
 | 
|      // variety of ASLR modes (PAE kernel, NX compat mode, etc) and on macos
 | 
|      // 10.6 and 10.7.
 | 
|      raw_addr += 0x20000000;
 | 
| -# endif
 | 
| -#endif
 | 
| +#endif  // V8_OS_SOLARIS
 | 
| +#endif  // V8_HOST_ARCH_64_BIT
 | 
|      return reinterpret_cast<void*>(raw_addr);
 | 
|    }
 | 
|    return NULL;
 | 
| @@ -239,11 +237,11 @@ void OS::DebugBreak() {
 | 
|  #elif V8_HOST_ARCH_MIPS
 | 
|    asm("break");
 | 
|  #elif V8_HOST_ARCH_IA32
 | 
| -#if defined(__native_client__)
 | 
| +#if V8_OS_NACL
 | 
|    asm("hlt");
 | 
|  #else
 | 
|    asm("int $3");
 | 
| -#endif  // __native_client__
 | 
| +#endif  // V8_OS_NACL
 | 
|  #elif V8_HOST_ARCH_X64
 | 
|    asm("int $3");
 | 
|  #else
 | 
| @@ -386,7 +384,7 @@ void OS::Print(const char* format, ...) {
 | 
|  
 | 
|  
 | 
|  void OS::VPrint(const char* format, va_list args) {
 | 
| -#if defined(ANDROID) && !defined(V8_ANDROID_LOG_STDOUT)
 | 
| +#if V8_OS_ANDROID && !defined(V8_ANDROID_LOG_STDOUT)
 | 
|    __android_log_vprint(ANDROID_LOG_INFO, LOG_TAG, format, args);
 | 
|  #else
 | 
|    vprintf(format, args);
 | 
| @@ -403,7 +401,7 @@ void OS::FPrint(FILE* out, const char* format, ...) {
 | 
|  
 | 
|  
 | 
|  void OS::VFPrint(FILE* out, const char* format, va_list args) {
 | 
| -#if defined(ANDROID) && !defined(V8_ANDROID_LOG_STDOUT)
 | 
| +#if V8_OS_ANDROID && !defined(V8_ANDROID_LOG_STDOUT)
 | 
|    __android_log_vprint(ANDROID_LOG_INFO, LOG_TAG, format, args);
 | 
|  #else
 | 
|    vfprintf(out, format, args);
 | 
| @@ -420,7 +418,7 @@ void OS::PrintError(const char* format, ...) {
 | 
|  
 | 
|  
 | 
|  void OS::VPrintError(const char* format, va_list args) {
 | 
| -#if defined(ANDROID) && !defined(V8_ANDROID_LOG_STDOUT)
 | 
| +#if V8_OS_ANDROID && !defined(V8_ANDROID_LOG_STDOUT)
 | 
|    __android_log_vprint(ANDROID_LOG_ERROR, LOG_TAG, format, args);
 | 
|  #else
 | 
|    vfprintf(stderr, format, args);
 | 
| @@ -472,7 +470,7 @@ void OS::MemMove(void* dest, const void* src, size_t size) {
 | 
|    (*memmove_function)(dest, src, size);
 | 
|  }
 | 
|  
 | 
| -#elif defined(V8_HOST_ARCH_ARM)
 | 
| +#elif V8_HOST_ARCH_ARM
 | 
|  void OS::MemCopyUint16Uint8Wrapper(uint16_t* dest,
 | 
|                                 const uint8_t* src,
 | 
|                                 size_t chars) {
 | 
| @@ -500,7 +498,7 @@ void OS::PostSetUp() {
 | 
|    if (generated_memmove != NULL) {
 | 
|      memmove_function = generated_memmove;
 | 
|    }
 | 
| -#elif defined(V8_HOST_ARCH_ARM)
 | 
| +#elif V8_HOST_ARCH_ARM
 | 
|    OS::memcopy_uint8_function =
 | 
|        CreateMemCopyUint8Function(&OS::MemCopyUint8Wrapper);
 | 
|    OS::memcopy_uint16_uint8_function =
 | 
| @@ -553,12 +551,12 @@ Thread::~Thread() {
 | 
|  
 | 
|  
 | 
|  static void SetThreadName(const char* name) {
 | 
| -#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__)
 | 
| +#if 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_DARWIN
 | 
|    // pthread_setname_np is only available in 10.6 or later, so test
 | 
|    // for it at runtime.
 | 
|    int (*dynamic_pthread_setname_np)(const char*);
 | 
| @@ -605,7 +603,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<size_t>(stack_size_));
 | 
|      ASSERT_EQ(0, result);
 | 
| @@ -633,7 +631,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.
 | 
| @@ -647,7 +645,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<intptr_t>(local_key);
 | 
|    return reinterpret_cast<pthread_key_t>(ptr_key);
 | 
| 
 |