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

Unified Diff: src/snapshot/startup-serializer.h

Issue 2490783004: [serializer] small fixes for blink snapshot. (Closed)
Patch Set: rebase and fix Created 4 years, 1 month 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 | « src/snapshot/serializer-common.cc ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/snapshot/startup-serializer.h
diff --git a/src/snapshot/startup-serializer.h b/src/snapshot/startup-serializer.h
index 9c1c3b904cfbeacfdd2e7f89449da9e23adfceba..ac75c5d163828b8a0f7ab543144803dc2f704f88 100644
--- a/src/snapshot/startup-serializer.h
+++ b/src/snapshot/startup-serializer.h
@@ -30,25 +30,26 @@ class StartupSerializer : public Serializer {
int PartialSnapshotCacheIndex(HeapObject* o);
private:
- class PartialCacheIndexMap : public AddressMapBase {
+ class PartialCacheIndexMap {
public:
PartialCacheIndexMap() : map_(), 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);
+ Maybe<uint32_t> maybe_index = map_.Get(obj);
+ if (maybe_index.IsJust()) {
+ *index_out = maybe_index.FromJust();
return true;
}
*index_out = next_index_;
- SetValue(LookupEntry(&map_, obj, true), next_index_++);
+ map_.Set(obj, next_index_++);
return false;
}
private:
- base::HashMap map_;
+ DisallowHeapAllocation no_allocation_;
+ HeapObjectToIndexHashMap map_;
int next_index_;
DISALLOW_COPY_AND_ASSIGN(PartialCacheIndexMap);
« no previous file with comments | « src/snapshot/serializer-common.cc ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698