OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 LOG(isolate SharedLibraryEvent(start_of_path, start, end)); | 192 LOG(isolate SharedLibraryEvent(start_of_path, start, end)); |
193 } | 193 } |
194 close(fd); | 194 close(fd); |
195 } | 195 } |
196 | 196 |
197 | 197 |
198 void OS::SignalCodeMovingGC() { | 198 void OS::SignalCodeMovingGC() { |
199 } | 199 } |
200 | 200 |
201 | 201 |
| 202 uintptr_t OS::TotalPhysicalMemory() { |
| 203 int pages, page_size; |
| 204 size_t size = sizeof(pages); |
| 205 sysctlbyname("vm.stats.vm.v_page_count", &pages, &size, NULL, 0); |
| 206 sysctlbyname("vm.stats.vm.v_page_size", &page_size, &size, NULL, 0); |
| 207 if (pages == -1 || page_size == -1) { |
| 208 UNREACHABLE(); |
| 209 return 0; |
| 210 } |
| 211 return static_cast<uintptr_t>(pages) * page_size; |
| 212 } |
| 213 |
202 | 214 |
203 // Constants used for mmap. | 215 // Constants used for mmap. |
204 static const int kMmapFd = -1; | 216 static const int kMmapFd = -1; |
205 static const int kMmapFdOffset = 0; | 217 static const int kMmapFdOffset = 0; |
206 | 218 |
207 | 219 |
208 VirtualMemory::VirtualMemory() : address_(NULL), size_(0) { } | 220 VirtualMemory::VirtualMemory() : address_(NULL), size_(0) { } |
209 | 221 |
210 | 222 |
211 VirtualMemory::VirtualMemory(size_t size) | 223 VirtualMemory::VirtualMemory(size_t size) |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 return munmap(base, size) == 0; | 342 return munmap(base, size) == 0; |
331 } | 343 } |
332 | 344 |
333 | 345 |
334 bool VirtualMemory::HasLazyCommits() { | 346 bool VirtualMemory::HasLazyCommits() { |
335 // TODO(alph): implement for the platform. | 347 // TODO(alph): implement for the platform. |
336 return false; | 348 return false; |
337 } | 349 } |
338 | 350 |
339 } } // namespace v8::internal | 351 } } // namespace v8::internal |
OLD | NEW |