V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
partial-serializer.h
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_PARTIAL_SERIALIZER_H_
6 #define V8_SNAPSHOT_PARTIAL_SERIALIZER_H_
7 
8 #include "src/address-map.h"
9 #include "src/contexts.h"
10 #include "src/snapshot/serializer.h"
11 
12 namespace v8 {
13 namespace internal {
14 
15 class StartupSerializer;
16 
17 class PartialSerializer : public Serializer {
18  public:
19  PartialSerializer(Isolate* isolate, StartupSerializer* startup_serializer,
20  v8::SerializeEmbedderFieldsCallback callback);
21 
22  ~PartialSerializer() override;
23 
24  // Serialize the objects reachable from a single object pointer.
25  void Serialize(Context* o, bool include_global_proxy);
26 
27  bool can_be_rehashed() const { return can_be_rehashed_; }
28 
29  private:
30  void SerializeObject(HeapObject* o, HowToCode how_to_code,
31  WhereToPoint where_to_point, int skip) override;
32 
33  bool ShouldBeInThePartialSnapshotCache(HeapObject* o);
34 
35  bool SerializeJSObjectWithEmbedderFields(Object* obj, HowToCode how_to_code,
36  WhereToPoint where_to_point);
37 
38  void CheckRehashability(HeapObject* obj);
39 
40  StartupSerializer* startup_serializer_;
41  v8::SerializeEmbedderFieldsCallback serialize_embedder_fields_;
42  // Indicates whether we only serialized hash tables that we can rehash.
43  // TODO(yangguo): generalize rehashing, and remove this flag.
44  bool can_be_rehashed_;
45  Context context_;
46 
47  // Used to store serialized data for embedder fields.
48  SnapshotByteSink embedder_fields_sink_;
49  DISALLOW_COPY_AND_ASSIGN(PartialSerializer);
50 };
51 
52 } // namespace internal
53 } // namespace v8
54 
55 #endif // V8_SNAPSHOT_PARTIAL_SERIALIZER_H_
Definition: libplatform.h:13