| 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 <unistd.h> | 9 #include <unistd.h> |
| 10 #include <sys/mman.h> | 10 #include <sys/mman.h> |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 return new PosixMemoryMappedFile(file, memory, size); | 118 return new PosixMemoryMappedFile(file, memory, size); |
| 119 } | 119 } |
| 120 | 120 |
| 121 | 121 |
| 122 PosixMemoryMappedFile::~PosixMemoryMappedFile() { | 122 PosixMemoryMappedFile::~PosixMemoryMappedFile() { |
| 123 if (memory_) OS::Free(memory_, size_); | 123 if (memory_) OS::Free(memory_, size_); |
| 124 fclose(file_); | 124 fclose(file_); |
| 125 } | 125 } |
| 126 | 126 |
| 127 | 127 |
| 128 void OS::LogSharedLibraryAddresses(Isolate* isolate) { | 128 std::vector<OS::SharedLibraryAddress> OS::GetSharedLibraryAddresses() { |
| 129 std::vector<SharedLibraryAddress> result; |
| 129 unsigned int images_count = _dyld_image_count(); | 130 unsigned int images_count = _dyld_image_count(); |
| 130 for (unsigned int i = 0; i < images_count; ++i) { | 131 for (unsigned int i = 0; i < images_count; ++i) { |
| 131 const mach_header* header = _dyld_get_image_header(i); | 132 const mach_header* header = _dyld_get_image_header(i); |
| 132 if (header == NULL) continue; | 133 if (header == NULL) continue; |
| 133 #if V8_HOST_ARCH_X64 | 134 #if V8_HOST_ARCH_X64 |
| 134 uint64_t size; | 135 uint64_t size; |
| 135 char* code_ptr = getsectdatafromheader_64( | 136 char* code_ptr = getsectdatafromheader_64( |
| 136 reinterpret_cast<const mach_header_64*>(header), | 137 reinterpret_cast<const mach_header_64*>(header), |
| 137 SEG_TEXT, | 138 SEG_TEXT, |
| 138 SECT_TEXT, | 139 SECT_TEXT, |
| 139 &size); | 140 &size); |
| 140 #else | 141 #else |
| 141 unsigned int size; | 142 unsigned int size; |
| 142 char* code_ptr = getsectdatafromheader(header, SEG_TEXT, SECT_TEXT, &size); | 143 char* code_ptr = getsectdatafromheader(header, SEG_TEXT, SECT_TEXT, &size); |
| 143 #endif | 144 #endif |
| 144 if (code_ptr == NULL) continue; | 145 if (code_ptr == NULL) continue; |
| 145 const uintptr_t slide = _dyld_get_image_vmaddr_slide(i); | 146 const uintptr_t slide = _dyld_get_image_vmaddr_slide(i); |
| 146 const uintptr_t start = reinterpret_cast<uintptr_t>(code_ptr) + slide; | 147 const uintptr_t start = reinterpret_cast<uintptr_t>(code_ptr) + slide; |
| 147 LOG(isolate, | 148 result.push_back( |
| 148 SharedLibraryEvent(_dyld_get_image_name(i), start, start + size)); | 149 SharedLibraryAddress(_dyld_get_image_name(i), start, start + size)); |
| 149 } | 150 } |
| 151 return result; |
| 150 } | 152 } |
| 151 | 153 |
| 152 | 154 |
| 153 void OS::SignalCodeMovingGC() { | 155 void OS::SignalCodeMovingGC() { |
| 154 } | 156 } |
| 155 | 157 |
| 156 | 158 |
| 157 const char* OS::LocalTimezone(double time, TimezoneCache* cache) { | 159 const char* OS::LocalTimezone(double time, TimezoneCache* cache) { |
| 158 if (std::isnan(time)) return ""; | 160 if (std::isnan(time)) return ""; |
| 159 time_t tv = static_cast<time_t>(std::floor(time/msPerSecond)); | 161 time_t tv = static_cast<time_t>(std::floor(time/msPerSecond)); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 bool VirtualMemory::ReleaseRegion(void* address, size_t size) { | 300 bool VirtualMemory::ReleaseRegion(void* address, size_t size) { |
| 299 return munmap(address, size) == 0; | 301 return munmap(address, size) == 0; |
| 300 } | 302 } |
| 301 | 303 |
| 302 | 304 |
| 303 bool VirtualMemory::HasLazyCommits() { | 305 bool VirtualMemory::HasLazyCommits() { |
| 304 return false; | 306 return false; |
| 305 } | 307 } |
| 306 | 308 |
| 307 } } // namespace v8::internal | 309 } } // namespace v8::internal |
| OLD | NEW |