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

Unified Diff: src/heap.h

Issue 4888001: Provide more accurate results about used heap size via GetHeapStatistics. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Aligned sizes reported by Heap::SizeOfObjects and HeapIterator with free nodes filtering Created 10 years, 1 month 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 | « no previous file | src/heap.cc » ('j') | src/heap.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap.h
diff --git a/src/heap.h b/src/heap.h
index c37ced39399830e48d4fd59f1ae420f1ec3c0fb4..dfcb9981d76f225734e0db83f65719e25dd59269 100644
--- a/src/heap.h
+++ b/src/heap.h
@@ -1558,6 +1558,7 @@ class PagedSpaces BASE_EMBEDDED {
class SpaceIterator : public Malloced {
public:
SpaceIterator();
+ explicit SpaceIterator(HeapObjectCallback size_func);
virtual ~SpaceIterator();
bool has_next();
@@ -1568,17 +1569,31 @@ class SpaceIterator : public Malloced {
int current_space_; // from enum AllocationSpace.
ObjectIterator* iterator_; // object iterator for the current space.
+ HeapObjectCallback size_func_;
};
-// A HeapIterator provides iteration over the whole heap It aggregates a the
-// specific iterators for the different spaces as these can only iterate over
-// one space only.
+// A HeapIterator provides iteration over the whole heap It aggregates
antonm 2010/11/13 17:37:51 nit: a dot after 'heap'.
mnaganov (inactive) 2010/11/13 19:05:30 Done.
+// a the specific iterators for the different spaces as these can only
antonm 2010/11/13 17:37:51 nit: 'a' and 'the' at the beginning of the line
mnaganov (inactive) 2010/11/13 19:05:30 Done.
+// iterate over one space only.
+//
+// HeapIterator can skip free list nodes (that is, de-allocated heap
+// objects that still remain in the heap). As implementation of free
+// nodes filtering uses GC marks, it can't be used during MS/MC GC
+// phases. Also, it is forbidden to interrupt iteration in this mode,
+// as this will leave heap objects marked (and thus, unusable).
+class FreeListNodesFilter;
class HeapIterator BASE_EMBEDDED {
public:
- explicit HeapIterator();
- virtual ~HeapIterator();
+ enum FreeListNodesFiltering {
+ kNoFiltering,
+ kPreciseFiltering
+ };
+
+ HeapIterator();
+ explicit HeapIterator(FreeListNodesFiltering filtering);
antonm 2010/11/13 17:37:51 maybe turn filtering it a param with default value
mnaganov (inactive) 2010/11/13 19:05:30 The style guide is against it: http://google-style
+ ~HeapIterator();
HeapObject* next();
void reset();
@@ -1586,10 +1601,12 @@ class HeapIterator BASE_EMBEDDED {
private:
// Perform the initialization.
void Init();
-
// Perform all necessary shutdown (destruction) work.
void Shutdown();
+ HeapObject* NextObject();
+ FreeListNodesFiltering filtering_;
+ FreeListNodesFilter* filter_;
// Space iterator for iterating all the spaces.
SpaceIterator* space_iterator_;
// Object iterator for the space currently being iterated.
« no previous file with comments | « no previous file | src/heap.cc » ('j') | src/heap.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698