Chromium Code Reviews| 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/base/sys-info.h" | |
| 9 #include "src/heap/spaces.h" | 10 #include "src/heap/spaces.h" |
| 10 | 11 |
| 11 namespace v8 { | 12 namespace v8 { |
| 12 namespace internal { | 13 namespace internal { |
| 13 | 14 |
| 14 // Callback function, returns whether an object is alive. The heap size | 15 // Callback function, returns whether an object is alive. The heap size |
| 15 // of the object is returned in size. It optionally updates the offset | 16 // of the object is returned in size. It optionally updates the offset |
| 16 // to the first live object in the page (only used for old and map objects). | 17 // to the first live object in the page (only used for old and map objects). |
| 17 typedef bool (*IsAliveFunction)(HeapObject* obj, int* size, int* offset); | 18 typedef bool (*IsAliveFunction)(HeapObject* obj, int* size, int* offset); |
| 18 | 19 |
| (...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 702 SlotsBuffer** evacuation_slots_buffer); | 703 SlotsBuffer** evacuation_slots_buffer); |
| 703 | 704 |
| 704 void AddEvacuationSlotsBufferSynchronized( | 705 void AddEvacuationSlotsBufferSynchronized( |
| 705 SlotsBuffer* evacuation_slots_buffer); | 706 SlotsBuffer* evacuation_slots_buffer); |
| 706 | 707 |
| 707 void EvacuatePages(CompactionSpaceCollection* compaction_spaces, | 708 void EvacuatePages(CompactionSpaceCollection* compaction_spaces, |
| 708 SlotsBuffer** evacuation_slots_buffer); | 709 SlotsBuffer** evacuation_slots_buffer); |
| 709 | 710 |
| 710 void EvacuatePagesInParallel(); | 711 void EvacuatePagesInParallel(); |
| 711 | 712 |
| 713 // The number of parallel compaction tasks, including the main thread. | |
| 712 int NumberOfParallelCompactionTasks() { | 714 int NumberOfParallelCompactionTasks() { |
|
Hannes Payer (out of office)
2015/09/23 07:26:03
Implement this in the cc file. That makes it faste
Michael Lippautz
2015/09/23 07:40:50
Done.
| |
| 713 // TODO(hpayer, mlippautz): Figure out some logic to determine the number | 715 if (!FLAG_parallel_compaction) return 1; |
| 714 // of compaction tasks. | 716 // We cap the number of parallel compaction tasks by |
| 715 return 1; | 717 // - (#cores - 1) |
| 718 // - a value depending on the list of evacuation candidates | |
| 719 // - a hard limit | |
|
Hannes Payer (out of office)
2015/09/23 07:26:03
Make the magic limits named constants.
Michael Lippautz
2015/09/23 07:40:50
Done.
| |
| 720 return Min(8, Min(1 + evacuation_candidates_.length() / 4, | |
| 721 Max(1, base::SysInfo::NumberOfProcessors() - 1))); | |
| 716 } | 722 } |
| 717 | 723 |
| 718 void WaitUntilCompactionCompleted(); | 724 void WaitUntilCompactionCompleted(); |
| 719 | 725 |
| 720 void EvacuateNewSpaceAndCandidates(); | 726 void EvacuateNewSpaceAndCandidates(); |
| 721 | 727 |
| 722 void ReleaseEvacuationCandidates(); | 728 void ReleaseEvacuationCandidates(); |
| 723 | 729 |
| 724 // Moves the pages of the evacuation_candidates_ list to the end of their | 730 // Moves the pages of the evacuation_candidates_ list to the end of their |
| 725 // corresponding space pages list. | 731 // corresponding space pages list. |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 850 private: | 856 private: |
| 851 MarkCompactCollector* collector_; | 857 MarkCompactCollector* collector_; |
| 852 }; | 858 }; |
| 853 | 859 |
| 854 | 860 |
| 855 const char* AllocationSpaceName(AllocationSpace space); | 861 const char* AllocationSpaceName(AllocationSpace space); |
| 856 } | 862 } |
| 857 } // namespace v8::internal | 863 } // namespace v8::internal |
| 858 | 864 |
| 859 #endif // V8_HEAP_MARK_COMPACT_H_ | 865 #endif // V8_HEAP_MARK_COMPACT_H_ |
| OLD | NEW |