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/heap/spaces.h" | 8 #include "src/heap/spaces.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
537 static inline bool IsMarked(Object* obj); | 537 static inline bool IsMarked(Object* obj); |
538 | 538 |
539 inline Heap* heap() const { return heap_; } | 539 inline Heap* heap() const { return heap_; } |
540 inline Isolate* isolate() const; | 540 inline Isolate* isolate() const; |
541 | 541 |
542 CodeFlusher* code_flusher() { return code_flusher_; } | 542 CodeFlusher* code_flusher() { return code_flusher_; } |
543 inline bool is_code_flushing_enabled() const { return code_flusher_ != NULL; } | 543 inline bool is_code_flushing_enabled() const { return code_flusher_ != NULL; } |
544 void EnableCodeFlushing(bool enable); | 544 void EnableCodeFlushing(bool enable); |
545 | 545 |
546 enum SweeperType { | 546 enum SweeperType { |
547 PARALLEL_CONSERVATIVE, | |
548 CONCURRENT_CONSERVATIVE, | |
549 PARALLEL_PRECISE, | 547 PARALLEL_PRECISE, |
550 CONCURRENT_PRECISE, | 548 CONCURRENT_PRECISE, |
551 PRECISE | 549 PRECISE |
552 }; | 550 }; |
553 | 551 |
554 enum SweepingParallelism { SWEEP_ON_MAIN_THREAD, SWEEP_IN_PARALLEL }; | 552 enum SweepingParallelism { SWEEP_ON_MAIN_THREAD, SWEEP_IN_PARALLEL }; |
555 | 553 |
556 #ifdef VERIFY_HEAP | 554 #ifdef VERIFY_HEAP |
557 void VerifyMarkbitsAreClean(); | 555 void VerifyMarkbitsAreClean(); |
558 static void VerifyMarkbitsAreClean(PagedSpace* space); | 556 static void VerifyMarkbitsAreClean(PagedSpace* space); |
559 static void VerifyMarkbitsAreClean(NewSpace* space); | 557 static void VerifyMarkbitsAreClean(NewSpace* space); |
560 void VerifyWeakEmbeddedObjectsInCode(); | 558 void VerifyWeakEmbeddedObjectsInCode(); |
561 void VerifyOmittedMapChecks(); | 559 void VerifyOmittedMapChecks(); |
562 #endif | 560 #endif |
563 | 561 |
564 // Sweep a single page from the given space conservatively. | |
565 // Returns the size of the biggest continuous freed memory chunk in bytes. | |
566 template <SweepingParallelism type> | |
567 static int SweepConservatively(PagedSpace* space, FreeList* free_list, | |
568 Page* p); | |
569 | |
570 INLINE(static bool ShouldSkipEvacuationSlotRecording(Object** anchor)) { | 562 INLINE(static bool ShouldSkipEvacuationSlotRecording(Object** anchor)) { |
571 return Page::FromAddress(reinterpret_cast<Address>(anchor)) | 563 return Page::FromAddress(reinterpret_cast<Address>(anchor)) |
572 ->ShouldSkipEvacuationSlotRecording(); | 564 ->ShouldSkipEvacuationSlotRecording(); |
573 } | 565 } |
574 | 566 |
575 INLINE(static bool ShouldSkipEvacuationSlotRecording(Object* host)) { | 567 INLINE(static bool ShouldSkipEvacuationSlotRecording(Object* host)) { |
576 return Page::FromAddress(reinterpret_cast<Address>(host)) | 568 return Page::FromAddress(reinterpret_cast<Address>(host)) |
577 ->ShouldSkipEvacuationSlotRecording(); | 569 ->ShouldSkipEvacuationSlotRecording(); |
578 } | 570 } |
579 | 571 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
688 UPDATE_POINTERS, | 680 UPDATE_POINTERS, |
689 RELOCATE_OBJECTS | 681 RELOCATE_OBJECTS |
690 }; | 682 }; |
691 | 683 |
692 // The current stage of the collector. | 684 // The current stage of the collector. |
693 CollectorState state_; | 685 CollectorState state_; |
694 #endif | 686 #endif |
695 | 687 |
696 // Global flag that forces sweeping to be precise, so we can traverse the | 688 // Global flag that forces sweeping to be precise, so we can traverse the |
697 // heap. | 689 // heap. |
698 bool sweep_precisely_; | 690 bool sweep_precisely_; |
Jarin
2014/08/21 08:29:12
Is this flag still needed?
Hannes Payer (out of office)
2014/08/21 09:03:17
Done.
| |
699 | 691 |
700 bool reduce_memory_footprint_; | 692 bool reduce_memory_footprint_; |
701 | 693 |
702 bool abort_incremental_marking_; | 694 bool abort_incremental_marking_; |
703 | 695 |
704 MarkingParity marking_parity_; | 696 MarkingParity marking_parity_; |
705 | 697 |
706 // True if we are collecting slots to perform evacuation from evacuation | 698 // True if we are collecting slots to perform evacuation from evacuation |
707 // candidates. | 699 // candidates. |
708 bool compacting_; | 700 bool compacting_; |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
956 private: | 948 private: |
957 MarkCompactCollector* collector_; | 949 MarkCompactCollector* collector_; |
958 }; | 950 }; |
959 | 951 |
960 | 952 |
961 const char* AllocationSpaceName(AllocationSpace space); | 953 const char* AllocationSpaceName(AllocationSpace space); |
962 } | 954 } |
963 } // namespace v8::internal | 955 } // namespace v8::internal |
964 | 956 |
965 #endif // V8_HEAP_MARK_COMPACT_H_ | 957 #endif // V8_HEAP_MARK_COMPACT_H_ |
OLD | NEW |