v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
shared-heap-serializer.h
Go to the documentation of this file.
1
// Copyright 2021 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_SNAPSHOT_SHARED_HEAP_SERIALIZER_H_
6
#define V8_SNAPSHOT_SHARED_HEAP_SERIALIZER_H_
7
8
#include "
src/snapshot/roots-serializer.h
"
9
10
namespace
v8
{
11
namespace
internal
{
12
13
class
HeapObject;
14
15
// SharedHeapSerializer serializes objects that should be in the shared heap in
16
// the shared Isolate during startup. Currently the shared heap is only in use
17
// behind flags (e.g. --shared-string-table). When it is not in use, its
18
// contents are deserialized into each Isolate.
19
class
V8_EXPORT_PRIVATE
SharedHeapSerializer
:
public
RootsSerializer
{
20
public
:
21
SharedHeapSerializer
(
Isolate
* isolate,
Snapshot::SerializerFlags
flags);
22
~SharedHeapSerializer
()
override
;
23
SharedHeapSerializer
(
const
SharedHeapSerializer
&) =
delete
;
24
SharedHeapSerializer
&
operator=
(
const
SharedHeapSerializer
&) =
delete
;
25
26
// Terminate the shared heap object cache with an undefined value and
27
// serialize the string table..
28
void
FinalizeSerialization();
29
30
// If |obj| can be serialized in the shared heap snapshot then add it to the
31
// shared heap object cache if not already present and emit a
32
// SharedHeapObjectCache bytecode into |sink|. Returns whether this was
33
// successful.
34
bool
SerializeUsingSharedHeapObjectCache(
SnapshotByteSink
* sink,
35
Handle<HeapObject>
obj);
36
37
static
bool
CanBeInSharedOldSpace(
Tagged<HeapObject>
obj);
38
39
static
bool
ShouldBeInSharedHeapObjectCache(
Tagged<HeapObject>
obj);
40
41
private
:
42
bool
ShouldReconstructSharedHeapObjectCacheForTesting()
const
;
43
44
void
ReconstructSharedHeapObjectCacheForTesting();
45
46
void
SerializeStringTable(
StringTable
* string_table);
47
48
void
SerializeObjectImpl(
Handle<HeapObject>
obj,
SlotType
slot_type)
override
;
49
50
#ifdef DEBUG
51
IdentityMap<int, base::DefaultAllocationPolicy>
serialized_objects_;
52
#endif
53
};
54
55
}
// namespace internal
56
}
// namespace v8
57
58
#endif
// V8_SNAPSHOT_SHARED_HEAP_SERIALIZER_H_
v8::base::Flags
Definition
flags.h:25
v8::internal::Handle
Definition
handles.h:149
v8::internal::IdentityMap
Definition
identity-map.h:116
v8::internal::Isolate
Definition
isolate.h:586
v8::internal::RootsSerializer
Definition
roots-serializer.h:23
v8::internal::SharedHeapSerializer
Definition
shared-heap-serializer.h:19
v8::internal::SharedHeapSerializer::operator=
SharedHeapSerializer & operator=(const SharedHeapSerializer &)=delete
v8::internal::SharedHeapSerializer::SharedHeapSerializer
SharedHeapSerializer(const SharedHeapSerializer &)=delete
v8::internal::SnapshotByteSink
Definition
snapshot-source-sink.h:128
v8::internal::StringTable
Definition
string-table.h:48
v8::internal::Tagged
Definition
waiter-queue-node.h:21
v8::internal::internal
internal
Definition
wasm-objects-inl.h:458
v8::internal::SlotType
SlotType
Definition
slot-set.h:232
v8
Definition
api-arguments-inl.h:19
roots-serializer.h
V8_EXPORT_PRIVATE
#define V8_EXPORT_PRIVATE
Definition
macros.h:460
src
snapshot
shared-heap-serializer.h
Generated on Sun Apr 6 2025 21:08:57 for v8 by
1.12.0