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

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

Issue 2010243003: Move hashmap into base/. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 6 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
« no previous file with comments | « src/s390/simulator-s390.cc ('k') | src/snapshot/serializer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_SNAPSHOT_PARTIAL_SERIALIZER_H_ 5 #ifndef V8_SNAPSHOT_PARTIAL_SERIALIZER_H_
6 #define V8_SNAPSHOT_PARTIAL_SERIALIZER_H_ 6 #define V8_SNAPSHOT_PARTIAL_SERIALIZER_H_
7 7
8 #include "src/address-map.h" 8 #include "src/address-map.h"
9 #include "src/snapshot/serializer.h" 9 #include "src/snapshot/serializer.h"
10 10
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 13
14 class PartialSerializer : public Serializer { 14 class PartialSerializer : public Serializer {
15 public: 15 public:
16 PartialSerializer(Isolate* isolate, Serializer* startup_snapshot_serializer, 16 PartialSerializer(Isolate* isolate, Serializer* startup_snapshot_serializer,
17 SnapshotByteSink* sink); 17 SnapshotByteSink* sink);
18 18
19 ~PartialSerializer() override; 19 ~PartialSerializer() override;
20 20
21 // Serialize the objects reachable from a single object pointer. 21 // Serialize the objects reachable from a single object pointer.
22 void Serialize(Object** o); 22 void Serialize(Object** o);
23 23
24 private: 24 private:
25 class PartialCacheIndexMap : public AddressMapBase { 25 class PartialCacheIndexMap : public AddressMapBase {
26 public: 26 public:
27 PartialCacheIndexMap() : map_(HashMap::PointersMatch) {} 27 PartialCacheIndexMap() : map_(base::HashMap::PointersMatch) {}
28 28
29 static const int kInvalidIndex = -1; 29 static const int kInvalidIndex = -1;
30 30
31 // Lookup object in the map. Return its index if found, or create 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. 32 // a new entry with new_index as value, and return kInvalidIndex.
33 int LookupOrInsert(HeapObject* obj, int new_index) { 33 int LookupOrInsert(HeapObject* obj, int new_index) {
34 HashMap::Entry* entry = LookupEntry(&map_, obj, false); 34 base::HashMap::Entry* entry = LookupEntry(&map_, obj, false);
35 if (entry != NULL) return GetValue(entry); 35 if (entry != NULL) return GetValue(entry);
36 SetValue(LookupEntry(&map_, obj, true), static_cast<uint32_t>(new_index)); 36 SetValue(LookupEntry(&map_, obj, true), static_cast<uint32_t>(new_index));
37 return kInvalidIndex; 37 return kInvalidIndex;
38 } 38 }
39 39
40 private: 40 private:
41 HashMap map_; 41 base::HashMap map_;
42 42
43 DISALLOW_COPY_AND_ASSIGN(PartialCacheIndexMap); 43 DISALLOW_COPY_AND_ASSIGN(PartialCacheIndexMap);
44 }; 44 };
45 45
46 void SerializeObject(HeapObject* o, HowToCode how_to_code, 46 void SerializeObject(HeapObject* o, HowToCode how_to_code,
47 WhereToPoint where_to_point, int skip) override; 47 WhereToPoint where_to_point, int skip) override;
48 48
49 int PartialSnapshotCacheIndex(HeapObject* o); 49 int PartialSnapshotCacheIndex(HeapObject* o);
50 bool ShouldBeInThePartialSnapshotCache(HeapObject* o); 50 bool ShouldBeInThePartialSnapshotCache(HeapObject* o);
51 51
52 Serializer* startup_serializer_; 52 Serializer* startup_serializer_;
53 PartialCacheIndexMap partial_cache_index_map_; 53 PartialCacheIndexMap partial_cache_index_map_;
54 int next_partial_cache_index_; 54 int next_partial_cache_index_;
55 DISALLOW_COPY_AND_ASSIGN(PartialSerializer); 55 DISALLOW_COPY_AND_ASSIGN(PartialSerializer);
56 }; 56 };
57 57
58 } // namespace internal 58 } // namespace internal
59 } // namespace v8 59 } // namespace v8
60 60
61 #endif // V8_SNAPSHOT_PARTIAL_SERIALIZER_H_ 61 #endif // V8_SNAPSHOT_PARTIAL_SERIALIZER_H_
OLDNEW
« no previous file with comments | « src/s390/simulator-s390.cc ('k') | src/snapshot/serializer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698