Index: runtime/vm/freelist.cc |
diff --git a/runtime/vm/freelist.cc b/runtime/vm/freelist.cc |
index 221a5ea4bf9bc475ab1a1d4c3446ac1cacd89b7f..61435807ccccb25815475b9766a3ac8555ab7a64 100644 |
--- a/runtime/vm/freelist.cc |
+++ b/runtime/vm/freelist.cc |
@@ -13,7 +13,6 @@ |
namespace dart { |
- |
FreeListElement* FreeListElement::AsElement(uword addr, intptr_t size) { |
// Precondition: the (page containing the) header of the element is |
// writable. |
@@ -43,37 +42,31 @@ FreeListElement* FreeListElement::AsElement(uword addr, intptr_t size) { |
// writable. |
} |
- |
void FreeListElement::InitOnce() { |
ASSERT(sizeof(FreeListElement) == kObjectAlignment); |
ASSERT(OFFSET_OF(FreeListElement, tags_) == Object::tags_offset()); |
} |
- |
intptr_t FreeListElement::HeaderSizeFor(intptr_t size) { |
if (size == 0) return 0; |
return ((size > RawObject::SizeTag::kMaxSizeTag) ? 3 : 2) * kWordSize; |
} |
- |
FreeList::FreeList() |
: mutex_(new Mutex()), |
freelist_search_budget_(kInitialFreeListSearchBudget) { |
Reset(); |
} |
- |
FreeList::~FreeList() { |
delete mutex_; |
} |
- |
uword FreeList::TryAllocate(intptr_t size, bool is_protected) { |
MutexLocker ml(mutex_); |
return TryAllocateLocked(size, is_protected); |
} |
- |
uword FreeList::TryAllocateLocked(intptr_t size, bool is_protected) { |
DEBUG_ASSERT(mutex_->IsOwnedByCurrentThread()); |
// Precondition: is_protected is false or else all free list elements are |
@@ -189,13 +182,11 @@ uword FreeList::TryAllocateLocked(intptr_t size, bool is_protected) { |
return 0; |
} |
- |
void FreeList::Free(uword addr, intptr_t size) { |
MutexLocker ml(mutex_); |
FreeLocked(addr, size); |
} |
- |
void FreeList::FreeLocked(uword addr, intptr_t size) { |
DEBUG_ASSERT(mutex_->IsOwnedByCurrentThread()); |
// Precondition required by AsElement and EnqueueElement: the (page |
@@ -209,7 +200,6 @@ void FreeList::FreeLocked(uword addr, intptr_t size) { |
// Postcondition: the (page containing the) header is left writable. |
} |
- |
void FreeList::Reset() { |
MutexLocker ml(mutex_); |
free_map_.Reset(); |
@@ -219,7 +209,6 @@ void FreeList::Reset() { |
} |
} |
- |
intptr_t FreeList::IndexForSize(intptr_t size) { |
ASSERT(size >= kObjectAlignment); |
ASSERT(Utils::IsAligned(size, kObjectAlignment)); |
@@ -231,7 +220,6 @@ intptr_t FreeList::IndexForSize(intptr_t size) { |
return index; |
} |
- |
void FreeList::EnqueueElement(FreeListElement* element, intptr_t index) { |
FreeListElement* next = free_lists_[index]; |
if (next == NULL && index != kNumLists) { |
@@ -243,7 +231,6 @@ void FreeList::EnqueueElement(FreeListElement* element, intptr_t index) { |
free_lists_[index] = element; |
} |
- |
FreeListElement* FreeList::DequeueElement(intptr_t index) { |
FreeListElement* result = free_lists_[index]; |
FreeListElement* next = result->next(); |
@@ -261,7 +248,6 @@ FreeListElement* FreeList::DequeueElement(intptr_t index) { |
return result; |
} |
- |
intptr_t FreeList::LengthLocked(int index) const { |
DEBUG_ASSERT(mutex_->IsOwnedByCurrentThread()); |
ASSERT(index >= 0); |
@@ -275,7 +261,6 @@ intptr_t FreeList::LengthLocked(int index) const { |
return result; |
} |
- |
void FreeList::PrintSmall() const { |
int small_sizes = 0; |
int small_objects = 0; |
@@ -298,7 +283,6 @@ void FreeList::PrintSmall() const { |
} |
} |
- |
class IntptrPair { |
public: |
IntptrPair() : first_(-1), second_(-1) {} |
@@ -322,7 +306,6 @@ class IntptrPair { |
intptr_t second_; |
}; |
- |
void FreeList::PrintLarge() const { |
int large_sizes = 0; |
int large_objects = 0; |
@@ -357,14 +340,12 @@ void FreeList::PrintLarge() const { |
} |
} |
- |
void FreeList::Print() const { |
MutexLocker ml(mutex_); |
PrintSmall(); |
PrintLarge(); |
} |
- |
void FreeList::SplitElementAfterAndEnqueue(FreeListElement* element, |
intptr_t size, |
bool is_protected) { |
@@ -392,13 +373,11 @@ void FreeList::SplitElementAfterAndEnqueue(FreeListElement* element, |
} |
} |
- |
FreeListElement* FreeList::TryAllocateLarge(intptr_t minimum_size) { |
MutexLocker ml(mutex_); |
return TryAllocateLargeLocked(minimum_size); |
} |
- |
FreeListElement* FreeList::TryAllocateLargeLocked(intptr_t minimum_size) { |
DEBUG_ASSERT(mutex_->IsOwnedByCurrentThread()); |
FreeListElement* previous = NULL; |
@@ -428,7 +407,6 @@ FreeListElement* FreeList::TryAllocateLargeLocked(intptr_t minimum_size) { |
return NULL; |
} |
- |
uword FreeList::TryAllocateSmallLocked(intptr_t size) { |
DEBUG_ASSERT(mutex_->IsOwnedByCurrentThread()); |
if (size > last_free_small_size_) { |