• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2020 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef V8_HEAP_FREE_LIST_INL_H_
6 #define V8_HEAP_FREE_LIST_INL_H_
7 
8 #include "src/heap/free-list.h"
9 #include "src/heap/spaces.h"
10 
11 namespace v8 {
12 namespace internal {
13 
is_linked(FreeList * owner)14 bool FreeListCategory::is_linked(FreeList* owner) const {
15   return prev_ != nullptr || next_ != nullptr ||
16          owner->categories_[type_] == this;
17 }
18 
UpdateCountersAfterAllocation(size_t allocation_size)19 void FreeListCategory::UpdateCountersAfterAllocation(size_t allocation_size) {
20   available_ -= allocation_size;
21 }
22 
GetPageForCategoryType(FreeListCategoryType type)23 Page* FreeList::GetPageForCategoryType(FreeListCategoryType type) {
24   FreeListCategory* category_top = top(type);
25   if (category_top != nullptr) {
26     DCHECK(!category_top->top().is_null());
27     return Page::FromHeapObject(category_top->top());
28   } else {
29     return nullptr;
30   }
31 }
32 
33 }  // namespace internal
34 }  // namespace v8
35 
36 #endif  // V8_HEAP_FREE_LIST_INL_H_
37