Chromium Code Reviews| Index: src/spaces.h |
| =================================================================== |
| --- src/spaces.h (revision 9457) |
| +++ src/spaces.h (working copy) |
| @@ -1286,7 +1286,7 @@ |
| void set_size(Heap* heap, int size_in_bytes); |
| // Accessors for the next field. |
| - inline FreeListNode* next(); |
| + FreeListNode* next(); |
| inline FreeListNode** next_address(); |
| inline void set_next(FreeListNode* next); |
| @@ -1351,13 +1351,25 @@ |
| #ifdef DEBUG |
| void Zap(); |
| static intptr_t SumFreeList(FreeListNode* node); |
| - static int FreeListLength(FreeListNode* cur); |
| intptr_t SumFreeLists(); |
| - bool IsVeryLong(); |
| #endif |
| + static int FreeListLength(FreeListNode* cur); |
| + bool IsVeryLong(); |
| void CountFreeListItems(Page* p, intptr_t* sizes); |
| + FreeListNode* get_chain(int i) { |
|
Vyacheslav Egorov (Chromium)
2011/09/28 15:21:11
make enum!
|
| + switch (i) { |
| + case 0: return small_list_; |
| + case 1: return medium_list_; |
| + case 2: return large_list_; |
| + case 3: return huge_list_; |
| + } |
| + UNREACHABLE(); |
| + return NULL; |
| + } |
| + static const int kNumberOfChains = 4; |
| + |
| private: |
| // The size range of blocks, in bytes. |
| static const int kMinBlockSize = 3 * kPointerSize; |
| @@ -1486,13 +1498,10 @@ |
| int FreeOrUnmapPage(Page* page, Address start, int size_in_bytes); |
| + void VisualizeTopChange(Address top); |
| + |
| // Set space allocation info. |
| - void SetTop(Address top, Address limit) { |
| - ASSERT(top == limit || |
| - Page::FromAddress(top) == Page::FromAddress(limit - 1)); |
| - allocation_info_.top = top; |
| - allocation_info_.limit = limit; |
| - } |
| + inline void SetTop(Address top, Address limit); |
| void Allocate(int bytes) { |
| accounting_stats_.AllocateBytes(bytes); |
| @@ -1590,6 +1599,8 @@ |
| bool CanExpand(); |
| + FreeList* free_list() { return &free_list_; } |
| + |
| protected: |
| // Maximum capacity of this space. |
| intptr_t max_capacity_; |
| @@ -1606,6 +1617,8 @@ |
| // Normal allocation information. |
| AllocationInfo allocation_info_; |
| + Address last_visualized_top_; |
| + |
| // Bytes of each page that cannot be allocated. Possibly non-zero |
| // for pages in spaces with only fixed-size objects. Always zero |
| // for pages in spaces with variable sized objects (those pages are |
| @@ -1717,6 +1730,14 @@ |
| == kObjectStartOffset; |
| } |
| + Address ObjectAreaStart() { |
| + return address() + kObjectStartOffset; |
| + } |
| + |
| + Address ObjectAreaEnd() { |
| + return address() + Page::kPageSize; |
| + } |
| + |
| static bool IsAtEnd(Address addr) { |
| return (reinterpret_cast<intptr_t>(addr) & Page::kPageAlignmentMask) == 0; |
| } |
| @@ -2025,7 +2046,8 @@ |
| to_space_(heap, kToSpace), |
| from_space_(heap, kFromSpace), |
| reservation_(), |
| - inline_allocation_limit_step_(0) {} |
| + inline_allocation_limit_step_(0), |
| + last_visualized_top_(NULL) {} |
| // Sets up the new space using the given chunk. |
| bool Setup(int reserved_semispace_size_, int max_semispace_size); |
| @@ -2042,6 +2064,9 @@ |
| // Flip the pair of spaces. |
| void Flip(); |
| + void VisualizeTop(); |
| + void VisualizeUnallocation(SemiSpace* semispace); |
| + |
| // Grow the capacity of the semispaces. Assumes that they are not at |
| // their maximum capacity. |
| void Grow(); |
| @@ -2118,6 +2143,8 @@ |
| // Get the age mark of the inactive semispace. |
| Address age_mark() { return from_space_.age_mark(); } |
| + // Get the age mark of the active semispace. |
| + Address to_space_age_mark() { return to_space_.age_mark(); } |
| // Set the age mark in the active semispace. |
| void set_age_mark(Address mark) { to_space_.set_age_mark(mark); } |
| @@ -2269,6 +2296,8 @@ |
| HistogramInfo* allocated_histogram_; |
| HistogramInfo* promoted_histogram_; |
| + Address last_visualized_top_; |
| + |
| // Implementation of AllocateRaw. |
| MUST_USE_RESULT inline MaybeObject* AllocateRawInternal(int size_in_bytes); |