| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Platform-specific code for POSIX goes here. This is not a platform on its | 5 // Platform-specific code for POSIX goes here. This is not a platform on its |
| 6 // own, but contains the parts which are the same across the POSIX platforms | 6 // own, but contains the parts which are the same across the POSIX platforms |
| 7 // Linux, MacOS, FreeBSD, OpenBSD, NetBSD and QNX. | 7 // Linux, MacOS, FreeBSD, OpenBSD, NetBSD and QNX. |
| 8 | 8 |
| 9 #include <errno.h> | 9 #include <errno.h> |
| 10 #include <limits.h> | 10 #include <limits.h> |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 } // namespace | 74 } // namespace |
| 75 | 75 |
| 76 | 76 |
| 77 int OS::ActivationFrameAlignment() { | 77 int OS::ActivationFrameAlignment() { |
| 78 #if V8_TARGET_ARCH_ARM | 78 #if V8_TARGET_ARCH_ARM |
| 79 // On EABI ARM targets this is required for fp correctness in the | 79 // On EABI ARM targets this is required for fp correctness in the |
| 80 // runtime system. | 80 // runtime system. |
| 81 return 8; | 81 return 8; |
| 82 #elif V8_TARGET_ARCH_MIPS | 82 #elif V8_TARGET_ARCH_MIPS |
| 83 return 8; | 83 return 8; |
| 84 #elif V8_TARGET_ARCH_S390 |
| 85 return 8; |
| 84 #else | 86 #else |
| 85 // Otherwise we just assume 16 byte alignment, i.e.: | 87 // Otherwise we just assume 16 byte alignment, i.e.: |
| 86 // - With gcc 4.4 the tree vectorization optimizer can generate code | 88 // - With gcc 4.4 the tree vectorization optimizer can generate code |
| 87 // that requires 16 byte alignment such as movdqa on x86. | 89 // that requires 16 byte alignment such as movdqa on x86. |
| 88 // - Mac OS X, PPC and Solaris (64-bit) activation frames must | 90 // - Mac OS X, PPC and Solaris (64-bit) activation frames must |
| 89 // be 16 byte-aligned; see "Mac OS X ABI Function Call Guide" | 91 // be 16 byte-aligned; see "Mac OS X ABI Function Call Guide" |
| 90 return 16; | 92 return 16; |
| 91 #endif | 93 #endif |
| 92 } | 94 } |
| 93 | 95 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 raw_addr &= V8_UINT64_C(0x3ffff000); | 180 raw_addr &= V8_UINT64_C(0x3ffff000); |
| 179 // Use extra address space to isolate the mmap regions. | 181 // Use extra address space to isolate the mmap regions. |
| 180 raw_addr += V8_UINT64_C(0x400000000000); | 182 raw_addr += V8_UINT64_C(0x400000000000); |
| 181 #elif V8_TARGET_BIG_ENDIAN | 183 #elif V8_TARGET_BIG_ENDIAN |
| 182 // Big-endian Linux: 44 bits of virtual addressing. | 184 // Big-endian Linux: 44 bits of virtual addressing. |
| 183 raw_addr &= V8_UINT64_C(0x03fffffff000); | 185 raw_addr &= V8_UINT64_C(0x03fffffff000); |
| 184 #else | 186 #else |
| 185 // Little-endian Linux: 48 bits of virtual addressing. | 187 // Little-endian Linux: 48 bits of virtual addressing. |
| 186 raw_addr &= V8_UINT64_C(0x3ffffffff000); | 188 raw_addr &= V8_UINT64_C(0x3ffffffff000); |
| 187 #endif | 189 #endif |
| 190 #elif V8_TARGET_ARCH_S390X |
| 191 // Linux on Z uses bits 22-32 for Region Indexing, which translates to 42 bits |
| 192 // of virtual addressing. Truncate to 40 bits to allow kernel chance to |
| 193 // fulfill request. |
| 194 raw_addr &= V8_UINT64_C(0xfffffff000); |
| 195 #elif V8_TARGET_ARCH_S390 |
| 196 // 31 bits of virtual addressing. Truncate to 29 bits to allow kernel chance |
| 197 // to fulfill request. |
| 198 raw_addr &= 0x1ffff000; |
| 188 #else | 199 #else |
| 189 raw_addr &= 0x3ffff000; | 200 raw_addr &= 0x3ffff000; |
| 190 | 201 |
| 191 # ifdef __sun | 202 # ifdef __sun |
| 192 // For our Solaris/illumos mmap hint, we pick a random address in the bottom | 203 // For our Solaris/illumos mmap hint, we pick a random address in the bottom |
| 193 // half of the top half of the address space (that is, the third quarter). | 204 // half of the top half of the address space (that is, the third quarter). |
| 194 // Because we do not MAP_FIXED, this will be treated only as a hint -- the | 205 // Because we do not MAP_FIXED, this will be treated only as a hint -- the |
| 195 // system will not fail to mmap() because something else happens to already | 206 // system will not fail to mmap() because something else happens to already |
| 196 // be mapped at our random address. We deliberately set the hint high enough | 207 // be mapped at our random address. We deliberately set the hint high enough |
| 197 // to get well above the system's break (that is, the heap); Solaris and | 208 // to get well above the system's break (that is, the heap); Solaris and |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 #elif V8_HOST_ARCH_PPC | 256 #elif V8_HOST_ARCH_PPC |
| 246 asm("twge 2,2"); | 257 asm("twge 2,2"); |
| 247 #elif V8_HOST_ARCH_IA32 | 258 #elif V8_HOST_ARCH_IA32 |
| 248 #if V8_OS_NACL | 259 #if V8_OS_NACL |
| 249 asm("hlt"); | 260 asm("hlt"); |
| 250 #else | 261 #else |
| 251 asm("int $3"); | 262 asm("int $3"); |
| 252 #endif // V8_OS_NACL | 263 #endif // V8_OS_NACL |
| 253 #elif V8_HOST_ARCH_X64 | 264 #elif V8_HOST_ARCH_X64 |
| 254 asm("int $3"); | 265 asm("int $3"); |
| 266 #elif V8_HOST_ARCH_S390 |
| 267 // Software breakpoint instruction is 0x0001 |
| 268 asm volatile(".word 0x0001"); |
| 255 #else | 269 #else |
| 256 #error Unsupported host architecture. | 270 #error Unsupported host architecture. |
| 257 #endif | 271 #endif |
| 258 } | 272 } |
| 259 | 273 |
| 260 | 274 |
| 261 class PosixMemoryMappedFile final : public OS::MemoryMappedFile { | 275 class PosixMemoryMappedFile final : public OS::MemoryMappedFile { |
| 262 public: | 276 public: |
| 263 PosixMemoryMappedFile(FILE* file, void* memory, size_t size) | 277 PosixMemoryMappedFile(FILE* file, void* memory, size_t size) |
| 264 : file_(file), memory_(memory), size_(size) {} | 278 : file_(file), memory_(memory), size_(size) {} |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 | 762 |
| 749 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { | 763 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { |
| 750 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); | 764 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); |
| 751 int result = pthread_setspecific(pthread_key, value); | 765 int result = pthread_setspecific(pthread_key, value); |
| 752 DCHECK_EQ(0, result); | 766 DCHECK_EQ(0, result); |
| 753 USE(result); | 767 USE(result); |
| 754 } | 768 } |
| 755 | 769 |
| 756 } // namespace base | 770 } // namespace base |
| 757 } // namespace v8 | 771 } // namespace v8 |
| OLD | NEW |