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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 free(lib_name); | 198 free(lib_name); |
199 fclose(fp); | 199 fclose(fp); |
200 } | 200 } |
201 | 201 |
202 | 202 |
203 void OS::SignalCodeMovingGC() { | 203 void OS::SignalCodeMovingGC() { |
204 // Nothing to do on Cygwin. | 204 // Nothing to do on Cygwin. |
205 } | 205 } |
206 | 206 |
207 | 207 |
| 208 uintptr_t OS::TotalPhysicalMemory() { |
| 209 MEMORYSTATUS memory_info; |
| 210 memory_info.dwLength = sizeof(memory_info); |
| 211 if (!GlobalMemoryStatus(&memory_info)) { |
| 212 UNREACHABLE(); |
| 213 return 0; |
| 214 } |
| 215 |
| 216 return static_cast<uintptr_t>(memory_info.dwTotalPhys); |
| 217 } |
| 218 |
| 219 |
208 // The VirtualMemory implementation is taken from platform-win32.cc. | 220 // The VirtualMemory implementation is taken from platform-win32.cc. |
209 // The mmap-based virtual memory implementation as it is used on most posix | 221 // The mmap-based virtual memory implementation as it is used on most posix |
210 // platforms does not work well because Cygwin does not support MAP_FIXED. | 222 // platforms does not work well because Cygwin does not support MAP_FIXED. |
211 // This causes VirtualMemory::Commit to not always commit the memory region | 223 // This causes VirtualMemory::Commit to not always commit the memory region |
212 // specified. | 224 // specified. |
213 | 225 |
214 static void* GetRandomAddr() { | 226 static void* GetRandomAddr() { |
215 Isolate* isolate = Isolate::UncheckedCurrent(); | 227 Isolate* isolate = Isolate::UncheckedCurrent(); |
216 // Note that the current isolate isn't set up in a call path via | 228 // Note that the current isolate isn't set up in a call path via |
217 // CpuFeatures::Probe. We don't care about randomization in this case because | 229 // CpuFeatures::Probe. We don't care about randomization in this case because |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 return VirtualFree(base, 0, MEM_RELEASE) != 0; | 366 return VirtualFree(base, 0, MEM_RELEASE) != 0; |
355 } | 367 } |
356 | 368 |
357 | 369 |
358 bool VirtualMemory::HasLazyCommits() { | 370 bool VirtualMemory::HasLazyCommits() { |
359 // TODO(alph): implement for the platform. | 371 // TODO(alph): implement for the platform. |
360 return false; | 372 return false; |
361 } | 373 } |
362 | 374 |
363 } } // namespace v8::internal | 375 } } // namespace v8::internal |
OLD | NEW |