Chromium Code Reviews| Index: src/spaces.h |
| diff --git a/src/spaces.h b/src/spaces.h |
| index bb7adf7133866eefe6e38b1631da5f0693ce860c..972fe3311b9500830c0b8f4a6c88c5053c0af541 100644 |
| --- a/src/spaces.h |
| +++ b/src/spaces.h |
| @@ -454,6 +454,18 @@ class MemoryChunk { |
| // Return all current flags. |
| intptr_t GetFlags() { return flags_; } |
| + intptr_t parallel_sweeping() const { |
| + return parallel_sweeping_; |
| + } |
| + |
| + void set_parallel_sweeping(intptr_t state) { |
| + parallel_sweeping_ = state; |
| + } |
| + |
| + bool TryParallelSweeping() { |
| + return NoBarrier_CompareAndSwap(¶llel_sweeping_, 0, 1) == 0; |
| + } |
| + |
| // Manage live byte count (count of bytes known to be live, |
| // because they are marked black). |
| void ResetLiveBytes() { |
| @@ -533,8 +545,8 @@ class MemoryChunk { |
| static const size_t kWriteBarrierCounterOffset = |
| kSlotsBufferOffset + kPointerSize + kPointerSize; |
| - static const size_t kHeaderSize = |
| - kWriteBarrierCounterOffset + kPointerSize + kIntSize + kIntSize; |
| + static const size_t kHeaderSize = kWriteBarrierCounterOffset + kPointerSize + |
| + kIntSize + kIntSize + kPointerSize; |
| static const int kBodyOffset = |
| CODE_POINTER_ALIGN(kHeaderSize + Bitmap::kSize); |
| @@ -685,6 +697,8 @@ class MemoryChunk { |
| // count highest number of bytes ever allocated on the page. |
| int high_water_mark_; |
| + intptr_t parallel_sweeping_; |
| + |
| static MemoryChunk* Initialize(Heap* heap, |
| Address base, |
| size_t size, |
| @@ -1385,7 +1399,17 @@ class FreeListNode: public HeapObject { |
| // the end element of the linked list of free memory blocks. |
| class FreeListCategory { |
| public: |
| - FreeListCategory() : top_(NULL), end_(NULL), available_(0) {} |
| + FreeListCategory() : |
| + top_(NULL), |
| + end_(NULL), |
| + mutex_(OS::CreateMutex()), |
| + available_(0) {} |
| + |
| + ~FreeListCategory() { |
| + delete mutex_; |
| + } |
| + |
| + intptr_t Concatenate(FreeListCategory* category); |
| void Reset(); |
| @@ -1411,6 +1435,7 @@ class FreeListCategory { |
| int available() const { return available_; } |
| void set_available(int available) { available_ = available; } |
| + Mutex* mutex() { return mutex_; } |
|
Michael Starzinger
2013/01/28 16:30:18
Empty newline after the accessor.
Hannes Payer (out of office)
2013/01/30 10:11:27
Done.
|
| #ifdef DEBUG |
| intptr_t SumFreeList(); |
| int FreeListLength(); |
| @@ -1419,6 +1444,7 @@ class FreeListCategory { |
| private: |
| FreeListNode* top_; |
| FreeListNode* end_; |
| + Mutex* mutex_; |
| // Total available bytes in all blocks of this free list category. |
| int available_; |
| @@ -1452,6 +1478,8 @@ class FreeList BASE_EMBEDDED { |
| public: |
| explicit FreeList(PagedSpace* owner); |
| + intptr_t Concatenate(FreeList* free_list); |
| + |
| // Clear the free list. |
| void Reset(); |
| @@ -1499,6 +1527,11 @@ class FreeList BASE_EMBEDDED { |
| intptr_t EvictFreeListItems(Page* p); |
| + FreeListCategory* small_list() { return &small_list_; } |
| + FreeListCategory* medium_list() { return &medium_list_; } |
| + FreeListCategory* large_list() { return &large_list_; } |
| + FreeListCategory* huge_list() { return &huge_list_; } |
| + |
| private: |
| // The size range of blocks, in bytes. |
| static const int kMinBlockSize = 3 * kPointerSize; |
| @@ -1632,6 +1665,8 @@ class PagedSpace : public Space { |
| free_list_.Reset(); |
| } |
| + FreeList* free_list() { return &free_list_; } |
|
Michael Starzinger
2013/01/28 16:30:18
Remove this accessor, it is dangerous. Since the S
Hannes Payer (out of office)
2013/01/30 10:11:27
Done.
|
| + |
| // Set space allocation info. |
| void SetTop(Address top, Address limit) { |
| ASSERT(top == limit || |
| @@ -1736,6 +1771,10 @@ class PagedSpace : public Space { |
| return area_size_; |
| } |
| + void AddToAccountingStats(intptr_t bytes) { |
|
Michael Starzinger
2013/01/28 16:30:18
Same comment as for free_list() apply to this func
Hannes Payer (out of office)
2013/01/30 10:11:27
Done.
|
| + accounting_stats_.DeallocateBytes(bytes); |
| + } |
| + |
| protected: |
| int area_size_; |
| @@ -1785,6 +1824,9 @@ class PagedSpace : public Space { |
| // Slow path of AllocateRaw. This function is space-dependent. |
| MUST_USE_RESULT virtual HeapObject* SlowAllocateRaw(int size_in_bytes); |
| + |
|
Michael Starzinger
2013/01/28 16:30:18
Drop the second empty new-lined. Needs a short com
Hannes Payer (out of office)
2013/01/30 10:11:27
Done.
|
| + bool EnsureSweeperProgress(intptr_t size_in_bytes); |
| + |
| friend class PageIterator; |
| }; |