v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
context-serializer.h
Go to the documentation of this file.
1// Copyright 2016 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_CONTEXT_SERIALIZER_H_
6#define V8_SNAPSHOT_CONTEXT_SERIALIZER_H_
7
11
12namespace v8 {
13namespace internal {
14
15class StartupSerializer;
16
18 public:
20 StartupSerializer* startup_serializer,
22
23 ~ContextSerializer() override;
26
27 // Serialize the objects reachable from a single object pointer.
28 void Serialize(Tagged<Context>* o, const DisallowGarbageCollection& no_gc);
29
30 bool can_be_rehashed() const { return can_be_rehashed_; }
31
32 private:
33 void SerializeObjectImpl(Handle<HeapObject> o, SlotType slot_type) override;
34 bool ShouldBeInTheStartupObjectCache(Tagged<HeapObject> o);
35 bool ShouldBeInTheSharedObjectCache(Tagged<HeapObject> o);
36 void CheckRehashability(Tagged<HeapObject> obj);
37
38 template <typename V8Type, typename UserSerializerWrapper,
39 typename UserCallback, typename ApiObjectType>
40 void SerializeObjectWithEmbedderFields(Handle<V8Type> data_holder,
41 int embedder_fields_count,
42 UserSerializerWrapper wrapper,
43 UserCallback user_callback,
44 ApiObjectType api_obj);
45
46 // For JS API wrapper objects we serialize embedder-controled data for each
47 // object.
48 void SerializeApiWrapperFields(DirectHandle<JSObject> js_object);
49
52 // Indicates whether we only serialized hash tables that we can rehash.
53 // TODO(yangguo): generalize rehashing, and remove this flag.
56
57 // Used to store serialized data for embedder fields.
59 // Used to store serialized data for API wrappers.
61};
62
63} // namespace internal
64} // namespace v8
65
66#endif // V8_SNAPSHOT_CONTEXT_SERIALIZER_H_
ContextSerializer(const ContextSerializer &)=delete
ContextSerializer & operator=(const ContextSerializer &)=delete
SerializeEmbedderFieldsCallback serialize_embedder_fields_
StartupSerializer * startup_serializer_
TNode< Object > callback
#define V8_EXPORT_PRIVATE
Definition macros.h:460