[heap] Remove FreeList::FindNodeIn

This function was functionnaly equivalent to FreeList::TryFindNodeIn.

They probably were different when FindNodeIn was iterating through
the empty FreeListCategories, but since CL 1648476, FreeListCategories
in the FreeList can't be empty, and there was therefore never more than
a single iteration of FindNodeIn's while loop.

Bug: v8:9329
Change-Id: Ief7275ef55edb46b8bb35bce0783fbfd28534925
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1660615
Commit-Queue: Darius Mercadier <dmercadier@google.com>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Hannes Payer <hpayer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62233}
This commit is contained in:
Darius Mercadier 2019-06-14 17:42:43 +02:00 committed by Commit Bot
parent 16893bda75
commit c849d9cd4f
2 changed files with 3 additions and 25 deletions

View File

@ -3040,23 +3040,6 @@ size_t FreeList::Free(Address start, size_t size_in_bytes, FreeMode mode) {
return 0;
}
FreeSpace FreeList::FindNodeIn(FreeListCategoryType type, size_t minimum_size,
size_t* node_size) {
FreeListCategoryIterator it(this, type);
FreeSpace node;
while (it.HasNext()) {
FreeListCategory* current = it.Next();
node = current->PickNodeFromList(minimum_size, node_size);
if (!node.is_null()) {
DCHECK(IsVeryLong() || Available() == SumFreeLists());
if (current->is_empty()) {
RemoveCategory(current);
}
return node;
}
}
return node;
}
FreeSpace FreeList::TryFindNodeIn(FreeListCategoryType type,
size_t minimum_size, size_t* node_size) {
@ -3099,8 +3082,8 @@ FreeSpace FreeList::Allocate(size_t size_in_bytes, size_t* node_size) {
FreeListCategoryType type =
SelectFastAllocationFreeListCategoryType(size_in_bytes);
for (int i = type; i < kHuge && node.is_null(); i++) {
node = FindNodeIn(static_cast<FreeListCategoryType>(i), size_in_bytes,
node_size);
node = TryFindNodeIn(static_cast<FreeListCategoryType>(i), size_in_bytes,
node_size);
}
if (node.is_null()) {
@ -3116,7 +3099,7 @@ FreeSpace FreeList::Allocate(size_t size_in_bytes, size_t* node_size) {
if (type == kTiniest) {
// For this tiniest object, the tiny list hasn't been searched yet.
// Now searching the tiny list.
node = FindNodeIn(kTiny, size_in_bytes, node_size);
node = TryFindNodeIn(kTiny, size_in_bytes, node_size);
}
if (node.is_null()) {

View File

@ -1954,11 +1954,6 @@ class FreeList {
static const size_t kMediumAllocationMax = kSmallListMax;
static const size_t kLargeAllocationMax = kMediumListMax;
// Walks all available categories for a given |type| and tries to retrieve
// a node. Returns nullptr if the category is empty.
FreeSpace FindNodeIn(FreeListCategoryType type, size_t minimum_size,
size_t* node_size);
// Tries to retrieve a node from the first category in a given |type|.
// Returns nullptr if the category is empty or the top entry is smaller
// than minimum_size.