Commit 8d866e6e authored by ulan's avatar ulan Committed by Commit bot

FreeList::FindNodeFor should not account for node size twice.

This fixes available_in_free_list counter.

BUG=

Review URL: https://codereview.chromium.org/1840083002

Cr-Commit-Position: refs/heads/master@{#35111}
parent 6aa4cc4b
...@@ -2327,7 +2327,6 @@ FreeSpace* FreeList::SearchForNodeInList(FreeListCategoryType type, ...@@ -2327,7 +2327,6 @@ FreeSpace* FreeList::SearchForNodeInList(FreeListCategoryType type,
FreeSpace* FreeList::FindNodeFor(int size_in_bytes, int* node_size) { FreeSpace* FreeList::FindNodeFor(int size_in_bytes, int* node_size) {
FreeSpace* node = nullptr; FreeSpace* node = nullptr;
Page* page = nullptr;
// First try the allocation fast path: try to allocate the minimum element // First try the allocation fast path: try to allocate the minimum element
// size of a free list category. This operation is constant time. // size of a free list category. This operation is constant time.
...@@ -2354,11 +2353,6 @@ FreeSpace* FreeList::FindNodeFor(int size_in_bytes, int* node_size) { ...@@ -2354,11 +2353,6 @@ FreeSpace* FreeList::FindNodeFor(int size_in_bytes, int* node_size) {
// requested size. // requested size.
type = SelectFreeListCategoryType(size_in_bytes); type = SelectFreeListCategoryType(size_in_bytes);
node = TryFindNodeIn(type, node_size, size_in_bytes); node = TryFindNodeIn(type, node_size, size_in_bytes);
if (node != nullptr) {
DCHECK(size_in_bytes <= *node_size);
page = Page::FromAddress(node->address());
page->add_available_in_free_list(-(*node_size));
}
DCHECK(IsVeryLong() || Available() == SumFreeLists()); DCHECK(IsVeryLong() || Available() == SumFreeLists());
return node; return node;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment