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_MARK_COMPACT_H_ | 5 #ifndef V8_MARK_COMPACT_H_ |
6 #define V8_MARK_COMPACT_H_ | 6 #define V8_MARK_COMPACT_H_ |
7 | 7 |
8 #include "src/compiler-intrinsics.h" | 8 #include "src/compiler-intrinsics.h" |
9 #include "src/spaces.h" | 9 #include "src/spaces.h" |
10 | 10 |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 void SetUp(); | 521 void SetUp(); |
522 | 522 |
523 void TearDown(); | 523 void TearDown(); |
524 | 524 |
525 void CollectEvacuationCandidates(PagedSpace* space); | 525 void CollectEvacuationCandidates(PagedSpace* space); |
526 | 526 |
527 void AddEvacuationCandidate(Page* p); | 527 void AddEvacuationCandidate(Page* p); |
528 | 528 |
529 // Prepares for GC by resetting relocation info in old and map spaces and | 529 // Prepares for GC by resetting relocation info in old and map spaces and |
530 // choosing spaces to compact. | 530 // choosing spaces to compact. |
531 void Prepare(GCTracer* tracer); | 531 void Prepare(); |
532 | 532 |
533 // Performs a global garbage collection. | 533 // Performs a global garbage collection. |
534 void CollectGarbage(); | 534 void CollectGarbage(); |
535 | 535 |
536 enum CompactionMode { | 536 enum CompactionMode { |
537 INCREMENTAL_COMPACTION, | 537 INCREMENTAL_COMPACTION, |
538 NON_INCREMENTAL_COMPACTION | 538 NON_INCREMENTAL_COMPACTION |
539 }; | 539 }; |
540 | 540 |
541 bool StartCompaction(CompactionMode mode); | 541 bool StartCompaction(CompactionMode mode); |
542 | 542 |
543 void AbortCompaction(); | 543 void AbortCompaction(); |
544 | 544 |
545 // During a full GC, there is a stack-allocated GCTracer that is used for | |
546 // bookkeeping information. Return a pointer to that tracer. | |
547 GCTracer* tracer() { return tracer_; } | |
548 | |
549 #ifdef DEBUG | 545 #ifdef DEBUG |
550 // Checks whether performing mark-compact collection. | 546 // Checks whether performing mark-compact collection. |
551 bool in_use() { return state_ > PREPARE_GC; } | 547 bool in_use() { return state_ > PREPARE_GC; } |
552 bool are_map_pointers_encoded() { return state_ == UPDATE_POINTERS; } | 548 bool are_map_pointers_encoded() { return state_ == UPDATE_POINTERS; } |
553 #endif | 549 #endif |
554 | 550 |
555 // Determine type of object and emit deletion log event. | 551 // Determine type of object and emit deletion log event. |
556 static void ReportDeleteIfNeeded(HeapObject* obj, Isolate* isolate); | 552 static void ReportDeleteIfNeeded(HeapObject* obj, Isolate* isolate); |
557 | 553 |
558 // Distinguishable invalid map encodings (for single word and multiple words) | 554 // Distinguishable invalid map encodings (for single word and multiple words) |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 | 734 |
739 bool was_marked_incrementally_; | 735 bool was_marked_incrementally_; |
740 | 736 |
741 // True if concurrent or parallel sweeping is currently in progress. | 737 // True if concurrent or parallel sweeping is currently in progress. |
742 bool sweeping_pending_; | 738 bool sweeping_pending_; |
743 | 739 |
744 base::Semaphore pending_sweeper_jobs_semaphore_; | 740 base::Semaphore pending_sweeper_jobs_semaphore_; |
745 | 741 |
746 bool sequential_sweeping_; | 742 bool sequential_sweeping_; |
747 | 743 |
748 // A pointer to the current stack-allocated GC tracer object during a full | |
749 // collection (NULL before and after). | |
750 GCTracer* tracer_; | |
751 | |
752 SlotsBufferAllocator slots_buffer_allocator_; | 744 SlotsBufferAllocator slots_buffer_allocator_; |
753 | 745 |
754 SlotsBuffer* migration_slots_buffer_; | 746 SlotsBuffer* migration_slots_buffer_; |
755 | 747 |
756 // Finishes GC, performs heap verification if enabled. | 748 // Finishes GC, performs heap verification if enabled. |
757 void Finish(); | 749 void Finish(); |
758 | 750 |
759 // ----------------------------------------------------------------------- | 751 // ----------------------------------------------------------------------- |
760 // Phase 1: Marking live objects. | 752 // Phase 1: Marking live objects. |
761 // | 753 // |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 private: | 977 private: |
986 MarkCompactCollector* collector_; | 978 MarkCompactCollector* collector_; |
987 }; | 979 }; |
988 | 980 |
989 | 981 |
990 const char* AllocationSpaceName(AllocationSpace space); | 982 const char* AllocationSpaceName(AllocationSpace space); |
991 | 983 |
992 } } // namespace v8::internal | 984 } } // namespace v8::internal |
993 | 985 |
994 #endif // V8_MARK_COMPACT_H_ | 986 #endif // V8_MARK_COMPACT_H_ |
OLD | NEW |