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

Unified Diff: src/heap/spaces.cc

Issue 1774953003: [heap] Add two tiny free list categories. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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/heap/spaces.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/spaces.cc
diff --git a/src/heap/spaces.cc b/src/heap/spaces.cc
index 6843260ee20e2fcc84c4fd19c4d17a5cff038c99..74ada3deef0c54e4206b7b1d53c7fd7a50ab6d2b 100644
--- a/src/heap/spaces.cc
+++ b/src/heap/spaces.cc
@@ -2379,8 +2379,8 @@ int FreeList::Free(Address start, int size_in_bytes) {
Page* page = Page::FromAddress(start);
- // Early return to drop too-small blocks on the floor.
- if (size_in_bytes <= kSmallListMin) {
+ // Blocks have to be a minimum size to hold free list items.
+ if (size_in_bytes < kMinBlockSize) {
page->add_wasted_memory(size_in_bytes);
wasted_bytes_ += size_in_bytes;
return size_in_bytes;
@@ -2437,7 +2437,7 @@ FreeSpace* FreeList::FindNodeFor(int size_in_bytes, int* node_size) {
if (type == kHuge) return nullptr;
// Now search the best fitting free list for a node that has at least the
- // requested size. This takes linear time in the number of elements.
+ // requested size.
type = SelectFreeListCategoryType(size_in_bytes);
node = category_[type].PickNodeFromList(size_in_bytes, node_size);
if (node != nullptr) {
@@ -2462,18 +2462,18 @@ FreeSpace* FreeList::TryRemoveMemory(intptr_t hint_size_in_bytes) {
if (node == nullptr) node = FindNodeIn(kHuge, &node_size);
if (node == nullptr) node = FindNodeIn(kLarge, &node_size);
if (node != nullptr) {
- // We round up the size to (kSmallListMin + kPointerSize) to (a) have a
+ // We round up the size to (kMinBlockSize + kPointerSize) to (a) have a
// size larger then the minimum size required for FreeSpace, and (b) to get
// a block that can actually be freed into some FreeList later on.
- if (hint_size_in_bytes <= kSmallListMin) {
- hint_size_in_bytes = kSmallListMin + kPointerSize;
+ if (hint_size_in_bytes <= kMinBlockSize) {
+ hint_size_in_bytes = kMinBlockSize + kPointerSize;
}
// Give back left overs that were not required by {size_in_bytes}.
intptr_t left_over = node_size - hint_size_in_bytes;
- // Do not bother to return anything below {kSmallListMin} as it would be
+ // Do not bother to return anything below {kMinBlockSize} as it would be
// immediately discarded anyways.
- if (left_over > kSmallListMin) {
+ if (left_over > kMinBlockSize) {
Free(node->address() + hint_size_in_bytes, static_cast<int>(left_over));
node->set_size(static_cast<int>(hint_size_in_bytes));
}
« no previous file with comments | « src/heap/spaces.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698