OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_ADDRESS_MAP_H_ | 5 #ifndef V8_ADDRESS_MAP_H_ |
6 #define V8_ADDRESS_MAP_H_ | 6 #define V8_ADDRESS_MAP_H_ |
7 | 7 |
8 #include "src/assert-scope.h" | 8 #include "src/assert-scope.h" |
9 #include "src/base/hashmap.h" | 9 #include "src/base/hashmap.h" |
10 #include "src/objects.h" | 10 #include "src/objects.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 uint32_t bitfield_; | 182 uint32_t bitfield_; |
183 | 183 |
184 friend class SerializerReferenceMap; | 184 friend class SerializerReferenceMap; |
185 }; | 185 }; |
186 | 186 |
187 // Mapping objects to their location after deserialization. | 187 // Mapping objects to their location after deserialization. |
188 // This is used during building, but not at runtime by V8. | 188 // This is used during building, but not at runtime by V8. |
189 class SerializerReferenceMap : public AddressMapBase { | 189 class SerializerReferenceMap : public AddressMapBase { |
190 public: | 190 public: |
191 SerializerReferenceMap() | 191 SerializerReferenceMap() |
192 : no_allocation_(), | 192 : no_allocation_(), map_(), attached_reference_index_(0) {} |
193 map_(base::HashMap::PointersMatch), | |
194 attached_reference_index_(0) {} | |
195 | 193 |
196 SerializerReference Lookup(HeapObject* obj) { | 194 SerializerReference Lookup(HeapObject* obj) { |
197 base::HashMap::Entry* entry = LookupEntry(&map_, obj, false); | 195 base::HashMap::Entry* entry = LookupEntry(&map_, obj, false); |
198 return entry ? SerializerReference(GetValue(entry)) : SerializerReference(); | 196 return entry ? SerializerReference(GetValue(entry)) : SerializerReference(); |
199 } | 197 } |
200 | 198 |
201 void Add(HeapObject* obj, SerializerReference b) { | 199 void Add(HeapObject* obj, SerializerReference b) { |
202 DCHECK(b.is_valid()); | 200 DCHECK(b.is_valid()); |
203 DCHECK_NULL(LookupEntry(&map_, obj, false)); | 201 DCHECK_NULL(LookupEntry(&map_, obj, false)); |
204 base::HashMap::Entry* entry = LookupEntry(&map_, obj, true); | 202 base::HashMap::Entry* entry = LookupEntry(&map_, obj, true); |
(...skipping 11 matching lines...) Expand all Loading... |
216 DisallowHeapAllocation no_allocation_; | 214 DisallowHeapAllocation no_allocation_; |
217 base::HashMap map_; | 215 base::HashMap map_; |
218 int attached_reference_index_; | 216 int attached_reference_index_; |
219 DISALLOW_COPY_AND_ASSIGN(SerializerReferenceMap); | 217 DISALLOW_COPY_AND_ASSIGN(SerializerReferenceMap); |
220 }; | 218 }; |
221 | 219 |
222 } // namespace internal | 220 } // namespace internal |
223 } // namespace v8 | 221 } // namespace v8 |
224 | 222 |
225 #endif // V8_ADDRESS_MAP_H_ | 223 #endif // V8_ADDRESS_MAP_H_ |
OLD | NEW |