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

Unified Diff: src/heap/spaces.h

Issue 1614953002: [heap] Cleanup: Remove WAS_SWEPT flag. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/mark-compact.cc ('k') | src/heap/spaces.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/spaces.h
diff --git a/src/heap/spaces.h b/src/heap/spaces.h
index 5c4a70a81be2033a1cc0abb285d4dd09dbdd6bea..76002212021a49c90d8cea40af55d9a9c7650a53 100644
--- a/src/heap/spaces.h
+++ b/src/heap/spaces.h
@@ -307,10 +307,6 @@ class MemoryChunk {
NEVER_EVACUATE, // May contain immortal immutables.
POPULAR_PAGE, // Slots buffer of this page overflowed on the previous GC.
- // WAS_SWEPT indicates that marking bits have been cleared by the sweeper,
- // otherwise marking bits are still intact.
- WAS_SWEPT,
-
// Large objects can have a progress bar in their page header. These object
// are scanned in increments and will be kept black while being scanned.
// Even if the mutator writes to them they will be kept black and a white
@@ -352,16 +348,14 @@ class MemoryChunk {
};
// |kSweepingDone|: The page state when sweeping is complete or sweeping must
- // not be performed on that page.
- // |kSweepingFinalize|: A sweeper thread is done sweeping this page and will
- // not touch the page memory anymore.
- // |kSweepingInProgress|: This page is currently swept by a sweeper thread.
+ // not be performed on that page. Sweeper threads that are done with their
+ // work will set this value and not touch the page anymore.
// |kSweepingPending|: This page is ready for parallel sweeping.
- enum ParallelSweepingState {
+ // |kSweepingInProgress|: This page is currently swept by a sweeper thread.
+ enum ConcurrentSweepingState {
kSweepingDone,
- kSweepingFinalize,
+ kSweepingPending,
kSweepingInProgress,
- kSweepingPending
};
// Every n write barrier invocations we go to runtime even though
@@ -555,8 +549,8 @@ class MemoryChunk {
// Return all current flags.
intptr_t GetFlags() { return flags_; }
- AtomicValue<ParallelSweepingState>& parallel_sweeping_state() {
- return parallel_sweeping_;
+ AtomicValue<ConcurrentSweepingState>& concurrent_sweeping_state() {
+ return concurrent_sweeping_;
}
AtomicValue<ParallelCompactingState>& parallel_compaction_state() {
@@ -567,19 +561,6 @@ class MemoryChunk {
base::Mutex* mutex() { return mutex_; }
- // WaitUntilSweepingCompleted only works when concurrent sweeping is in
- // progress. In particular, when we know that right before this call a
- // sweeper thread was sweeping this page.
- void WaitUntilSweepingCompleted() {
- mutex_->Lock();
- mutex_->Unlock();
- DCHECK(SweepingCompleted());
- }
-
- bool SweepingCompleted() {
- return parallel_sweeping_state().Value() <= kSweepingFinalize;
- }
-
// Manage live byte count (count of bytes known to be live,
// because they are marked black).
void ResetLiveBytes() {
@@ -758,7 +739,7 @@ class MemoryChunk {
AtomicValue<intptr_t> high_water_mark_;
base::Mutex* mutex_;
- AtomicValue<ParallelSweepingState> parallel_sweeping_;
+ AtomicValue<ConcurrentSweepingState> concurrent_sweeping_;
AtomicValue<ParallelCompactingState> parallel_compaction_;
// PagedSpace free-list statistics.
@@ -864,9 +845,18 @@ class Page : public MemoryChunk {
void InitializeAsAnchor(PagedSpace* owner);
- bool WasSwept() { return IsFlagSet(WAS_SWEPT); }
- void SetWasSwept() { SetFlag(WAS_SWEPT); }
- void ClearWasSwept() { ClearFlag(WAS_SWEPT); }
+ // WaitUntilSweepingCompleted only works when concurrent sweeping is in
+ // progress. In particular, when we know that right before this call a
+ // sweeper thread was sweeping this page.
+ void WaitUntilSweepingCompleted() {
+ mutex_->Lock();
+ mutex_->Unlock();
+ DCHECK(SweepingDone());
+ }
+
+ bool SweepingDone() {
+ return concurrent_sweeping_state().Value() == kSweepingDone;
+ }
void ResetFreeListStatistics();
@@ -2076,7 +2066,7 @@ class PagedSpace : public Space {
void IncreaseCapacity(int size);
// Releases an unused page and shrinks the space.
- void ReleasePage(Page* page);
+ void ReleasePage(Page* page, bool evict_free_list_items);
// The dummy page that anchors the linked list of pages.
Page* anchor() { return &anchor_; }
@@ -2103,13 +2093,6 @@ class PagedSpace : public Space {
static void ResetCodeStatistics(Isolate* isolate);
#endif
- // Evacuation candidates are swept by evacuator. Needs to return a valid
- // result before _and_ after evacuation has finished.
- static bool ShouldBeSweptBySweeperThreads(Page* p) {
- return !p->IsEvacuationCandidate() &&
- !p->IsFlagSet(Page::RESCAN_ON_EVACUATION) && !p->WasSwept();
- }
-
// This function tries to steal size_in_bytes memory from the sweeper threads
// free-lists. If it does not succeed stealing enough memory, it will wait
// for the sweeper threads to finish sweeping.
« no previous file with comments | « src/heap/mark-compact.cc ('k') | src/heap/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698