| 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 FreeBSD goes here. For the POSIX-compatible | 5 // Platform-specific code for FreeBSD goes here. For the POSIX-compatible |
| 6 // parts, the implementation is in platform-posix.cc. | 6 // parts, 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 21 matching lines...) Expand all Loading... |
| 32 #include "src/base/platform/platform.h" | 32 #include "src/base/platform/platform.h" |
| 33 | 33 |
| 34 | 34 |
| 35 namespace v8 { | 35 namespace v8 { |
| 36 namespace base { | 36 namespace base { |
| 37 | 37 |
| 38 | 38 |
| 39 const char* OS::LocalTimezone(double time, TimezoneCache* cache) { | 39 const char* OS::LocalTimezone(double time, TimezoneCache* cache) { |
| 40 if (std::isnan(time)) return ""; | 40 if (std::isnan(time)) return ""; |
| 41 time_t tv = static_cast<time_t>(std::floor(time/msPerSecond)); | 41 time_t tv = static_cast<time_t>(std::floor(time/msPerSecond)); |
| 42 struct tm* t = localtime(&tv); | 42 struct tm* t = localtime(&tv); // NOLINT(runtime/threadsafe_fn) |
| 43 if (NULL == t) return ""; | 43 if (NULL == t) return ""; |
| 44 return t->tm_zone; | 44 return t->tm_zone; |
| 45 } | 45 } |
| 46 | 46 |
| 47 | 47 |
| 48 double OS::LocalTimeOffset(TimezoneCache* cache) { | 48 double OS::LocalTimeOffset(TimezoneCache* cache) { |
| 49 time_t tv = time(NULL); | 49 time_t tv = time(NULL); |
| 50 struct tm* t = localtime(&tv); | 50 struct tm* t = localtime(&tv); // NOLINT(runtime/threadsafe_fn) |
| 51 // tm_gmtoff includes any daylight savings offset, so subtract it. | 51 // tm_gmtoff includes any daylight savings offset, so subtract it. |
| 52 return static_cast<double>(t->tm_gmtoff * msPerSecond - | 52 return static_cast<double>(t->tm_gmtoff * msPerSecond - |
| 53 (t->tm_isdst > 0 ? 3600 * msPerSecond : 0)); | 53 (t->tm_isdst > 0 ? 3600 * msPerSecond : 0)); |
| 54 } | 54 } |
| 55 | 55 |
| 56 | 56 |
| 57 void* OS::Allocate(const size_t requested, | 57 void* OS::Allocate(const size_t requested, |
| 58 size_t* allocated, | 58 size_t* allocated, |
| 59 bool executable) { | 59 bool executable) { |
| 60 const size_t msize = RoundUp(requested, getpagesize()); | 60 const size_t msize = RoundUp(requested, getpagesize()); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 return munmap(base, size) == 0; | 249 return munmap(base, size) == 0; |
| 250 } | 250 } |
| 251 | 251 |
| 252 | 252 |
| 253 bool VirtualMemory::HasLazyCommits() { | 253 bool VirtualMemory::HasLazyCommits() { |
| 254 // TODO(alph): implement for the platform. | 254 // TODO(alph): implement for the platform. |
| 255 return false; | 255 return false; |
| 256 } | 256 } |
| 257 | 257 |
| 258 } } // namespace v8::base | 258 } } // namespace v8::base |
| OLD | NEW |