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

Unified Diff: src/serialize.h

Issue 952933002: Use a hashmap to lookup items in the partial snapshot cache when serializing. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/serialize.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/serialize.h
diff --git a/src/serialize.h b/src/serialize.h
index cfe9e1158dbad73e2c0779a955ae72c3e04b23c0..64164c803a931c61b4808b64a025ab2c4d4e6e55 100644
--- a/src/serialize.h
+++ b/src/serialize.h
@@ -186,6 +186,28 @@ class RootIndexMap : public AddressMapBase {
};
+class PartialCacheIndexMap : public AddressMapBase {
+ public:
+ PartialCacheIndexMap() : map_(HashMap::PointersMatch) {}
+
+ static const int kInvalidIndex = -1;
+
+ // Lookup object in the map. Return its index if found, or create
+ // a new entry with new_index as value, and return kInvalidIndex.
+ int LookupOrInsert(HeapObject* obj, int new_index) {
+ HashMap::Entry* entry = LookupEntry(&map_, obj, true);
+ if (entry->value != NULL) return GetValue(entry);
+ SetValue(entry, static_cast<uint32_t>(new_index));
+ return kInvalidIndex;
+ }
+
+ private:
+ HashMap map_;
+
+ DISALLOW_COPY_AND_ASSIGN(PartialCacheIndexMap);
+};
+
+
class BackReference {
public:
explicit BackReference(uint32_t bitfield) : bitfield_(bitfield) {}
@@ -802,6 +824,7 @@ class PartialSerializer : public Serializer {
Serializer* startup_serializer_;
List<BackReference> outdated_contexts_;
Object* global_object_;
+ PartialCacheIndexMap partial_cache_index_map_;
DISALLOW_COPY_AND_ASSIGN(PartialSerializer);
};
« no previous file with comments | « no previous file | src/serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698