Index: src/spaces.h |
diff --git a/src/spaces.h b/src/spaces.h |
index 4fbabd6349d43364e9fe387c3ad0352e6ed42462..a3c0d9acfa94bc2e227cdb17af69955135aa872b 100644 |
--- a/src/spaces.h |
+++ b/src/spaces.h |
@@ -1375,6 +1375,12 @@ class FreeListNode: public HeapObject { |
}; |
+struct FreeListCategorie { |
Michael Starzinger
2012/11/27 13:51:53
This should be a proper class with the helper func
Hannes Payer (out of office)
2012/11/29 13:17:42
Done. I refactored the whole free list implementat
|
+ FreeListNode* top; |
+ FreeListNode* end; |
+}; |
+ |
+ |
// The free list for the old space. The free list is organized in such a way |
// as to encourage objects allocated around the same time to be near each |
// other. The normal way to allocate is intended to be by bumping a 'top' |
@@ -1405,6 +1411,27 @@ class FreeList BASE_EMBEDDED { |
// Clear the free list. |
void Reset(); |
+ void Reset(struct FreeListCategorie *categorie); |
Michael Starzinger
2012/11/27 13:51:53
Move all of these helper functions into FreeListCa
Hannes Payer (out of office)
2012/11/29 13:17:42
Done.
|
+ |
+ // ConcurrentGetList is just safe to call when there is just one producer |
+ // thread which only adds elements to the free list. ABA problem can be |
+ // ignored in the given setup. |
+ void ConcurrentGetList(struct FreeListCategorie *categorie, |
+ FreeListNode** top, |
+ FreeListNode** end); |
+ |
+ void ConcurrentAddList(struct FreeListCategorie *categorie, |
+ FreeListNode* top, |
+ FreeListNode* end); |
+ |
+ void GetList(struct FreeListCategorie *categorie, |
+ FreeListNode** top, |
+ FreeListNode** end); |
+ |
+ void AddList(struct FreeListCategorie *categorie, |
+ FreeListNode* top, |
+ FreeListNode* end); |
+ |
// Return the number of bytes available on the free list. |
intptr_t available() { return available_; } |
@@ -1424,8 +1451,8 @@ class FreeList BASE_EMBEDDED { |
#ifdef DEBUG |
void Zap(); |
- static intptr_t SumFreeList(FreeListNode* node); |
- static int FreeListLength(FreeListNode* cur); |
+ static intptr_t SumFreeList(FreeListCategorie* categorie); |
+ static int FreeListLength(FreeListCategorie* categorie); |
intptr_t SumFreeLists(); |
bool IsVeryLong(); |
#endif |
@@ -1453,7 +1480,8 @@ class FreeList BASE_EMBEDDED { |
static const int kMinBlockSize = 3 * kPointerSize; |
static const int kMaxBlockSize = Page::kMaxNonCodeHeapObjectSize; |
- FreeListNode* PickNodeFromList(FreeListNode** list, int* node_size); |
+ FreeListNode* PickNodeFromList(FreeListCategorie* categorie, |
+ int* node_size); |
FreeListNode* FindNodeFor(int size_in_bytes, int* node_size); |
@@ -1470,10 +1498,10 @@ class FreeList BASE_EMBEDDED { |
static const int kSmallAllocationMax = kSmallListMin - kPointerSize; |
static const int kMediumAllocationMax = kSmallListMax; |
static const int kLargeAllocationMax = kMediumListMax; |
- FreeListNode* small_list_; |
- FreeListNode* medium_list_; |
- FreeListNode* large_list_; |
- FreeListNode* huge_list_; |
+ struct FreeListCategorie small_list_; |
+ struct FreeListCategorie medium_list_; |
+ struct FreeListCategorie large_list_; |
+ struct FreeListCategorie huge_list_; |
DISALLOW_IMPLICIT_CONSTRUCTORS(FreeList); |
}; |