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

Unified Diff: src/spaces.h

Issue 261037: Add an API to V8 to get simple heap statistics. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/spaces.h
===================================================================
--- src/spaces.h (revision 3088)
+++ src/spaces.h (working copy)
@@ -862,6 +862,10 @@
// Current capacity without growing (Size() + Available() + Waste()).
int Capacity() { return accounting_stats_.Capacity(); }
+ // Total amount of memory committed for this space. For paged
+ // spaces this equals the capacity.
+ int CommittedMemory() { return Capacity(); }
+
// Available bytes without growing.
int Available() { return accounting_stats_.Available(); }
@@ -1252,11 +1256,19 @@
// Return the allocated bytes in the active semispace.
virtual int Size() { return top() - bottom(); }
+
// Return the current capacity of a semispace.
int Capacity() {
ASSERT(to_space_.Capacity() == from_space_.Capacity());
return to_space_.Capacity();
}
+
+ // Return the total amount of memory committed for new space.
+ int CommittedMemory() {
+ if (from_space_.is_committed()) return 2 * Capacity();
+ return Capacity();
+ }
+
// Return the available bytes without growing in the active semispace.
int Available() { return Capacity() - Size(); }
« no previous file with comments | « src/heap.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698