| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 QNX goes here. For the POSIX-compatible | 5 // Platform-specific code for QNX 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 return new PosixMemoryMappedFile(file, memory, size); | 167 return new PosixMemoryMappedFile(file, memory, size); |
| 168 } | 168 } |
| 169 | 169 |
| 170 | 170 |
| 171 PosixMemoryMappedFile::~PosixMemoryMappedFile() { | 171 PosixMemoryMappedFile::~PosixMemoryMappedFile() { |
| 172 if (memory_) OS::Free(memory_, size_); | 172 if (memory_) OS::Free(memory_, size_); |
| 173 fclose(file_); | 173 fclose(file_); |
| 174 } | 174 } |
| 175 | 175 |
| 176 | 176 |
| 177 void OS::LogSharedLibraryAddresses(Isolate* isolate) { | 177 std::vector<OS::SharedLibraryAddress> OS::GetSharedLibraryAddresses() { |
| 178 std::vector<SharedLibraryAddress> result; |
| 178 procfs_mapinfo *mapinfos = NULL, *mapinfo; | 179 procfs_mapinfo *mapinfos = NULL, *mapinfo; |
| 179 int proc_fd, num, i; | 180 int proc_fd, num, i; |
| 180 | 181 |
| 181 struct { | 182 struct { |
| 182 procfs_debuginfo info; | 183 procfs_debuginfo info; |
| 183 char buff[PATH_MAX]; | 184 char buff[PATH_MAX]; |
| 184 } map; | 185 } map; |
| 185 | 186 |
| 186 char buf[PATH_MAX + 1]; | 187 char buf[PATH_MAX + 1]; |
| 187 snprintf(buf, PATH_MAX + 1, "/proc/%d/as", getpid()); | 188 snprintf(buf, PATH_MAX + 1, "/proc/%d/as", getpid()); |
| 188 | 189 |
| 189 if ((proc_fd = open(buf, O_RDONLY)) == -1) { | 190 if ((proc_fd = open(buf, O_RDONLY)) == -1) { |
| 190 close(proc_fd); | 191 close(proc_fd); |
| 191 return; | 192 return result; |
| 192 } | 193 } |
| 193 | 194 |
| 194 /* Get the number of map entries. */ | 195 /* Get the number of map entries. */ |
| 195 if (devctl(proc_fd, DCMD_PROC_MAPINFO, NULL, 0, &num) != EOK) { | 196 if (devctl(proc_fd, DCMD_PROC_MAPINFO, NULL, 0, &num) != EOK) { |
| 196 close(proc_fd); | 197 close(proc_fd); |
| 197 return; | 198 return result; |
| 198 } | 199 } |
| 199 | 200 |
| 200 mapinfos = reinterpret_cast<procfs_mapinfo *>( | 201 mapinfos = reinterpret_cast<procfs_mapinfo *>( |
| 201 malloc(num * sizeof(procfs_mapinfo))); | 202 malloc(num * sizeof(procfs_mapinfo))); |
| 202 if (mapinfos == NULL) { | 203 if (mapinfos == NULL) { |
| 203 close(proc_fd); | 204 close(proc_fd); |
| 204 return; | 205 return result; |
| 205 } | 206 } |
| 206 | 207 |
| 207 /* Fill the map entries. */ | 208 /* Fill the map entries. */ |
| 208 if (devctl(proc_fd, DCMD_PROC_PAGEDATA, | 209 if (devctl(proc_fd, DCMD_PROC_PAGEDATA, |
| 209 mapinfos, num * sizeof(procfs_mapinfo), &num) != EOK) { | 210 mapinfos, num * sizeof(procfs_mapinfo), &num) != EOK) { |
| 210 free(mapinfos); | 211 free(mapinfos); |
| 211 close(proc_fd); | 212 close(proc_fd); |
| 212 return; | 213 return result; |
| 213 } | 214 } |
| 214 | 215 |
| 215 for (i = 0; i < num; i++) { | 216 for (i = 0; i < num; i++) { |
| 216 mapinfo = mapinfos + i; | 217 mapinfo = mapinfos + i; |
| 217 if (mapinfo->flags & MAP_ELF) { | 218 if (mapinfo->flags & MAP_ELF) { |
| 218 map.info.vaddr = mapinfo->vaddr; | 219 map.info.vaddr = mapinfo->vaddr; |
| 219 if (devctl(proc_fd, DCMD_PROC_MAPDEBUG, &map, sizeof(map), 0) != EOK) { | 220 if (devctl(proc_fd, DCMD_PROC_MAPDEBUG, &map, sizeof(map), 0) != EOK) { |
| 220 continue; | 221 continue; |
| 221 } | 222 } |
| 222 LOG(isolate, SharedLibraryEvent(map.info.path, | 223 result.push_back(SharedLibraryAddress( |
| 223 mapinfo->vaddr, | 224 map.info.path, mapinfo->vaddr, mapinfo->vaddr + mapinfo->size)); |
| 224 mapinfo->vaddr + mapinfo->size)); | |
| 225 } | 225 } |
| 226 } | 226 } |
| 227 free(mapinfos); | 227 free(mapinfos); |
| 228 close(proc_fd); | 228 close(proc_fd); |
| 229 return result; |
| 229 } | 230 } |
| 230 | 231 |
| 231 | 232 |
| 232 void OS::SignalCodeMovingGC() { | 233 void OS::SignalCodeMovingGC() { |
| 233 } | 234 } |
| 234 | 235 |
| 235 | 236 |
| 236 // Constants used for mmap. | 237 // Constants used for mmap. |
| 237 static const int kMmapFd = -1; | 238 static const int kMmapFd = -1; |
| 238 static const int kMmapFdOffset = 0; | 239 static const int kMmapFdOffset = 0; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 bool VirtualMemory::ReleaseRegion(void* base, size_t size) { | 364 bool VirtualMemory::ReleaseRegion(void* base, size_t size) { |
| 364 return munmap(base, size) == 0; | 365 return munmap(base, size) == 0; |
| 365 } | 366 } |
| 366 | 367 |
| 367 | 368 |
| 368 bool VirtualMemory::HasLazyCommits() { | 369 bool VirtualMemory::HasLazyCommits() { |
| 369 return false; | 370 return false; |
| 370 } | 371 } |
| 371 | 372 |
| 372 } } // namespace v8::internal | 373 } } // namespace v8::internal |
| OLD | NEW |