Add reporting of JS heap size limit to GetHeapStatistics.

I found it useful to know inside the heap profiler to avoid
crashes due to heap overflow.

Review URL: http://codereview.chromium.org/6111007

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6266 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent a314fa45
......@@ -2515,6 +2515,7 @@ class V8EXPORT HeapStatistics {
size_t total_heap_size() { return total_heap_size_; }
size_t total_heap_size_executable() { return total_heap_size_executable_; }
size_t used_heap_size() { return used_heap_size_; }
size_t heap_size_limit() { return heap_size_limit_; }
private:
void set_total_heap_size(size_t size) { total_heap_size_ = size; }
......@@ -2522,10 +2523,12 @@ class V8EXPORT HeapStatistics {
total_heap_size_executable_ = 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 used_heap_size_;
size_t heap_size_limit_;
friend class V8;
};
......
......@@ -3299,7 +3299,8 @@ bool v8::V8::Dispose() {
HeapStatistics::HeapStatistics(): total_heap_size_(0),
total_heap_size_executable_(0),
used_heap_size_(0) { }
used_heap_size_(0),
heap_size_limit_(0) { }
void v8::V8::GetHeapStatistics(HeapStatistics* heap_statistics) {
......@@ -3307,6 +3308,7 @@ void v8::V8::GetHeapStatistics(HeapStatistics* heap_statistics) {
heap_statistics->set_total_heap_size_executable(
i::Heap::CommittedMemoryExecutable());
heap_statistics->set_used_heap_size(i::Heap::SizeOfObjects());
heap_statistics->set_heap_size_limit(i::Heap::MaxReserved());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment