OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 AIX goes here. For the POSIX comaptible parts | 5 // Platform specific code for AIX goes here. For the POSIX comaptible parts |
6 // the implementation is in platform-posix.cc. | 6 // the implementation is in platform-posix.cc. |
7 | 7 |
8 #include <pthread.h> | 8 #include <pthread.h> |
9 #include <semaphore.h> | 9 #include <semaphore.h> |
10 #include <signal.h> | 10 #include <signal.h> |
(...skipping 28 matching lines...) Expand all Loading... |
39 static inline void* mmapHelper(size_t len, int prot, int flags, int fildes, | 39 static inline void* mmapHelper(size_t len, int prot, int flags, int fildes, |
40 off_t off) { | 40 off_t off) { |
41 void* addr = OS::GetRandomMmapAddr(); | 41 void* addr = OS::GetRandomMmapAddr(); |
42 return mmap(addr, len, prot, flags, fildes, off); | 42 return mmap(addr, len, prot, flags, fildes, off); |
43 } | 43 } |
44 | 44 |
45 | 45 |
46 const char* OS::LocalTimezone(double time, TimezoneCache* cache) { | 46 const char* OS::LocalTimezone(double time, TimezoneCache* cache) { |
47 if (std::isnan(time)) return ""; | 47 if (std::isnan(time)) return ""; |
48 time_t tv = static_cast<time_t>(floor(time / msPerSecond)); | 48 time_t tv = static_cast<time_t>(floor(time / msPerSecond)); |
49 struct tm* t = localtime(&tv); | 49 struct tm* t = localtime(&tv); // NOLINT(runtime/threadsafe_fn) |
50 if (NULL == t) return ""; | 50 if (NULL == t) return ""; |
51 return tzname[0]; // The location of the timezone string on AIX. | 51 return tzname[0]; // The location of the timezone string on AIX. |
52 } | 52 } |
53 | 53 |
54 | 54 |
55 double OS::LocalTimeOffset(TimezoneCache* cache) { | 55 double OS::LocalTimeOffset(TimezoneCache* cache) { |
56 // On AIX, struct tm does not contain a tm_gmtoff field. | 56 // On AIX, struct tm does not contain a tm_gmtoff field. |
57 time_t utc = time(NULL); | 57 time_t utc = time(NULL); |
58 DCHECK(utc != -1); | 58 DCHECK(utc != -1); |
59 struct tm* loc = localtime(&utc); | 59 struct tm* loc = localtime(&utc); // NOLINT(runtime/threadsafe_fn) |
60 DCHECK(loc != NULL); | 60 DCHECK(loc != NULL); |
61 return static_cast<double>((mktime(loc) - utc) * msPerSecond); | 61 return static_cast<double>((mktime(loc) - utc) * msPerSecond); |
62 } | 62 } |
63 | 63 |
64 | 64 |
65 void* OS::Allocate(const size_t requested, size_t* allocated, bool executable) { | 65 void* OS::Allocate(const size_t requested, size_t* allocated, bool executable) { |
66 const size_t msize = RoundUp(requested, getpagesize()); | 66 const size_t msize = RoundUp(requested, getpagesize()); |
67 int prot = PROT_READ | PROT_WRITE | (executable ? PROT_EXEC : 0); | 67 int prot = PROT_READ | PROT_WRITE | (executable ? PROT_EXEC : 0); |
68 void* mbase = mmapHelper(msize, prot, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); | 68 void* mbase = mmapHelper(msize, prot, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); |
69 | 69 |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 | 234 |
235 | 235 |
236 bool VirtualMemory::ReleaseRegion(void* base, size_t size) { | 236 bool VirtualMemory::ReleaseRegion(void* base, size_t size) { |
237 return munmap(base, size) == 0; | 237 return munmap(base, size) == 0; |
238 } | 238 } |
239 | 239 |
240 | 240 |
241 bool VirtualMemory::HasLazyCommits() { return true; } | 241 bool VirtualMemory::HasLazyCommits() { return true; } |
242 } | 242 } |
243 } // namespace v8::base | 243 } // namespace v8::base |
OLD | NEW |