OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_SERIALIZE_H_ | 5 #ifndef V8_SERIALIZE_H_ |
6 #define V8_SERIALIZE_H_ | 6 #define V8_SERIALIZE_H_ |
7 | 7 |
8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
9 #include "src/hashmap.h" | 9 #include "src/hashmap.h" |
10 #include "src/heap-profiler.h" | 10 #include "src/heap-profiler.h" |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 | 268 |
269 ~BackReferenceMap() { delete map_; } | 269 ~BackReferenceMap() { delete map_; } |
270 | 270 |
271 BackReference Lookup(HeapObject* obj) { | 271 BackReference Lookup(HeapObject* obj) { |
272 HashMap::Entry* entry = LookupEntry(map_, obj, false); | 272 HashMap::Entry* entry = LookupEntry(map_, obj, false); |
273 return entry ? BackReference(GetValue(entry)) : BackReference(); | 273 return entry ? BackReference(GetValue(entry)) : BackReference(); |
274 } | 274 } |
275 | 275 |
276 void Add(HeapObject* obj, BackReference b) { | 276 void Add(HeapObject* obj, BackReference b) { |
277 DCHECK(b.is_valid()); | 277 DCHECK(b.is_valid()); |
278 DCHECK_EQ(NULL, LookupEntry(map_, obj, false)); | 278 DCHECK_NULL(LookupEntry(map_, obj, false)); |
279 HashMap::Entry* entry = LookupEntry(map_, obj, true); | 279 HashMap::Entry* entry = LookupEntry(map_, obj, true); |
280 SetValue(entry, b.bitfield()); | 280 SetValue(entry, b.bitfield()); |
281 } | 281 } |
282 | 282 |
283 void AddSourceString(String* string) { | 283 void AddSourceString(String* string) { |
284 Add(string, BackReference::SourceReference()); | 284 Add(string, BackReference::SourceReference()); |
285 } | 285 } |
286 | 286 |
287 void AddGlobalProxy(HeapObject* global_proxy) { | 287 void AddGlobalProxy(HeapObject* global_proxy) { |
288 Add(global_proxy, BackReference::GlobalProxyReference()); | 288 Add(global_proxy, BackReference::GlobalProxyReference()); |
(...skipping 11 matching lines...) Expand all Loading... |
300 HotObjectsList() : index_(0) { | 300 HotObjectsList() : index_(0) { |
301 for (int i = 0; i < kSize; i++) circular_queue_[i] = NULL; | 301 for (int i = 0; i < kSize; i++) circular_queue_[i] = NULL; |
302 } | 302 } |
303 | 303 |
304 void Add(HeapObject* object) { | 304 void Add(HeapObject* object) { |
305 circular_queue_[index_] = object; | 305 circular_queue_[index_] = object; |
306 index_ = (index_ + 1) & kSizeMask; | 306 index_ = (index_ + 1) & kSizeMask; |
307 } | 307 } |
308 | 308 |
309 HeapObject* Get(int index) { | 309 HeapObject* Get(int index) { |
310 DCHECK_NE(NULL, circular_queue_[index]); | 310 DCHECK_NOT_NULL(circular_queue_[index]); |
311 return circular_queue_[index]; | 311 return circular_queue_[index]; |
312 } | 312 } |
313 | 313 |
314 static const int kNotFound = -1; | 314 static const int kNotFound = -1; |
315 | 315 |
316 int Find(HeapObject* object) { | 316 int Find(HeapObject* object) { |
317 for (int i = 0; i < kSize; i++) { | 317 for (int i = 0; i < kSize; i++) { |
318 if (circular_queue_[i] == object) return i; | 318 if (circular_queue_[i] == object) return i; |
319 } | 319 } |
320 return kNotFound; | 320 return kNotFound; |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
959 static const int kCheckSumOffset = 0; | 959 static const int kCheckSumOffset = 0; |
960 static const int kNumInternalizedStringsOffset = 1; | 960 static const int kNumInternalizedStringsOffset = 1; |
961 static const int kReservationsOffset = 2; | 961 static const int kReservationsOffset = 2; |
962 static const int kNumCodeStubKeysOffset = 3; | 962 static const int kNumCodeStubKeysOffset = 3; |
963 static const int kPayloadLengthOffset = 4; | 963 static const int kPayloadLengthOffset = 4; |
964 static const int kHeaderSize = (kPayloadLengthOffset + 1) * kIntSize; | 964 static const int kHeaderSize = (kPayloadLengthOffset + 1) * kIntSize; |
965 }; | 965 }; |
966 } } // namespace v8::internal | 966 } } // namespace v8::internal |
967 | 967 |
968 #endif // V8_SERIALIZE_H_ | 968 #endif // V8_SERIALIZE_H_ |
OLD | NEW |