���� JFIF �� � ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /home/real/node-v13.0.1/deps/v8/src/snapshot/ |
// Copyright 2017 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef V8_SNAPSHOT_SERIALIZER_ALLOCATOR_H_ #define V8_SNAPSHOT_SERIALIZER_ALLOCATOR_H_ #include "src/snapshot/serializer-common.h" namespace v8 { namespace internal { class Serializer; class SerializerAllocator final { public: explicit SerializerAllocator(Serializer* serializer); SerializerReference Allocate(SnapshotSpace space, uint32_t size); SerializerReference AllocateMap(); SerializerReference AllocateLargeObject(uint32_t size); SerializerReference AllocateOffHeapBackingStore(); void UseCustomChunkSize(uint32_t chunk_size); #ifdef DEBUG bool BackReferenceIsAlreadyAllocated( SerializerReference back_reference) const; #endif std::vector<SerializedData::Reservation> EncodeReservations() const; void OutputStatistics(); private: // We try to not exceed this size for every chunk. We will not succeed for // larger objects though. uint32_t TargetChunkSize(SnapshotSpace space); static constexpr int kNumberOfPreallocatedSpaces = static_cast<int>(SnapshotSpace::kNumberOfPreallocatedSpaces); static constexpr int kNumberOfSpaces = static_cast<int>(SnapshotSpace::kNumberOfSpaces); // Objects from the same space are put into chunks for bulk-allocation // when deserializing. We have to make sure that each chunk fits into a // page. So we track the chunk size in pending_chunk_ of a space, but // when it exceeds a page, we complete the current chunk and start a new one. uint32_t pending_chunk_[kNumberOfPreallocatedSpaces]; std::vector<uint32_t> completed_chunks_[kNumberOfPreallocatedSpaces]; // Number of maps that we need to allocate. uint32_t num_maps_ = 0; // We map serialized large objects to indexes for back-referencing. uint32_t large_objects_total_size_ = 0; uint32_t seen_large_objects_index_ = 0; // Used to keep track of the off-heap backing stores used by TypedArrays/ // ArrayBuffers. Note that the index begins at 1 and not 0, because when a // TypedArray has an on-heap backing store, the backing_store pointer in the // corresponding ArrayBuffer will be null, which makes it indistinguishable // from index 0. uint32_t seen_backing_stores_index_ = 1; uint32_t custom_chunk_size_ = 0; // The current serializer. Serializer* const serializer_; DISALLOW_COPY_AND_ASSIGN(SerializerAllocator); }; } // namespace internal } // namespace v8 #endif // V8_SNAPSHOT_SERIALIZER_ALLOCATOR_H_