36 switch (
static_cast<Bytecode>(bytecode_as_int)) {
37 case Bytecode::kAllocatePage:
40 case Bytecode::kAllocatePageAt:
43 case Bytecode::kSegment:
46 case Bytecode::kRelocateSegment:
48 case Bytecode::kReadOnlyRootsTable:
51 case Bytecode::kFinalizeReadOnlySpace:
61 size_t actual_page_index =
static_cast<size_t>(-1);
64#ifdef V8_COMPRESS_POINTERS
74 CHECK_EQ(actual_page_index, expected_page_index);
90 uint8_t relocate_marker_bytecode =
source_->
Get();
91 CHECK_EQ(relocate_marker_bytecode, Bytecode::kRelocateSegment);
92 int tagged_slots_size_in_bits = size_in_bytes /
kTaggedSize;
154 :
Deserializer(isolate, data->Payload(), data->GetMagicNumber(), false,
161 isolate()->counters()->snapshot_deserialize_rospace());
173 roots.VerifyNameForProtectors();
185 const double ms = timer.Elapsed().InMillisecondsF();
186 PrintF(
"[Deserializing read-only space (%d bytes) took %0.3f ms]\n", bytes,
195 FATAL(
"No external references provided via API");
204#ifdef V8_ENABLE_SANDBOX
205 std::vector<ReadOnlyArtifacts::ExternalPointerRegistryEntry> registry;
206 registry.reserve(external_pointer_slots_.size());
207 for (
auto& slot : external_pointer_slots_) {
208 registry.emplace_back(slot.Relaxed_LoadHandle(), slot.load(
isolate_),
213 std::move(registry));
216#define POST_PROCESS_TYPE_LIST(V) \
219 V(JSExternalObject) \
220 V(FunctionTemplateInfo) \
222 V(SharedFunctionInfo)
228 if (InstanceTypeChecker::Is##TYPE(instance_type)) { \
229 return PostProcess##TYPE(Cast<TYPE>(o)); \
235#undef POST_PROCESS_TYPE_LIST
239 if (is_api_reference) {
240 const intptr_t* refs =
isolate_->api_external_references();
266#ifdef V8_ENABLE_SANDBOX
272 external_pointer_slots_.emplace_back(slot);
291#ifdef V8_ENABLE_SANDBOX
297 external_pointer_slots_.emplace_back(slot);
303 o, o->RawExternalPointerField(AccessorInfo::kSetterOffset,
306 AccessorInfo::kMaybeRedirectedGetterOffset,
311 const bool is_named = o->is_named();
313#define PROCESS_FIELD(Name, name) \
314 DecodeLazilyInitializedExternalPointerSlot( \
315 o, o->RawExternalPointerField( \
316 InterceptorInfo::k##Name##Offset, \
317 is_named ? kApiNamedProperty##Name##CallbackTag \
318 : kApiIndexedProperty##Name##CallbackTag));
325 o, o->RawExternalPointerField(JSExternalObject::kValueOffset,
330 o, o->RawExternalPointerField(
331 FunctionTemplateInfo::kMaybeRedirectedCallbackOffset,
336 o->init_self_indirect_pointer(
isolate_);
337 o->wrapper()->set_code(o);
341 DCHECK(!o->has_instruction_stream());
342 o->SetInstructionStartForOffHeapBuiltin(
354#ifdef V8_ENABLE_SANDBOX
355 std::vector<ExternalPointerSlot> external_pointer_slots_;
365#ifdef V8_COMPRESS_POINTERS
366 ExternalPointerTable::UnsealReadOnlySegmentScope unseal_scope(
367 &
isolate()->external_pointer_table());
372 const InstanceType instance_type = o->map(cage_base)->instance_type();
374 if (InstanceTypeChecker::IsString(instance_type)) {
378 }
else if (o->NeedsRehashing(instance_type)) {
#define INTERCEPTOR_INFO_CALLBACK_LIST(V)
SnapshotByteSource * source()
bool should_rehash() const
void PushObjectToRehash(DirectHandle< HeapObject > object)
Isolate * isolate() const
static EmbeddedData FromBlob()
void init(IsolateForSandbox isolate, Tagged< HeapObject > host, Address value, ExternalPointerTag tag)
void init_lazily_initialized()
uint32_t GetContentAsIndexAfterDeserialization(const DisallowGarbageCollection &no_gc)
ExternalPointerTag exact_tag() const
bool ExactTagIsKnown() const
Address address(uint32_t i) const
void InitializeHashSeed()
ReadOnlyHeap * read_only_heap() const
ReadOnlyArtifacts * read_only_artifacts() const
ExternalReferenceTable * external_reference_table_unsafe()
Address cage_base() const
uint32_t GetAndIncNextUniqueSfiId()
static constexpr int kEmptyHashField
void PostProcessFunctionTemplateInfo(Tagged< FunctionTemplateInfo > o)
void PostProcessJSExternalObject(Tagged< JSExternalObject > o)
ObjectPostProcessor(Isolate *isolate)
const EmbeddedData embedded_data_
void PostProcessCode(Tagged< Code > o)
void PostProcessAccessorInfo(Tagged< AccessorInfo > o)
void PostProcessInterceptorInfo(Tagged< InterceptorInfo > o)
void PostProcessSharedFunctionInfo(Tagged< SharedFunctionInfo > o)
Address GetAnyExternalReferenceAt(int index, bool is_api_reference) const
void DecodeLazilyInitializedExternalPointerSlot(Tagged< HeapObject > host, ExternalPointerSlot slot)
void DecodeExternalPointerSlot(Tagged< HeapObject > host, ExternalPointerSlot slot)
V8_INLINE void PostProcessIfNeeded(Tagged< HeapObject > o, InstanceType instance_type)
void set_external_pointer_registry(std::vector< ExternalPointerRegistryEntry > &®istry)
ReadOnlyDeserializer(Isolate *isolate, const SnapshotData *data, bool can_rehash)
void PostProcessNewObjects()
void DeserializeIntoIsolate()
void DecodeTaggedSlots(Address segment_start, const ro::BitSet &tagged_slots)
Address Decode(ro::EncodedTagged encoded) const
ReadOnlyHeapImageDeserializer(Isolate *isolate, SnapshotByteSource *source)
SnapshotByteSource *const source_
void DeserializeSegment()
ReadOnlyPageMetadata * PageAt(size_t index) const
ReadOnlySpace * ro_space() const
void AllocatePage(bool fixed_offset)
void DeserializeReadOnlyRootsTable()
static void Deserialize(Isolate *isolate, SnapshotByteSource *source)
ReadOnlySpace * read_only_space() const
void InitFromStaticRootsTable(Address cage_base)
Address * read_only_roots_
static constexpr size_t kEntriesCount
V8_INLINE void VerifyNameForProtectorsPages() const
void RepairFreeSpacesAfterDeserialization()
size_t AllocateNextPageAt(Address pos)
void InitializePageForDeserialization(ReadOnlyPageMetadata *page, size_t area_size_in_bytes)
const std::vector< ReadOnlyPageMetadata * > & pages() const
size_t AllocateNextPage()
void FinalizeSpaceForDeserialization()
const uint8_t * data() const
void CopyRaw(void *to, int number_of_bytes)
V8_INLINE constexpr bool is_null() const
static V8_INLINE Tagged_t CompressObject(Address tagged)
#define COMPRESS_POINTERS_BOOL
#define USE_SIMULATOR_BOOL
static constexpr int kNumberOfBytecodes
constexpr int kTaggedSize
void PrintF(const char *format,...)
V8_INLINE DirectHandle< T > direct_handle(Tagged< T > object, Isolate *isolate)
void NoExternalReferencesCallback()
@ kExternalObjectValueTag
@ kFunctionTemplateInfoCallbackTag
V8_EXPORT_PRIVATE FlagValues v8_flags
too high values may cause the compiler to set high thresholds for inlining to as much as possible avoid inlined allocation of objects that cannot escape trace load stores from virtual maglev objects use TurboFan fast string builder analyze liveness of environment slots and zap dead values trace TurboFan load elimination emit data about basic block usage in builtins to this enable builtin reordering when run mksnapshot flag for emit warnings when applying builtin profile data verify register allocation in TurboFan randomly schedule instructions to stress dependency tracking enable store store elimination in TurboFan rewrite far to near simulate GC compiler thread race related to allow float parameters to be passed in simulator mode JS Wasm Run additional turbo_optimize_inlined_js_wasm_wrappers enable experimental feedback collection in generic lowering enable Turboshaft s WasmLoadElimination enable Turboshaft s low level load elimination for JS enable Turboshaft s escape analysis for string concatenation use enable Turbolev features that we want to ship in the not too far future trace individual Turboshaft reduction steps trace intermediate Turboshaft reduction steps invocation count threshold for early optimization Enables optimizations which favor memory size over execution speed Enables sampling allocation profiler with X as a sample interval min size of a semi the new space consists of two semi spaces max size of the Collect garbage after Collect garbage after keeps maps alive for< n > old space garbage collections print one detailed trace line in allocation gc speed threshold for starting incremental marking via a task in percent of available threshold for starting incremental marking immediately in percent of available Use a single schedule for determining a marking schedule between JS and C objects schedules the minor GC task with kUserVisible priority max worker number of concurrent for NumberOfWorkerThreads start background threads that allocate memory concurrent_array_buffer_sweeping use parallel threads to clear weak refs in the atomic pause trace progress of the incremental marking trace object counts and memory usage report a tick only when allocated zone memory changes by this amount TracingFlags::gc_stats TracingFlags::gc_stats track native contexts that are expected to be garbage collected verify heap pointers before and after GC memory reducer runs GC with ReduceMemoryFootprint flag Maximum number of memory reducer GCs scheduled Old gen GC speed is computed directly from gc tracer counters Perform compaction on full GCs based on V8 s default heuristics Perform compaction on every full GC Perform code space compaction when finalizing a full GC with stack Stress GC compaction to flush out bugs with moving objects flush of baseline code when it has not been executed recently Use time base code flushing instead of age Use a progress bar to scan large objects in increments when incremental marking is active force incremental marking for small heaps and run it more often force marking at random points between and force scavenge at random points between and reclaim otherwise unreachable unmodified wrapper objects when possible less compaction in non memory reducing mode use high priority threads for concurrent Marking Test mode only flag It allows an unit test to select evacuation candidates pages(requires --stress_compaction).") DEFINE_BOOL(cppheap_incremental_marking
static constexpr Address kNullAddress
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
#define PROCESS_FIELD(Name, name)
#define POST_PROCESS_TYPE_LIST(V)
const Address segment_start
#define CHECK_LE(lhs, rhs)
#define DCHECK_NE(v1, v2)
#define CHECK_EQ(lhs, rhs)
#define DCHECK(condition)
#define DCHECK_LT(v1, v2)
#define DCHECK_EQ(v1, v2)
static EncodedExternalReference FromUint32(uint32_t v)
const unsigned int page_index
static EncodedTagged FromUint32(uint32_t v)
const unsigned int offset
static EncodedTagged FromAddress(Address address)
#define V8_STATIC_ROOTS_BOOL
#define V8_UNLIKELY(condition)