Chromium Code Reviews| 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 <dlfcn.h> | 9 #include <dlfcn.h> |
| 10 #include <pthread.h> | 10 #include <pthread.h> |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 // CpuFeatures::Probe. We don't care about randomization in this case because | 198 // CpuFeatures::Probe. We don't care about randomization in this case because |
| 199 // the code page is immediately freed. | 199 // the code page is immediately freed. |
| 200 if (isolate != NULL) { | 200 if (isolate != NULL) { |
| 201 uintptr_t raw_addr; | 201 uintptr_t raw_addr; |
| 202 isolate->random_number_generator()->NextBytes(&raw_addr, sizeof(raw_addr)); | 202 isolate->random_number_generator()->NextBytes(&raw_addr, sizeof(raw_addr)); |
| 203 #if V8_TARGET_ARCH_X64 | 203 #if V8_TARGET_ARCH_X64 |
| 204 // Currently available CPUs have 48 bits of virtual addressing. Truncate | 204 // Currently available CPUs have 48 bits of virtual addressing. Truncate |
| 205 // the hint address to 46 bits to give the kernel a fighting chance of | 205 // the hint address to 46 bits to give the kernel a fighting chance of |
| 206 // fulfilling our placement request. | 206 // fulfilling our placement request. |
| 207 raw_addr &= V8_UINT64_C(0x3ffffffff000); | 207 raw_addr &= V8_UINT64_C(0x3ffffffff000); |
| 208 #elif V8_HOST_ARCH_ARM64 | |
| 209 // Currently available CPUs have 40 bits of virtual addressing with 39 for | |
|
Rodolph Perfetta
2014/05/21 08:00:08
DBC: arm64 has 48-bit virtual addresses
| |
| 210 // user space. Truncate the hint address to 38 bits to give the kernel a | |
| 211 // fighting chance of fulfilling our placement request. | |
| 212 raw_addr &= V8_UINT64_C(0x3ffffff000); | |
| 208 #else | 213 #else |
| 209 raw_addr &= 0x3ffff000; | 214 raw_addr &= 0x3ffff000; |
| 210 | 215 |
| 211 # ifdef __sun | 216 # ifdef __sun |
| 212 // For our Solaris/illumos mmap hint, we pick a random address in the bottom | 217 // For our Solaris/illumos mmap hint, we pick a random address in the bottom |
| 213 // half of the top half of the address space (that is, the third quarter). | 218 // half of the top half of the address space (that is, the third quarter). |
| 214 // Because we do not MAP_FIXED, this will be treated only as a hint -- the | 219 // Because we do not MAP_FIXED, this will be treated only as a hint -- the |
| 215 // system will not fail to mmap() because something else happens to already | 220 // system will not fail to mmap() because something else happens to already |
| 216 // be mapped at our random address. We deliberately set the hint high enough | 221 // be mapped at our random address. We deliberately set the hint high enough |
| 217 // to get well above the system's break (that is, the heap); Solaris and | 222 // to get well above the system's break (that is, the heap); Solaris and |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 751 | 756 |
| 752 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { | 757 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { |
| 753 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); | 758 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); |
| 754 int result = pthread_setspecific(pthread_key, value); | 759 int result = pthread_setspecific(pthread_key, value); |
| 755 ASSERT_EQ(0, result); | 760 ASSERT_EQ(0, result); |
| 756 USE(result); | 761 USE(result); |
| 757 } | 762 } |
| 758 | 763 |
| 759 | 764 |
| 760 } } // namespace v8::internal | 765 } } // namespace v8::internal |
| OLD | NEW |