| 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 MacOS goes here. For the POSIX-compatible | 5 // Platform-specific code for MacOS 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 <dlfcn.h> | 8 #include <dlfcn.h> |
| 9 #include <mach/mach_init.h> | 9 #include <mach/mach_init.h> |
| 10 #include <mach-o/dyld.h> | 10 #include <mach-o/dyld.h> |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 } | 95 } |
| 96 | 96 |
| 97 | 97 |
| 98 void OS::SignalCodeMovingGC() { | 98 void OS::SignalCodeMovingGC() { |
| 99 } | 99 } |
| 100 | 100 |
| 101 | 101 |
| 102 const char* OS::LocalTimezone(double time, TimezoneCache* cache) { | 102 const char* OS::LocalTimezone(double time, TimezoneCache* cache) { |
| 103 if (std::isnan(time)) return ""; | 103 if (std::isnan(time)) return ""; |
| 104 time_t tv = static_cast<time_t>(std::floor(time/msPerSecond)); | 104 time_t tv = static_cast<time_t>(std::floor(time/msPerSecond)); |
| 105 struct tm* t = localtime(&tv); | 105 struct tm* t = localtime(&tv); // NOLINT(runtime/threadsafe_fn) |
| 106 if (NULL == t) return ""; | 106 if (NULL == t) return ""; |
| 107 return t->tm_zone; | 107 return t->tm_zone; |
| 108 } | 108 } |
| 109 | 109 |
| 110 | 110 |
| 111 double OS::LocalTimeOffset(TimezoneCache* cache) { | 111 double OS::LocalTimeOffset(TimezoneCache* cache) { |
| 112 time_t tv = time(NULL); | 112 time_t tv = time(NULL); |
| 113 struct tm* t = localtime(&tv); | 113 struct tm* t = localtime(&tv); // NOLINT(runtime/threadsafe_fn) |
| 114 // tm_gmtoff includes any daylight savings offset, so subtract it. | 114 // tm_gmtoff includes any daylight savings offset, so subtract it. |
| 115 return static_cast<double>(t->tm_gmtoff * msPerSecond - | 115 return static_cast<double>(t->tm_gmtoff * msPerSecond - |
| 116 (t->tm_isdst > 0 ? 3600 * msPerSecond : 0)); | 116 (t->tm_isdst > 0 ? 3600 * msPerSecond : 0)); |
| 117 } | 117 } |
| 118 | 118 |
| 119 | 119 |
| 120 VirtualMemory::VirtualMemory() : address_(NULL), size_(0) { } | 120 VirtualMemory::VirtualMemory() : address_(NULL), size_(0) { } |
| 121 | 121 |
| 122 | 122 |
| 123 VirtualMemory::VirtualMemory(size_t size) | 123 VirtualMemory::VirtualMemory(size_t size) |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 bool VirtualMemory::ReleaseRegion(void* address, size_t size) { | 243 bool VirtualMemory::ReleaseRegion(void* address, size_t size) { |
| 244 return munmap(address, size) == 0; | 244 return munmap(address, size) == 0; |
| 245 } | 245 } |
| 246 | 246 |
| 247 | 247 |
| 248 bool VirtualMemory::HasLazyCommits() { | 248 bool VirtualMemory::HasLazyCommits() { |
| 249 return false; | 249 return false; |
| 250 } | 250 } |
| 251 | 251 |
| 252 } } // namespace v8::base | 252 } } // namespace v8::base |
| OLD | NEW |