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_MARK_COMPACT_H_ | 5 #ifndef V8_HEAP_MARK_COMPACT_H_ |
6 #define V8_HEAP_MARK_COMPACT_H_ | 6 #define V8_HEAP_MARK_COMPACT_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 void AbortCompaction(); | 509 void AbortCompaction(); |
510 | 510 |
511 // Determine type of object and emit deletion log event. | 511 // Determine type of object and emit deletion log event. |
512 static void ReportDeleteIfNeeded(HeapObject* obj, Isolate* isolate); | 512 static void ReportDeleteIfNeeded(HeapObject* obj, Isolate* isolate); |
513 | 513 |
514 // Distinguishable invalid map encodings (for single word and multiple words) | 514 // Distinguishable invalid map encodings (for single word and multiple words) |
515 // that indicate free regions. | 515 // that indicate free regions. |
516 static const uint32_t kSingleFreeEncoding = 0; | 516 static const uint32_t kSingleFreeEncoding = 0; |
517 static const uint32_t kMultiFreeEncoding = 1; | 517 static const uint32_t kMultiFreeEncoding = 1; |
518 | 518 |
519 static inline bool IsMarked(Object* obj); | |
520 static bool IsUnmarkedHeapObjectWithHeap(Heap* heap, Object** p); | 519 static bool IsUnmarkedHeapObjectWithHeap(Heap* heap, Object** p); |
521 | 520 |
522 inline Heap* heap() const { return heap_; } | 521 inline Heap* heap() const { return heap_; } |
523 inline Isolate* isolate() const; | 522 inline Isolate* isolate() const; |
524 | 523 |
525 CodeFlusher* code_flusher() { return code_flusher_; } | 524 CodeFlusher* code_flusher() { return code_flusher_; } |
526 inline bool is_code_flushing_enabled() const { return code_flusher_ != NULL; } | 525 inline bool is_code_flushing_enabled() const { return code_flusher_ != NULL; } |
527 | 526 |
528 INLINE(static bool ShouldSkipEvacuationSlotRecording(Object* host)) { | 527 INLINE(static bool ShouldSkipEvacuationSlotRecording(Object* host)) { |
529 return Page::FromAddress(reinterpret_cast<Address>(host)) | 528 return Page::FromAddress(reinterpret_cast<Address>(host)) |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 // Note: Thread-safe. | 561 // Note: Thread-safe. |
563 void SweepAndRefill(CompactionSpace* space); | 562 void SweepAndRefill(CompactionSpace* space); |
564 | 563 |
565 // Checks if sweeping is in progress right now on any space. | 564 // Checks if sweeping is in progress right now on any space. |
566 bool sweeping_in_progress() { return sweeper().sweeping_in_progress(); } | 565 bool sweeping_in_progress() { return sweeper().sweeping_in_progress(); } |
567 | 566 |
568 void set_evacuation(bool evacuation) { evacuation_ = evacuation; } | 567 void set_evacuation(bool evacuation) { evacuation_ = evacuation; } |
569 | 568 |
570 bool evacuation() const { return evacuation_; } | 569 bool evacuation() const { return evacuation_; } |
571 | 570 |
572 // Special case for processing weak references in a full collection. We need | |
573 // to artificially keep AllocationSites alive for a time. | |
574 void MarkAllocationSite(AllocationSite* site); | |
575 | |
576 // Mark objects in implicit references groups if their parent object | 571 // Mark objects in implicit references groups if their parent object |
577 // is marked. | 572 // is marked. |
578 void MarkImplicitRefGroups(MarkObjectFunction mark_object); | 573 void MarkImplicitRefGroups(MarkObjectFunction mark_object); |
579 | 574 |
580 MarkingDeque* marking_deque() { return &marking_deque_; } | 575 MarkingDeque* marking_deque() { return &marking_deque_; } |
581 | 576 |
582 Sweeper& sweeper() { return sweeper_; } | 577 Sweeper& sweeper() { return sweeper_; } |
583 | 578 |
584 #ifdef DEBUG | 579 #ifdef DEBUG |
585 // Checks whether performing mark-compact collection. | 580 // Checks whether performing mark-compact collection. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 INLINE(void PushBlack(HeapObject* obj)); | 651 INLINE(void PushBlack(HeapObject* obj)); |
657 | 652 |
658 // Unshifts a black object into the marking stack and accounts for live bytes. | 653 // Unshifts a black object into the marking stack and accounts for live bytes. |
659 // Note that this assumes lives bytes have already been counted. | 654 // Note that this assumes lives bytes have already been counted. |
660 INLINE(void UnshiftBlack(HeapObject* obj)); | 655 INLINE(void UnshiftBlack(HeapObject* obj)); |
661 | 656 |
662 // Marks the object black and pushes it on the marking stack. | 657 // Marks the object black and pushes it on the marking stack. |
663 // This is for non-incremental marking only. | 658 // This is for non-incremental marking only. |
664 INLINE(void MarkObject(HeapObject* obj, MarkBit mark_bit)); | 659 INLINE(void MarkObject(HeapObject* obj, MarkBit mark_bit)); |
665 | 660 |
666 // Marks the object black assuming that it is not yet marked. | |
667 // This is for non-incremental marking only. | |
668 INLINE(void SetMark(HeapObject* obj)); | |
669 | |
670 // Mark the heap roots and all objects reachable from them. | 661 // Mark the heap roots and all objects reachable from them. |
671 void MarkRoots(RootMarkingVisitor<MarkCompactMode::FULL>* visitor); | 662 void MarkRoots(RootMarkingVisitor<MarkCompactMode::FULL>* visitor); |
672 | 663 |
673 // Mark the string table specially. References to internalized strings from | 664 // Mark the string table specially. References to internalized strings from |
674 // the string table are weak. | 665 // the string table are weak. |
675 void MarkStringTable(RootMarkingVisitor<MarkCompactMode::FULL>* visitor); | 666 void MarkStringTable(RootMarkingVisitor<MarkCompactMode::FULL>* visitor); |
676 | 667 |
677 // Mark objects reachable (transitively) from objects in the marking stack | 668 // Mark objects reachable (transitively) from objects in the marking stack |
678 // or overflowed in the heap. | 669 // or overflowed in the heap. |
679 template <MarkCompactMode mode> | 670 template <MarkCompactMode mode> |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 | 839 |
849 private: | 840 private: |
850 MarkCompactCollector* collector_; | 841 MarkCompactCollector* collector_; |
851 }; | 842 }; |
852 | 843 |
853 V8_EXPORT_PRIVATE const char* AllocationSpaceName(AllocationSpace space); | 844 V8_EXPORT_PRIVATE const char* AllocationSpaceName(AllocationSpace space); |
854 } // namespace internal | 845 } // namespace internal |
855 } // namespace v8 | 846 } // namespace v8 |
856 | 847 |
857 #endif // V8_HEAP_MARK_COMPACT_H_ | 848 #endif // V8_HEAP_MARK_COMPACT_H_ |
OLD | NEW |