5 #ifndef V8_SNAPSHOT_DESERIALIZER_ALLOCATOR_H_ 6 #define V8_SNAPSHOT_DESERIALIZER_ALLOCATOR_H_ 8 #include "src/globals.h" 9 #include "src/heap/heap.h" 10 #include "src/snapshot/serializer-common.h" 16 class StartupDeserializer;
25 Address Allocate(AllocationSpace space,
int size);
27 void MoveToNextChunk(AllocationSpace space);
28 void SetAlignment(AllocationAlignment alignment) {
29 DCHECK_EQ(kWordAligned, next_alignment_);
30 DCHECK_LE(kWordAligned, alignment);
31 DCHECK_LE(alignment, kDoubleUnaligned);
32 next_alignment_ =
static_cast<AllocationAlignment
>(alignment);
35 void set_next_reference_is_weak(
bool next_reference_is_weak) {
36 next_reference_is_weak_ = next_reference_is_weak;
39 bool GetAndClearNextReferenceIsWeak() {
40 bool saved = next_reference_is_weak_;
41 next_reference_is_weak_ =
false;
46 bool next_reference_is_weak()
const {
return next_reference_is_weak_; }
57 void DecodeReservation(
const std::vector<SerializedData::Reservation>& res);
60 bool ReservationsAreFullyUsed()
const;
64 void RegisterDeserializedObjectsForBlackAllocation();
70 Address AllocateRaw(AllocationSpace space,
int size);
73 static constexpr
int kNumberOfPreallocatedSpaces =
74 SerializerDeserializer::kNumberOfPreallocatedSpaces;
75 static constexpr
int kNumberOfSpaces =
76 SerializerDeserializer::kNumberOfSpaces;
82 Heap::Reservation reservations_[kNumberOfSpaces];
83 uint32_t current_chunk_[kNumberOfPreallocatedSpaces];
84 Address high_water_[kNumberOfPreallocatedSpaces];
87 AllocationAlignment next_alignment_ = kWordAligned;
88 bool next_reference_is_weak_ =
false;
93 std::vector<Address> allocated_maps_;
97 std::vector<HeapObject*> deserialized_large_objects_;
108 #endif // V8_SNAPSHOT_DESERIALIZER_ALLOCATOR_H_