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

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

Issue 1957323003: [heap] Add page evacuation mode for new->new (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Switch threshold flag back to 70 Created 4 years, 6 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
« no previous file with comments | « src/heap/heap.cc ('k') | src/heap/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 // 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 <deque> 8 #include <deque>
9 9
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 class MarkCompactCollector { 401 class MarkCompactCollector {
402 public: 402 public:
403 class Evacuator; 403 class Evacuator;
404 404
405 class Sweeper { 405 class Sweeper {
406 public: 406 public:
407 class SweeperTask; 407 class SweeperTask;
408 408
409 enum SweepingMode { SWEEP_ONLY, SWEEP_AND_VISIT_LIVE_OBJECTS }; 409 enum SweepingMode { SWEEP_ONLY, SWEEP_AND_VISIT_LIVE_OBJECTS };
410 enum SkipListRebuildingMode { REBUILD_SKIP_LIST, IGNORE_SKIP_LIST }; 410 enum SkipListRebuildingMode { REBUILD_SKIP_LIST, IGNORE_SKIP_LIST };
411 enum FreeListRebuildingMode { REBUILD_FREE_LIST, IGNORE_FREE_LIST };
411 enum FreeSpaceTreatmentMode { IGNORE_FREE_SPACE, ZAP_FREE_SPACE }; 412 enum FreeSpaceTreatmentMode { IGNORE_FREE_SPACE, ZAP_FREE_SPACE };
412 enum SweepingParallelism { SWEEP_ON_MAIN_THREAD, SWEEP_IN_PARALLEL }; 413 enum SweepingParallelism { SWEEP_ON_MAIN_THREAD, SWEEP_IN_PARALLEL };
413 414
414 typedef std::deque<Page*> SweepingList; 415 typedef std::deque<Page*> SweepingList;
415 typedef List<Page*> SweptList; 416 typedef List<Page*> SweptList;
416 417
417 template <SweepingMode sweeping_mode, SweepingParallelism parallelism, 418 template <SweepingMode sweeping_mode, SweepingParallelism parallelism,
418 SkipListRebuildingMode skip_list_mode, 419 SkipListRebuildingMode skip_list_mode,
420 FreeListRebuildingMode free_list_mode,
419 FreeSpaceTreatmentMode free_space_mode> 421 FreeSpaceTreatmentMode free_space_mode>
420 static int RawSweep(PagedSpace* space, Page* p, ObjectVisitor* v); 422 static int RawSweep(PagedSpace* space, Page* p, ObjectVisitor* v);
421 423
422 explicit Sweeper(Heap* heap) 424 explicit Sweeper(Heap* heap)
423 : heap_(heap), 425 : heap_(heap),
424 pending_sweeper_tasks_semaphore_(0), 426 pending_sweeper_tasks_semaphore_(0),
425 sweeping_in_progress_(false), 427 sweeping_in_progress_(false),
426 late_pages_(false), 428 late_pages_(false),
427 num_sweeping_tasks_(0) {} 429 num_sweeping_tasks_(0) {}
428 430
429 bool sweeping_in_progress() { return sweeping_in_progress_; } 431 bool sweeping_in_progress() { return sweeping_in_progress_; }
430 bool contains_late_pages() { return late_pages_; } 432 bool contains_late_pages() { return late_pages_; }
431 433
432 void AddPage(AllocationSpace space, Page* page); 434 void AddPage(AllocationSpace space, Page* page);
433 void AddLatePage(AllocationSpace space, Page* page); 435 void AddLatePage(AllocationSpace space, Page* page);
434 436
435 int ParallelSweepSpace(AllocationSpace identity, int required_freed_bytes, 437 int ParallelSweepSpace(AllocationSpace identity, int required_freed_bytes,
436 int max_pages = 0); 438 int max_pages = 0);
437 int ParallelSweepPage(Page* page, PagedSpace* space); 439 int ParallelSweepPage(Page* page, AllocationSpace identity);
438 440
439 void StartSweeping(); 441 void StartSweeping();
440 void StartSweepingHelper(AllocationSpace space_to_start); 442 void StartSweepingHelper(AllocationSpace space_to_start);
441 void EnsureCompleted(); 443 void EnsureCompleted();
444 void EnsureNewSpaceCompleted();
442 bool IsSweepingCompleted(); 445 bool IsSweepingCompleted();
443 void SweepOrWaitUntilSweepingCompleted(Page* page); 446 void SweepOrWaitUntilSweepingCompleted(Page* page);
444 447
445 void AddSweptPageSafe(PagedSpace* space, Page* page); 448 void AddSweptPageSafe(PagedSpace* space, Page* page);
446 Page* GetSweptPageSafe(PagedSpace* space); 449 Page* GetSweptPageSafe(PagedSpace* space);
447 450
448 private: 451 private:
449 static const int kAllocationSpaces = LAST_PAGED_SPACE + 1; 452 static const int kAllocationSpaces = LAST_PAGED_SPACE + 1;
450 453
451 template <typename Callback> 454 template <typename Callback>
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 // their space's free list. Active eden semispace is compacted by 787 // their space's free list. Active eden semispace is compacted by
785 // evacuation. 788 // evacuation.
786 // 789 //
787 790
788 // If we are not compacting the heap, we simply sweep the spaces except 791 // If we are not compacting the heap, we simply sweep the spaces except
789 // for the large object space, clearing mark bits and adding unmarked 792 // for the large object space, clearing mark bits and adding unmarked
790 // regions to each space's free list. 793 // regions to each space's free list.
791 void SweepSpaces(); 794 void SweepSpaces();
792 795
793 void EvacuateNewSpacePrologue(); 796 void EvacuateNewSpacePrologue();
794 void EvacuateNewSpaceEpilogue();
795 797
796 void EvacuatePagesInParallel(); 798 void EvacuatePagesInParallel();
797 799
798 // The number of parallel compaction tasks, including the main thread. 800 // The number of parallel compaction tasks, including the main thread.
799 int NumberOfParallelCompactionTasks(int pages, intptr_t live_bytes); 801 int NumberOfParallelCompactionTasks(int pages, intptr_t live_bytes);
800 802
801 void EvacuateNewSpaceAndCandidates(); 803 void EvacuateNewSpaceAndCandidates();
802 804
803 void UpdatePointersAfterEvacuation(); 805 void UpdatePointersAfterEvacuation();
804 806
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 private: 892 private:
891 MarkCompactCollector* collector_; 893 MarkCompactCollector* collector_;
892 }; 894 };
893 895
894 896
895 const char* AllocationSpaceName(AllocationSpace space); 897 const char* AllocationSpaceName(AllocationSpace space);
896 } // namespace internal 898 } // namespace internal
897 } // namespace v8 899 } // namespace v8
898 900
899 #endif // V8_HEAP_MARK_COMPACT_H_ 901 #endif // V8_HEAP_MARK_COMPACT_H_
OLDNEW
« no previous file with comments | « src/heap/heap.cc ('k') | src/heap/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698