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

Unified Diff: src/spaces.h

Issue 13798002: On-the-fly bookkeeping of PagedSpace memory kept in free-lists. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 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/mark-compact.cc ('k') | src/spaces.cc » ('j') | src/spaces.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/spaces.h
diff --git a/src/spaces.h b/src/spaces.h
index 65eefd015e45d33bdbd4efc7c67fd259a8cfa5c1..2f403d204acdabc0266243cf7103474d97a03f82 100644
--- a/src/spaces.h
+++ b/src/spaces.h
@@ -547,7 +547,8 @@ class MemoryChunk {
kSlotsBufferOffset + kPointerSize + kPointerSize;
static const size_t kHeaderSize = kWriteBarrierCounterOffset + kPointerSize +
- kIntSize + kIntSize + kPointerSize;
+ kIntSize + kIntSize + kPointerSize +
+ 5 * kPointerSize;
Michael Starzinger 2013/04/09 16:56:04 As discussed offline: Can we check whether that st
Hannes Payer (out of office) 2013/04/10 07:53:49 It still fits.
static const int kBodyOffset =
CODE_POINTER_ALIGN(kHeaderSize + Bitmap::kSize);
@@ -724,6 +725,7 @@ STATIC_CHECK(sizeof(MemoryChunk) <= MemoryChunk::kHeaderSize);
// Page* p = Page::FromAllocationTop(top);
class Page : public MemoryChunk {
public:
+ Page();
Michael Starzinger 2013/04/09 16:56:04 There should be no constructor for Pages, they sho
Hannes Payer (out of office) 2013/04/10 07:53:49 Done.
// Returns the page containing a given address. The address ranges
// from [page_addr .. page_addr + kPageSize[
// This only works if the object is in fact in a page. See also MemoryChunk::
@@ -797,10 +799,80 @@ class Page : public MemoryChunk {
void ClearSweptPrecisely() { ClearFlag(WAS_SWEPT_PRECISELY); }
void ClearSweptConservatively() { ClearFlag(WAS_SWEPT_CONSERVATIVELY); }
+ void ResetFreeListStatistics();
+
+ intptr_t available_in_small_free_list() const {
+ return available_in_small_free_list_;
+ }
+
+ void set_available_in_small_free_list(intptr_t available_in_small_free_list) {
Michael Starzinger 2013/04/09 16:56:04 Just an idea. We could use macros to generate this
Hannes Payer (out of office) 2013/04/10 07:53:49 Done.
+ available_in_small_free_list_ = available_in_small_free_list;
+ }
+
+ void AddAvailableInSmallFreeList(intptr_t add) {
+ available_in_small_free_list_ += add;
+ }
+
+ intptr_t available_in_medium_free_list() const {
+ return available_in_medium_free_list_;
+ }
+
+ void set_available_in_medium_free_list(
+ intptr_t available_in_medium_free_list) {
+ available_in_medium_free_list_ = available_in_medium_free_list;
+ }
+
+ void AddAvailableInMediumFreeList(intptr_t add) {
+ available_in_medium_free_list_ += add;
+ }
+
+ intptr_t available_in_large_free_list() const {
+ return available_in_large_free_list_;
+ }
+
+ void set_available_in_large_free_list(intptr_t available_in_large_free_list) {
+ available_in_large_free_list_ = available_in_large_free_list;
+ }
+
+ void AddAvailableInLargeFreeList(intptr_t add) {
+ available_in_large_free_list_ += add;
+ }
+
+ intptr_t available_in_huge_free_list() const {
+ return available_in_huge_free_list_;
+ }
+
+ void set_available_in_huge_free_list(intptr_t available_in_huge_free_list) {
+ available_in_huge_free_list_ = available_in_huge_free_list;
+ }
+
+ void AddAvailableInHugeFreeList(intptr_t add) {
+ available_in_huge_free_list_ += add;
+ }
+
+ intptr_t non_available_small_blocks() const {
+ return non_available_small_blocks_;
+ }
+
+ void set_non_available_small_blocks(intptr_t non_available_small_blocks) {
+ non_available_small_blocks_ = non_available_small_blocks;
+ }
+
+ void AddNonAvailableSmallBlocks(intptr_t add) {
+ non_available_small_blocks_ += add;
+ }
+
#ifdef DEBUG
void Print();
#endif // DEBUG
+ private:
+ intptr_t available_in_small_free_list_;
+ intptr_t available_in_medium_free_list_;
+ intptr_t available_in_large_free_list_;
+ intptr_t available_in_huge_free_list_;
+ intptr_t non_available_small_blocks_;
+
friend class MemoryAllocator;
};
@@ -1432,8 +1504,6 @@ class FreeListCategory {
FreeListNode* PickNodeFromList(int *node_size);
- intptr_t CountFreeListItemsInList(Page* p);
-
intptr_t EvictFreeListItemsInList(Page* p);
void RepairFreeList(Heap* heap);
@@ -1528,19 +1598,6 @@ class FreeList BASE_EMBEDDED {
// Used after booting the VM.
void RepairLists(Heap* heap);
- struct SizeStats {
- intptr_t Total() {
- return small_size_ + medium_size_ + large_size_ + huge_size_;
- }
-
- intptr_t small_size_;
- intptr_t medium_size_;
- intptr_t large_size_;
- intptr_t huge_size_;
- };
-
- void CountFreeListItems(Page* p, SizeStats* sizes);
-
intptr_t EvictFreeListItems(Page* p);
FreeListCategory* small_list() { return &small_list_; }
@@ -1625,6 +1682,20 @@ class PagedSpace : public Space {
// Approximate amount of physical memory committed for this space.
size_t CommittedPhysicalMemory();
+ struct SizeStats {
+ intptr_t Total() {
+ return small_size_ + medium_size_ + large_size_ + huge_size_;
+ }
+
+ intptr_t small_size_;
+ intptr_t medium_size_;
+ intptr_t large_size_;
+ intptr_t huge_size_;
+ };
+
+ void ObtainFreeListStatistics(Page* p, SizeStats* sizes);
+ void ResetFreeListStatistics();
+
// Sets the capacity, the available space and the wasted space to zero.
// The stats are rebuilt during sweeping by adding each page to the
// capacity and the size when it is encountered. As free spaces are
@@ -1632,6 +1703,7 @@ class PagedSpace : public Space {
// to the available and wasted totals.
void ClearStats() {
accounting_stats_.ClearSizeWaste();
+ ResetFreeListStatistics();
}
// Increases the number of available bytes of that space.
@@ -1785,10 +1857,6 @@ class PagedSpace : public Space {
Page* FirstPage() { return anchor_.next_page(); }
Page* LastPage() { return anchor_.prev_page(); }
- void CountFreeListItems(Page* p, FreeList::SizeStats* sizes) {
- free_list_.CountFreeListItems(p, sizes);
- }
-
void EvictEvacuationCandidatesFromFreeLists();
bool CanExpand();
« no previous file with comments | « src/mark-compact.cc ('k') | src/spaces.cc » ('j') | src/spaces.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698