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 "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/heap/spaces.h" | 9 #include "src/heap/spaces.h" |
10 | 10 |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 | 497 |
498 | 498 |
499 // Defined in isolate.h. | 499 // Defined in isolate.h. |
500 class ThreadLocalTop; | 500 class ThreadLocalTop; |
501 | 501 |
502 | 502 |
503 // ------------------------------------------------------------------------- | 503 // ------------------------------------------------------------------------- |
504 // Mark-Compact collector | 504 // Mark-Compact collector |
505 class MarkCompactCollector { | 505 class MarkCompactCollector { |
506 public: | 506 public: |
507 // Set the global flags, it must be called before Prepare to take effect. | |
508 inline void SetFlags(int flags); | |
509 | |
510 static void Initialize(); | 507 static void Initialize(); |
511 | 508 |
512 void SetUp(); | 509 void SetUp(); |
513 | 510 |
514 void TearDown(); | 511 void TearDown(); |
515 | 512 |
516 void CollectEvacuationCandidates(PagedSpace* space); | 513 void CollectEvacuationCandidates(PagedSpace* space); |
517 | 514 |
518 void AddEvacuationCandidate(Page* p); | 515 void AddEvacuationCandidate(Page* p); |
519 | 516 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 void MigrateObjectTagged(HeapObject* dst, HeapObject* src, int size); | 590 void MigrateObjectTagged(HeapObject* dst, HeapObject* src, int size); |
594 void MigrateObjectMixed(HeapObject* dst, HeapObject* src, int size); | 591 void MigrateObjectMixed(HeapObject* dst, HeapObject* src, int size); |
595 void MigrateObjectRaw(HeapObject* dst, HeapObject* src, int size); | 592 void MigrateObjectRaw(HeapObject* dst, HeapObject* src, int size); |
596 | 593 |
597 bool TryPromoteObject(HeapObject* object, int object_size); | 594 bool TryPromoteObject(HeapObject* object, int object_size); |
598 | 595 |
599 void InvalidateCode(Code* code); | 596 void InvalidateCode(Code* code); |
600 | 597 |
601 void ClearMarkbits(); | 598 void ClearMarkbits(); |
602 | 599 |
603 bool abort_incremental_marking() const { return abort_incremental_marking_; } | |
604 | |
605 bool finalize_incremental_marking() const { | |
606 return finalize_incremental_marking_; | |
607 } | |
608 | |
609 bool is_compacting() const { return compacting_; } | 600 bool is_compacting() const { return compacting_; } |
610 | 601 |
611 MarkingParity marking_parity() { return marking_parity_; } | 602 MarkingParity marking_parity() { return marking_parity_; } |
612 | 603 |
613 // Concurrent and parallel sweeping support. If required_freed_bytes was set | 604 // Concurrent and parallel sweeping support. If required_freed_bytes was set |
614 // to a value larger than 0, then sweeping returns after a block of at least | 605 // to a value larger than 0, then sweeping returns after a block of at least |
615 // required_freed_bytes was freed. If required_freed_bytes was set to zero | 606 // required_freed_bytes was freed. If required_freed_bytes was set to zero |
616 // then the whole given space is swept. It returns the size of the maximum | 607 // then the whole given space is swept. It returns the size of the maximum |
617 // continuous freed memory chunk. | 608 // continuous freed memory chunk. |
618 int SweepInParallel(PagedSpace* space, int required_freed_bytes); | 609 int SweepInParallel(PagedSpace* space, int required_freed_bytes); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 SWEEP_SPACES, | 687 SWEEP_SPACES, |
697 ENCODE_FORWARDING_ADDRESSES, | 688 ENCODE_FORWARDING_ADDRESSES, |
698 UPDATE_POINTERS, | 689 UPDATE_POINTERS, |
699 RELOCATE_OBJECTS | 690 RELOCATE_OBJECTS |
700 }; | 691 }; |
701 | 692 |
702 // The current stage of the collector. | 693 // The current stage of the collector. |
703 CollectorState state_; | 694 CollectorState state_; |
704 #endif | 695 #endif |
705 | 696 |
706 bool reduce_memory_footprint_; | |
707 | |
708 bool abort_incremental_marking_; | |
709 | |
710 bool finalize_incremental_marking_; | |
711 | |
712 MarkingParity marking_parity_; | 697 MarkingParity marking_parity_; |
713 | 698 |
714 // True if we are collecting slots to perform evacuation from evacuation | 699 // True if we are collecting slots to perform evacuation from evacuation |
715 // candidates. | 700 // candidates. |
716 bool compacting_; | 701 bool compacting_; |
717 | 702 |
718 bool was_marked_incrementally_; | 703 bool was_marked_incrementally_; |
719 | 704 |
720 // True if concurrent or parallel sweeping is currently in progress. | 705 // True if concurrent or parallel sweeping is currently in progress. |
721 bool sweeping_in_progress_; | 706 bool sweeping_in_progress_; |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 private: | 962 private: |
978 MarkCompactCollector* collector_; | 963 MarkCompactCollector* collector_; |
979 }; | 964 }; |
980 | 965 |
981 | 966 |
982 const char* AllocationSpaceName(AllocationSpace space); | 967 const char* AllocationSpaceName(AllocationSpace space); |
983 } | 968 } |
984 } // namespace v8::internal | 969 } // namespace v8::internal |
985 | 970 |
986 #endif // V8_HEAP_MARK_COMPACT_H_ | 971 #endif // V8_HEAP_MARK_COMPACT_H_ |
OLD | NEW |