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
9
10namespace v8 {
11namespace internal {
12
13class 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.
20 public:
22 ~SharedHeapSerializer() override;
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,
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
52#endif
53};
54
55} // namespace internal
56} // namespace v8
57
58#endif // V8_SNAPSHOT_SHARED_HEAP_SERIALIZER_H_
SharedHeapSerializer & operator=(const SharedHeapSerializer &)=delete
SharedHeapSerializer(const SharedHeapSerializer &)=delete
#define V8_EXPORT_PRIVATE
Definition macros.h:460