Revision: 12640
Author: [email protected]
Date: Mon Oct 1 05:11:06 2012
Log: Revert r12625 due to sandbox incompatibility.
Original message: Implement committed physical memory stats for Linux.
This had to be reverted because it crashes when compiled into Chromium
due to the sandbox not allowing the mincore call.
[email protected]
BUG=v8:2191
Review URL: https://codereview.chromium.org/11023010
http://code.google.com/p/v8/source/detail?r=12640
Modified:
/branches/bleeding_edge/include/v8.h
/branches/bleeding_edge/src/api.cc
/branches/bleeding_edge/src/heap.cc
/branches/bleeding_edge/src/heap.h
/branches/bleeding_edge/src/platform-cygwin.cc
/branches/bleeding_edge/src/platform-freebsd.cc
/branches/bleeding_edge/src/platform-linux.cc
/branches/bleeding_edge/src/platform-macos.cc
/branches/bleeding_edge/src/platform-nullos.cc
/branches/bleeding_edge/src/platform-openbsd.cc
/branches/bleeding_edge/src/platform-solaris.cc
/branches/bleeding_edge/src/platform-win32.cc
/branches/bleeding_edge/src/platform.h
/branches/bleeding_edge/src/spaces.cc
/branches/bleeding_edge/src/spaces.h
=======================================
--- /branches/bleeding_edge/include/v8.h Thu Sep 27 06:27:50 2012
+++ /branches/bleeding_edge/include/v8.h Mon Oct 1 05:11:06 2012
@@ -2766,7 +2766,6 @@
HeapStatistics();
size_t total_heap_size() { return total_heap_size_; }
size_t total_heap_size_executable() { return
total_heap_size_executable_; }
- size_t total_physical_size() { return total_physical_size_; }
size_t used_heap_size() { return used_heap_size_; }
size_t heap_size_limit() { return heap_size_limit_; }
@@ -2775,15 +2774,11 @@
void set_total_heap_size_executable(size_t size) {
total_heap_size_executable_ = size;
}
- void set_total_physical_size(size_t size) {
- total_physical_size_ = size;
- }
void set_used_heap_size(size_t size) { used_heap_size_ = size; }
void set_heap_size_limit(size_t size) { heap_size_limit_ = size; }
size_t total_heap_size_;
size_t total_heap_size_executable_;
- size_t total_physical_size_;
size_t used_heap_size_;
size_t heap_size_limit_;
=======================================
--- /branches/bleeding_edge/src/api.cc Thu Sep 27 06:27:50 2012
+++ /branches/bleeding_edge/src/api.cc Mon Oct 1 05:11:06 2012
@@ -4306,7 +4306,6 @@
HeapStatistics::HeapStatistics(): total_heap_size_(0),
total_heap_size_executable_(0),
- total_physical_size_(0),
used_heap_size_(0),
heap_size_limit_(0) { }
@@ -4316,7 +4315,6 @@
// Isolate is unitialized thus heap is not configured yet.
heap_statistics->set_total_heap_size(0);
heap_statistics->set_total_heap_size_executable(0);
- heap_statistics->set_total_physical_size(0);
heap_statistics->set_used_heap_size(0);
heap_statistics->set_heap_size_limit(0);
return;
@@ -4326,7 +4324,6 @@
heap_statistics->set_total_heap_size(heap->CommittedMemory());
heap_statistics->set_total_heap_size_executable(
heap->CommittedMemoryExecutable());
-
heap_statistics->set_total_physical_size(heap->CommittedPhysicalMemory());
heap_statistics->set_used_heap_size(heap->SizeOfObjects());
heap_statistics->set_heap_size_limit(heap->MaxReserved());
}
=======================================
--- /branches/bleeding_edge/src/heap.cc Thu Sep 27 06:27:50 2012
+++ /branches/bleeding_edge/src/heap.cc Mon Oct 1 05:11:06 2012
@@ -210,20 +210,6 @@
cell_space_->CommittedMemory() +
lo_space_->Size();
}
-
-
-size_t Heap::CommittedPhysicalMemory() {
- if (!HasBeenSetUp()) return 0;
-
- return new_space_.CommittedPhysicalMemory() +
- old_pointer_space_->CommittedPhysicalMemory() +
- old_data_space_->CommittedPhysicalMemory() +
- code_space_->CommittedPhysicalMemory() +
- map_space_->CommittedPhysicalMemory() +
- cell_space_->CommittedPhysicalMemory() +
- lo_space_->CommittedPhysicalMemory();
-}
-
intptr_t Heap::CommittedMemoryExecutable() {
if (!HasBeenSetUp()) return 0;
=======================================
--- /branches/bleeding_edge/src/heap.h Thu Sep 27 06:27:50 2012
+++ /branches/bleeding_edge/src/heap.h Mon Oct 1 05:11:06 2012
@@ -486,9 +486,6 @@
// Returns the amount of executable memory currently committed for the
heap.
intptr_t CommittedMemoryExecutable();
- // Returns the amount of phyical memory currently committed for the heap.
- size_t CommittedPhysicalMemory();
-
// Returns the available bytes in space w/o growing.
// Heap doesn't guarantee that it can allocate an object that requires
// all available bytes. Check MaxHeapObjectSize() instead.
=======================================
--- /branches/bleeding_edge/src/platform-cygwin.cc Thu Sep 27 06:27:50 2012
+++ /branches/bleeding_edge/src/platform-cygwin.cc Mon Oct 1 05:11:06 2012
@@ -357,13 +357,6 @@
}
return true;
}
-
-
-bool VirtualMemory::CommittedPhysicalSizeInRegion(
- void* base, size_t size, size_t* physical) {
- // TODO(alph): implement for the platform.
- return false;
-}
class Thread::PlatformData : public Malloced {
=======================================
--- /branches/bleeding_edge/src/platform-freebsd.cc Thu Sep 27 06:27:50 2012
+++ /branches/bleeding_edge/src/platform-freebsd.cc Mon Oct 1 05:11:06 2012
@@ -454,13 +454,6 @@
bool VirtualMemory::ReleaseRegion(void* base, size_t size) {
return munmap(base, size) == 0;
}
-
-
-bool VirtualMemory::CommittedPhysicalSizeInRegion(
- void* base, size_t size, size_t* physical) {
- // TODO(alph): implement for the platform.
- return false;
-}
class Thread::PlatformData : public Malloced {
=======================================
--- /branches/bleeding_edge/src/platform-linux.cc Thu Sep 27 06:27:50 2012
+++ /branches/bleeding_edge/src/platform-linux.cc Mon Oct 1 05:11:06 2012
@@ -699,24 +699,6 @@
bool VirtualMemory::ReleaseRegion(void* base, size_t size) {
return munmap(base, size) == 0;
}
-
-
-bool VirtualMemory::CommittedPhysicalSizeInRegion(
- void* base, size_t size, size_t* physical) {
- const size_t page_size = sysconf(_SC_PAGESIZE);
- base = reinterpret_cast<void*>(
- reinterpret_cast<intptr_t>(base) & ~(page_size - 1));
- const size_t pages = (size + page_size - 1) / page_size;
- ScopedVector<unsigned char> buffer(pages);
- int result = mincore(base, size, buffer.start());
- if (result) return false;
- int resident_pages = 0;
- for (unsigned i = 0; i < pages; ++i) {
- resident_pages += buffer[i] & 1;
- }
- *physical = resident_pages * page_size;
- return true;
-}
class Thread::PlatformData : public Malloced {
=======================================
--- /branches/bleeding_edge/src/platform-macos.cc Thu Sep 27 06:27:50 2012
+++ /branches/bleeding_edge/src/platform-macos.cc Mon Oct 1 05:11:06 2012
@@ -469,13 +469,6 @@
bool VirtualMemory::ReleaseRegion(void* address, size_t size) {
return munmap(address, size) == 0;
}
-
-
-bool VirtualMemory::CommittedPhysicalSizeInRegion(
- void* base, size_t size, size_t* physical) {
- // TODO(alph): implement for the platform.
- return false;
-}
class Thread::PlatformData : public Malloced {
=======================================
--- /branches/bleeding_edge/src/platform-nullos.cc Thu Sep 27 06:27:50 2012
+++ /branches/bleeding_edge/src/platform-nullos.cc Mon Oct 1 05:11:06 2012
@@ -333,13 +333,6 @@
UNIMPLEMENTED();
return false;
}
-
-
-bool VirtualMemory::CommittedPhysicalSizeInRegion(
- void* base, size_t size, size_t* physical) {
- // TODO(alph): implement for the platform.
- return false;
-}
class Thread::PlatformData : public Malloced {
=======================================
--- /branches/bleeding_edge/src/platform-openbsd.cc Thu Sep 27 06:27:50 2012
+++ /branches/bleeding_edge/src/platform-openbsd.cc Mon Oct 1 05:11:06 2012
@@ -502,13 +502,6 @@
bool VirtualMemory::ReleaseRegion(void* base, size_t size) {
return munmap(base, size) == 0;
}
-
-
-bool VirtualMemory::CommittedPhysicalSizeInRegion(
- void* base, size_t size, size_t* physical) {
- // TODO(alph): implement for the platform.
- return false;
-}
class Thread::PlatformData : public Malloced {
=======================================
--- /branches/bleeding_edge/src/platform-solaris.cc Thu Sep 27 06:27:50 2012
+++ /branches/bleeding_edge/src/platform-solaris.cc Mon Oct 1 05:11:06 2012
@@ -446,13 +446,6 @@
bool VirtualMemory::ReleaseRegion(void* base, size_t size) {
return munmap(base, size) == 0;
}
-
-
-bool VirtualMemory::CommittedPhysicalSizeInRegion(
- void* base, size_t size, size_t* physical) {
- // TODO(alph): implement for the platform.
- return false;
-}
class Thread::PlatformData : public Malloced {
=======================================
--- /branches/bleeding_edge/src/platform-win32.cc Thu Sep 27 06:27:50 2012
+++ /branches/bleeding_edge/src/platform-win32.cc Mon Oct 1 05:11:06 2012
@@ -1549,13 +1549,6 @@
bool VirtualMemory::ReleaseRegion(void* base, size_t size) {
return VirtualFree(base, 0, MEM_RELEASE) != 0;
}
-
-
-bool VirtualMemory::CommittedPhysicalSizeInRegion(
- void* base, size_t size, size_t* physical) {
- // TODO(alph): implement for the platform.
- return false;
-}
//
----------------------------------------------------------------------------
=======================================
--- /branches/bleeding_edge/src/platform.h Thu Sep 27 06:27:50 2012
+++ /branches/bleeding_edge/src/platform.h Mon Oct 1 05:11:06 2012
@@ -429,14 +429,6 @@
// and the same size it was reserved with.
static bool ReleaseRegion(void* base, size_t size);
- // Returns the size of committed memory which is currently resident
- // in the physical memory for the region specified with base and size
- // arguments.
- // On success stores the committed physical memory size at the location
- // pointed by the last argument and returns true. Returns false on
failure.
- static bool CommittedPhysicalSizeInRegion(
- void* base, size_t size, size_t* physical);
-
private:
void* address_; // Start address of the virtual memory.
size_t size_; // Size of the virtual memory.
=======================================
--- /branches/bleeding_edge/src/spaces.cc Thu Sep 27 06:27:50 2012
+++ /branches/bleeding_edge/src/spaces.cc Mon Oct 1 05:11:06 2012
@@ -486,18 +486,6 @@
prev_chunk_ = NULL;
next_chunk_ = NULL;
}
-
-
-size_t MemoryChunk::CommittedPhysicalMemory() {
- size_t physical;
- size_t size = area_size();
- if (VirtualMemory::CommittedPhysicalSizeInRegion(
- area_start_, size, &physical)) {
- return physical;
- } else {
- return size;
- }
-}
MemoryChunk* MemoryAllocator::AllocateChunk(intptr_t body_size,
@@ -830,16 +818,6 @@
anchor_.set_prev_page(&anchor_);
accounting_stats_.Clear();
}
-
-
-size_t PagedSpace::CommittedPhysicalMemory() {
- size_t size = 0;
- PageIterator it(this);
- while (it.has_next()) {
- size += it.next()->CommittedPhysicalMemory();
- }
- return size;
-}
MaybeObject* PagedSpace::FindObject(Address addr) {
@@ -1405,17 +1383,6 @@
committed_ = false;
return true;
}
-
-
-size_t SemiSpace::CommittedPhysicalMemory() {
- if (!is_committed()) return 0;
- size_t size = 0;
- NewSpacePageIterator it(this);
- while (it.has_next()) {
- size += it.next()->CommittedPhysicalMemory();
- }
- return size;
-}
bool SemiSpace::GrowTo(int new_capacity) {
@@ -2720,17 +2687,6 @@
heap()->incremental_marking()->OldSpaceStep(object_size);
return object;
}
-
-
-size_t LargeObjectSpace::CommittedPhysicalMemory() {
- size_t size = 0;
- LargePage* current = first_page_;
- while (current != NULL) {
- size += current->CommittedPhysicalMemory();
- current = current->next_page();
- }
- return size;
-}
// GC support
=======================================
--- /branches/bleeding_edge/src/spaces.h Thu Sep 27 06:27:50 2012
+++ /branches/bleeding_edge/src/spaces.h Mon Oct 1 05:11:06 2012
@@ -652,8 +652,6 @@
int area_size() {
return static_cast<int>(area_end() - area_start());
}
-
- size_t CommittedPhysicalMemory();
protected:
MemoryChunk* next_chunk_;
@@ -1529,9 +1527,6 @@
// Total amount of memory committed for this space. For paged
// spaces this equals the capacity.
intptr_t CommittedMemory() { return Capacity(); }
-
- // Total amount of physical memory committed for this space.
- size_t CommittedPhysicalMemory();
// Sets the capacity, the available space and the wasted space to zero.
// The stats are rebuilt during sweeping by adding each page to the
@@ -1999,8 +1994,6 @@
static void Swap(SemiSpace* from, SemiSpace* to);
- size_t CommittedPhysicalMemory();
-
private:
// Flips the semispace between being from-space and to-space.
// Copies the flags into the masked positions on all pages in the space.
@@ -2197,12 +2190,6 @@
if (from_space_.is_committed()) return 2 * Capacity();
return Capacity();
}
-
- size_t CommittedPhysicalMemory() {
- return to_space_.CommittedPhysicalMemory()
- + (from_space_.is_committed() ?
from_space_.CommittedPhysicalMemory()
- : 0);
- }
// Return the available bytes without growing.
intptr_t Available() {
@@ -2570,8 +2557,6 @@
intptr_t CommittedMemory() {
return Size();
}
-
- size_t CommittedPhysicalMemory();
int PageCount() {
return page_count_;
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev