| Index: src/snapshot/startup-serializer.h
|
| diff --git a/src/snapshot/startup-serializer.h b/src/snapshot/startup-serializer.h
|
| index cf40e8dc4c8845802fb0c6899524a008c337530e..cc66f71ae9e3260660a2196b89ef527b6f2222f2 100644
|
| --- a/src/snapshot/startup-serializer.h
|
| +++ b/src/snapshot/startup-serializer.h
|
| @@ -27,7 +27,34 @@ class StartupSerializer : public Serializer {
|
| void SerializeStrongReferences();
|
| void SerializeWeakReferencesAndDeferred();
|
|
|
| + int PartialSnapshotCacheIndex(HeapObject* o);
|
| +
|
| private:
|
| + class PartialCacheIndexMap : public AddressMapBase {
|
| + public:
|
| + PartialCacheIndexMap()
|
| + : map_(base::HashMap::PointersMatch), next_index_(0) {}
|
| +
|
| + // Lookup object in the map. Return its index if found, or create
|
| + // a new entry with new_index as value, and return kInvalidIndex.
|
| + bool LookupOrInsert(HeapObject* obj, int* index_out) {
|
| + base::HashMap::Entry* entry = LookupEntry(&map_, obj, false);
|
| + if (entry != NULL) {
|
| + *index_out = GetValue(entry);
|
| + return true;
|
| + }
|
| + *index_out = next_index_;
|
| + SetValue(LookupEntry(&map_, obj, true), next_index_++);
|
| + return false;
|
| + }
|
| +
|
| + private:
|
| + base::HashMap map_;
|
| + int next_index_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(PartialCacheIndexMap);
|
| + };
|
| +
|
| // The StartupSerializer has to serialize the root array, which is slightly
|
| // different.
|
| void VisitPointers(Object** start, Object** end) override;
|
| @@ -45,6 +72,7 @@ class StartupSerializer : public Serializer {
|
| bool serializing_builtins_;
|
| bool serializing_immortal_immovables_roots_;
|
| std::bitset<Heap::kStrongRootListLength> root_has_been_serialized_;
|
| + PartialCacheIndexMap partial_cache_index_map_;
|
| DISALLOW_COPY_AND_ASSIGN(StartupSerializer);
|
| };
|
|
|
|
|