Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: src/mark-compact.h

Issue 11782028: Parallel and concurrent sweeping. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/isolate.cc ('k') | src/mark-compact.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 587
588 inline Heap* heap() const { return heap_; } 588 inline Heap* heap() const { return heap_; }
589 589
590 CodeFlusher* code_flusher() { return code_flusher_; } 590 CodeFlusher* code_flusher() { return code_flusher_; }
591 inline bool is_code_flushing_enabled() const { return code_flusher_ != NULL; } 591 inline bool is_code_flushing_enabled() const { return code_flusher_ != NULL; }
592 void EnableCodeFlushing(bool enable); 592 void EnableCodeFlushing(bool enable);
593 593
594 enum SweeperType { 594 enum SweeperType {
595 CONSERVATIVE, 595 CONSERVATIVE,
596 LAZY_CONSERVATIVE, 596 LAZY_CONSERVATIVE,
597 PARALLEL_CONSERVATIVE,
597 PRECISE 598 PRECISE
598 }; 599 };
599 600
601 enum SweepingParallelism {
602 SWEEP_SEQUENTIALLY,
603 SWEEP_IN_PARALLEL
604 };
605
600 #ifdef VERIFY_HEAP 606 #ifdef VERIFY_HEAP
601 void VerifyMarkbitsAreClean(); 607 void VerifyMarkbitsAreClean();
602 static void VerifyMarkbitsAreClean(PagedSpace* space); 608 static void VerifyMarkbitsAreClean(PagedSpace* space);
603 static void VerifyMarkbitsAreClean(NewSpace* space); 609 static void VerifyMarkbitsAreClean(NewSpace* space);
604 #endif 610 #endif
605 611
606 // Sweep a single page from the given space conservatively. 612 // Sweep a single page from the given space conservatively.
607 // Return a number of reclaimed bytes. 613 // Return a number of reclaimed bytes.
608 static intptr_t SweepConservatively(PagedSpace* space, Page* p); 614 template<SweepingParallelism type>
615 static intptr_t SweepConservatively(PagedSpace* space,
616 FreeList* free_list,
617 Page* p);
609 618
610 INLINE(static bool ShouldSkipEvacuationSlotRecording(Object** anchor)) { 619 INLINE(static bool ShouldSkipEvacuationSlotRecording(Object** anchor)) {
611 return Page::FromAddress(reinterpret_cast<Address>(anchor))-> 620 return Page::FromAddress(reinterpret_cast<Address>(anchor))->
612 ShouldSkipEvacuationSlotRecording(); 621 ShouldSkipEvacuationSlotRecording();
613 } 622 }
614 623
615 INLINE(static bool ShouldSkipEvacuationSlotRecording(Object* host)) { 624 INLINE(static bool ShouldSkipEvacuationSlotRecording(Object* host)) {
616 return Page::FromAddress(reinterpret_cast<Address>(host))-> 625 return Page::FromAddress(reinterpret_cast<Address>(host))->
617 ShouldSkipEvacuationSlotRecording(); 626 ShouldSkipEvacuationSlotRecording();
618 } 627 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 void InvalidateCode(Code* code); 673 void InvalidateCode(Code* code);
665 674
666 void ClearMarkbits(); 675 void ClearMarkbits();
667 676
668 bool abort_incremental_marking() const { return abort_incremental_marking_; } 677 bool abort_incremental_marking() const { return abort_incremental_marking_; }
669 678
670 bool is_compacting() const { return compacting_; } 679 bool is_compacting() const { return compacting_; }
671 680
672 MarkingParity marking_parity() { return marking_parity_; } 681 MarkingParity marking_parity() { return marking_parity_; }
673 682
683 void SweepInParallel(PagedSpace* space,
684 FreeList* private_free_list,
685 FreeList* free_list);
686
687 void WaitUntilSweepingCompleted();
688
689 intptr_t StealMemoryFromSweeperThreads(PagedSpace* space);
690
691 bool AreSweeperThreadsActivated();
692
674 private: 693 private:
675 MarkCompactCollector(); 694 MarkCompactCollector();
676 ~MarkCompactCollector(); 695 ~MarkCompactCollector();
677 696
678 bool MarkInvalidatedCode(); 697 bool MarkInvalidatedCode();
679 void RemoveDeadInvalidatedCode(); 698 void RemoveDeadInvalidatedCode();
680 void ProcessInvalidatedCode(ObjectVisitor* visitor); 699 void ProcessInvalidatedCode(ObjectVisitor* visitor);
681 700
701 void StartSweeperThreads();
682 702
683 #ifdef DEBUG 703 #ifdef DEBUG
684 enum CollectorState { 704 enum CollectorState {
685 IDLE, 705 IDLE,
686 PREPARE_GC, 706 PREPARE_GC,
687 MARK_LIVE_OBJECTS, 707 MARK_LIVE_OBJECTS,
688 SWEEP_SPACES, 708 SWEEP_SPACES,
689 ENCODE_FORWARDING_ADDRESSES, 709 ENCODE_FORWARDING_ADDRESSES,
690 UPDATE_POINTERS, 710 UPDATE_POINTERS,
691 RELOCATE_OBJECTS 711 RELOCATE_OBJECTS
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 884
865 friend class Heap; 885 friend class Heap;
866 }; 886 };
867 887
868 888
869 const char* AllocationSpaceName(AllocationSpace space); 889 const char* AllocationSpaceName(AllocationSpace space);
870 890
871 } } // namespace v8::internal 891 } } // namespace v8::internal
872 892
873 #endif // V8_MARK_COMPACT_H_ 893 #endif // V8_MARK_COMPACT_H_
OLDNEW
« no previous file with comments | « src/isolate.cc ('k') | src/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698