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_HEAP_HEAP_H_ | 5 #ifndef V8_HEAP_HEAP_H_ |
6 #define V8_HEAP_HEAP_H_ | 6 #define V8_HEAP_HEAP_H_ |
7 | 7 |
8 #include <cmath> | 8 #include <cmath> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 limit_(nullptr), | 427 limit_(nullptr), |
428 emergency_stack_(nullptr), | 428 emergency_stack_(nullptr), |
429 heap_(heap) {} | 429 heap_(heap) {} |
430 | 430 |
431 void Initialize(); | 431 void Initialize(); |
432 void Destroy(); | 432 void Destroy(); |
433 | 433 |
434 inline void SetNewLimit(Address limit); | 434 inline void SetNewLimit(Address limit); |
435 inline bool IsBelowPromotionQueue(Address to_space_top); | 435 inline bool IsBelowPromotionQueue(Address to_space_top); |
436 | 436 |
437 inline void insert(HeapObject* target, int32_t size, bool was_marked_black); | 437 inline void insert(HeapObject* target, int32_t size); |
438 inline void remove(HeapObject** target, int32_t* size, | 438 inline void remove(HeapObject** target, int32_t* size); |
439 bool* was_marked_black); | |
440 | 439 |
441 bool is_empty() { | 440 bool is_empty() { |
442 return (front_ == rear_) && | 441 return (front_ == rear_) && |
443 (emergency_stack_ == nullptr || emergency_stack_->length() == 0); | 442 (emergency_stack_ == nullptr || emergency_stack_->length() == 0); |
444 } | 443 } |
445 | 444 |
446 private: | 445 private: |
447 struct Entry { | 446 struct Entry { |
448 Entry(HeapObject* obj, int32_t size, bool was_marked_black) | 447 Entry(HeapObject* obj, int32_t size) : obj_(obj), size_(size) {} |
449 : obj_(obj), size_(size), was_marked_black_(was_marked_black) {} | |
450 | 448 |
451 HeapObject* obj_; | 449 HeapObject* obj_; |
452 int32_t size_ : 31; | 450 int32_t size_; |
453 bool was_marked_black_ : 1; | |
454 }; | 451 }; |
455 | 452 |
456 inline Page* GetHeadPage(); | 453 inline Page* GetHeadPage(); |
457 | 454 |
458 void RelocateQueueHead(); | 455 void RelocateQueueHead(); |
459 | 456 |
460 // The front of the queue is higher in the memory page chain than the rear. | 457 // The front of the queue is higher in the memory page chain than the rear. |
461 struct Entry* front_; | 458 struct Entry* front_; |
462 struct Entry* rear_; | 459 struct Entry* rear_; |
463 struct Entry* limit_; | 460 struct Entry* limit_; |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 void IterateRoots(RootVisitor* v, VisitMode mode); | 1205 void IterateRoots(RootVisitor* v, VisitMode mode); |
1209 // Iterates over all strong roots in the heap. | 1206 // Iterates over all strong roots in the heap. |
1210 void IterateStrongRoots(RootVisitor* v, VisitMode mode); | 1207 void IterateStrongRoots(RootVisitor* v, VisitMode mode); |
1211 // Iterates over entries in the smi roots list. Only interesting to the | 1208 // Iterates over entries in the smi roots list. Only interesting to the |
1212 // serializer/deserializer, since GC does not care about smis. | 1209 // serializer/deserializer, since GC does not care about smis. |
1213 void IterateSmiRoots(RootVisitor* v); | 1210 void IterateSmiRoots(RootVisitor* v); |
1214 // Iterates over all the other roots in the heap. | 1211 // Iterates over all the other roots in the heap. |
1215 void IterateWeakRoots(RootVisitor* v, VisitMode mode); | 1212 void IterateWeakRoots(RootVisitor* v, VisitMode mode); |
1216 | 1213 |
1217 // Iterate pointers of promoted objects. | 1214 // Iterate pointers of promoted objects. |
1218 void IterateAndScavengePromotedObject(HeapObject* target, int size, | 1215 void IterateAndScavengePromotedObject(HeapObject* target, int size); |
1219 bool was_marked_black); | |
1220 | 1216 |
1221 // =========================================================================== | 1217 // =========================================================================== |
1222 // Store buffer API. ========================================================= | 1218 // Store buffer API. ========================================================= |
1223 // =========================================================================== | 1219 // =========================================================================== |
1224 | 1220 |
1225 // Write barrier support for object[offset] = o; | 1221 // Write barrier support for object[offset] = o; |
1226 inline void RecordWrite(Object* object, int offset, Object* o); | 1222 inline void RecordWrite(Object* object, int offset, Object* o); |
1227 inline void RecordWriteIntoCode(Code* host, RelocInfo* rinfo, Object* target); | 1223 inline void RecordWriteIntoCode(Code* host, RelocInfo* rinfo, Object* target); |
1228 void RecordWriteIntoCodeSlow(Code* host, RelocInfo* rinfo, Object* target); | 1224 void RecordWriteIntoCodeSlow(Code* host, RelocInfo* rinfo, Object* target); |
1229 void RecordWritesIntoCode(Code* code); | 1225 void RecordWritesIntoCode(Code* code); |
(...skipping 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2656 friend class PagedSpace; | 2652 friend class PagedSpace; |
2657 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); | 2653 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); |
2658 }; | 2654 }; |
2659 | 2655 |
2660 V8_EXPORT_PRIVATE const char* AllocationSpaceName(AllocationSpace space); | 2656 V8_EXPORT_PRIVATE const char* AllocationSpaceName(AllocationSpace space); |
2661 | 2657 |
2662 } // namespace internal | 2658 } // namespace internal |
2663 } // namespace v8 | 2659 } // namespace v8 |
2664 | 2660 |
2665 #endif // V8_HEAP_HEAP_H_ | 2661 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |