v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
evacuation-allocator.h
Go to the documentation of this file.
1// Copyright 2017 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_EVACUATION_ALLOCATOR_H_
6#define V8_HEAP_EVACUATION_ALLOCATOR_H_
7
8#include <optional>
9
10#include "src/common/globals.h"
11#include "src/heap/heap.h"
12#include "src/heap/new-spaces.h"
14#include "src/heap/spaces.h"
15
16namespace v8 {
17namespace internal {
18
19// Allocator encapsulating thread-local allocation durning collection. Assumes
20// that all other allocations also go through EvacuationAllocator.
22 public:
23 EvacuationAllocator(Heap* heap, CompactionSpaceKind compaction_space_kind);
24
25 // Needs to be called from the main thread to finalize this
26 // EvacuationAllocator.
27 void Finalize();
28
29 inline AllocationResult Allocate(AllocationSpace space, int object_size,
30 AllocationAlignment alignment);
32 int object_size);
33
34 private:
36 Tagged<HeapObject> object, int object_size);
37
49
50 Heap* const heap_;
53 std::optional<MainAllocator> new_space_allocator_;
54 std::optional<MainAllocator> old_space_allocator_;
55 std::optional<MainAllocator> code_space_allocator_;
56 std::optional<MainAllocator> shared_space_allocator_;
57 std::optional<MainAllocator> trusted_space_allocator_;
58};
59
60} // namespace internal
61} // namespace v8
62
63#endif // V8_HEAP_EVACUATION_ALLOCATOR_H_
std::optional< MainAllocator > trusted_space_allocator_
void FreeLastInMainAllocator(MainAllocator *allocator, Tagged< HeapObject > object, int object_size)
std::optional< MainAllocator > shared_space_allocator_
EvacuationAllocator(Heap *heap, CompactionSpaceKind compaction_space_kind)
std::optional< MainAllocator > old_space_allocator_
CompactionSpaceCollection compaction_spaces_
std::optional< MainAllocator > code_space_allocator_
void FreeLast(AllocationSpace space, Tagged< HeapObject > object, int object_size)
AllocationResult Allocate(AllocationSpace space, int object_size, AllocationAlignment alignment)
std::optional< MainAllocator > new_space_allocator_