Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Side by Side Diff: src/platform-linux.cc

Issue 24269003: Add methods to enable configuration of ResourceConstraints based on limits derived at runtime. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Move device-specific defaults into ConfigureResourceConstraintsForCurrentPlatform Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 #endif 306 #endif
307 MAP_PRIVATE, 307 MAP_PRIVATE,
308 fileno(f), 308 fileno(f),
309 0); 309 0);
310 ASSERT(addr != MAP_FAILED); 310 ASSERT(addr != MAP_FAILED);
311 OS::Free(addr, size); 311 OS::Free(addr, size);
312 fclose(f); 312 fclose(f);
313 } 313 }
314 314
315 315
316 uintptr_t OS::TotalPhysicalMemory() {
317 intptr_t pages = sysconf(_SC_PHYS_PAGES);
318 intptr_t page_size = sysconf(_SC_PAGESIZE);
319 if (pages == -1 || page_size == -1) {
320 UNREACHABLE();
321 return 0;
322 }
323 return static_cast<uintptr_t>(pages) * page_size;
324 }
325
326
316 // Constants used for mmap. 327 // Constants used for mmap.
317 static const int kMmapFd = -1; 328 static const int kMmapFd = -1;
318 static const int kMmapFdOffset = 0; 329 static const int kMmapFdOffset = 0;
319 330
320 331
321 VirtualMemory::VirtualMemory() : address_(NULL), size_(0) { } 332 VirtualMemory::VirtualMemory() : address_(NULL), size_(0) { }
322 333
323 334
324 VirtualMemory::VirtualMemory(size_t size) 335 VirtualMemory::VirtualMemory(size_t size)
325 : address_(ReserveRegion(size)), size_(size) { } 336 : address_(ReserveRegion(size)), size_(size) { }
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 bool VirtualMemory::ReleaseRegion(void* base, size_t size) { 460 bool VirtualMemory::ReleaseRegion(void* base, size_t size) {
450 return munmap(base, size) == 0; 461 return munmap(base, size) == 0;
451 } 462 }
452 463
453 464
454 bool VirtualMemory::HasLazyCommits() { 465 bool VirtualMemory::HasLazyCommits() {
455 return true; 466 return true;
456 } 467 }
457 468
458 } } // namespace v8::internal 469 } } // namespace v8::internal
OLDNEW
« src/heap.cc ('K') | « src/platform-freebsd.cc ('k') | src/platform-macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698