Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1518)

Side by Side Diff: src/snapshot/partial-serializer.h

Issue 1751863002: [serializer] split up src/snapshot/serialize.* (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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/snapshot/serializer.h"
10
11 namespace v8 {
12 namespace internal {
13
14 class PartialSerializer : public Serializer {
15 public:
16 PartialSerializer(Isolate* isolate, Serializer* startup_snapshot_serializer,
17 SnapshotByteSink* sink);
18
19 ~PartialSerializer() override;
20
21 // Serialize the objects reachable from a single object pointer.
22 void Serialize(Object** o);
23
24 private:
25 class PartialCacheIndexMap : public AddressMapBase {
26 public:
27 PartialCacheIndexMap() : map_(HashMap::PointersMatch) {}
28
29 static const int kInvalidIndex = -1;
30
31 // Lookup object in the map. Return its index if found, or create
32 // a new entry with new_index as value, and return kInvalidIndex.
33 int LookupOrInsert(HeapObject* obj, int new_index) {
34 HashMap::Entry* entry = LookupEntry(&map_, obj, false);
35 if (entry != NULL) return GetValue(entry);
36 SetValue(LookupEntry(&map_, obj, true), static_cast<uint32_t>(new_index));
37 return kInvalidIndex;
38 }
39
40 private:
41 HashMap map_;
42
43 DISALLOW_COPY_AND_ASSIGN(PartialCacheIndexMap);
44 };
45
46 void SerializeObject(HeapObject* o, HowToCode how_to_code,
47 WhereToPoint where_to_point, int skip) override;
48
49 int PartialSnapshotCacheIndex(HeapObject* o);
50 bool ShouldBeInThePartialSnapshotCache(HeapObject* o);
51
52 Serializer* startup_serializer_;
53 Object* global_object_;
54 PartialCacheIndexMap partial_cache_index_map_;
55 DISALLOW_COPY_AND_ASSIGN(PartialSerializer);
56 };
57
58 } // namespace internal
59 } // namespace v8
60
61 #endif // V8_SNAPSHOT_PARTIAL_SERIALIZER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698