diff options
Diffstat (limited to 'deps/v8/src/base/platform/platform-posix.cc')
-rw-r--r-- | deps/v8/src/base/platform/platform-posix.cc | 52 |
1 files changed, 36 insertions, 16 deletions
diff --git a/deps/v8/src/base/platform/platform-posix.cc b/deps/v8/src/base/platform/platform-posix.cc index 2cb3bbefd2..dc35d3d812 100644 --- a/deps/v8/src/base/platform/platform-posix.cc +++ b/deps/v8/src/base/platform/platform-posix.cc @@ -55,7 +55,7 @@ #include <sys/prctl.h> // NOLINT, for prctl #endif -#if !V8_OS_NACL +#if !defined(V8_OS_NACL) && !defined(_AIX) #include <sys/syscall.h> #endif @@ -85,8 +85,8 @@ int OS::ActivationFrameAlignment() { // Otherwise we just assume 16 byte alignment, i.e.: // - With gcc 4.4 the tree vectorization optimizer can generate code // that requires 16 byte alignment such as movdqa on x86. - // - Mac OS X and Solaris (64-bit) activation frames must be 16 byte-aligned; - // see "Mac OS X ABI Function Call Guide" + // - Mac OS X, PPC and Solaris (64-bit) activation frames must + // be 16 byte-aligned; see "Mac OS X ABI Function Call Guide" return 16; #endif } @@ -171,6 +171,20 @@ void* OS::GetRandomMmapAddr() { // the hint address to 46 bits to give the kernel a fighting chance of // fulfilling our placement request. raw_addr &= V8_UINT64_C(0x3ffffffff000); +#elif V8_TARGET_ARCH_PPC64 +#if V8_OS_AIX + // AIX: 64 bits of virtual addressing, but we limit address range to: + // a) minimize Segment Lookaside Buffer (SLB) misses and + raw_addr &= V8_UINT64_C(0x3ffff000); + // Use extra address space to isolate the mmap regions. + raw_addr += V8_UINT64_C(0x400000000000); +#elif V8_TARGET_BIG_ENDIAN + // Big-endian Linux: 44 bits of virtual addressing. + raw_addr &= V8_UINT64_C(0x03fffffff000); +#else + // Little-endian Linux: 48 bits of virtual addressing. + raw_addr &= V8_UINT64_C(0x3ffffffff000); +#endif #else raw_addr &= 0x3ffff000; @@ -185,6 +199,10 @@ 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; +#elif V8_OS_AIX + // The range 0x30000000 - 0xD0000000 is available on AIX; + // choose the upper range. + raw_addr += 0x90000000; # else // The range 0x20000000 - 0x60000000 is relatively unpopulated across a // variety of ASLR modes (PAE kernel, NX compat mode, etc) and on macos @@ -225,6 +243,8 @@ void OS::DebugBreak() { asm("break"); #elif V8_HOST_ARCH_MIPS64 asm("break"); +#elif V8_HOST_ARCH_PPC + asm("twge 2,2"); #elif V8_HOST_ARCH_IA32 #if V8_OS_NACL asm("hlt"); @@ -239,15 +259,6 @@ void OS::DebugBreak() { } -// ---------------------------------------------------------------------------- -// Math functions - -double OS::nan_value() { - // NAN from math.h is defined in C99 and not in POSIX. - return NAN; -} - - int OS::GetCurrentProcessId() { return static_cast<int>(getpid()); } @@ -260,6 +271,8 @@ int OS::GetCurrentThreadId() { return static_cast<int>(syscall(__NR_gettid)); #elif V8_OS_ANDROID return static_cast<int>(gettid()); +#elif V8_OS_AIX + return static_cast<int>(thread_self()); #elif V8_OS_SOLARIS return static_cast<int>(pthread_self()); #else @@ -311,10 +324,10 @@ void OS::ClearTimezoneCache(TimezoneCache* cache) { double OS::DaylightSavingsOffset(double time, TimezoneCache*) { - if (std::isnan(time)) return nan_value(); + if (std::isnan(time)) return std::numeric_limits<double>::quiet_NaN(); time_t tv = static_cast<time_t>(std::floor(time/msPerSecond)); struct tm* t = localtime(&tv); - if (NULL == t) return nan_value(); + if (NULL == t) return std::numeric_limits<double>::quiet_NaN(); return t->tm_isdst > 0 ? 3600 * msPerSecond : 0; } @@ -525,8 +538,15 @@ void Thread::Start() { DCHECK_EQ(0, result); // Native client uses default stack size. #if !V8_OS_NACL - if (stack_size_ > 0) { - result = pthread_attr_setstacksize(&attr, static_cast<size_t>(stack_size_)); + size_t stack_size = stack_size_; +#if V8_OS_AIX + if (stack_size == 0) { + // Default on AIX is 96KB -- bump up to 2MB + stack_size = 2 * 1024 * 1024; + } +#endif + if (stack_size > 0) { + result = pthread_attr_setstacksize(&attr, stack_size); DCHECK_EQ(0, result); } #endif |