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

Unified Diff: src/heap/spaces.cc

Issue 2383443002: Revert of [heap] Remove border page (Closed)
Patch Set: Created 4 years, 3 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/spaces.h ('k') | src/heap/spaces-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/spaces.cc
diff --git a/src/heap/spaces.cc b/src/heap/spaces.cc
index 525e78461edf19e05f16d50e2b8ff6f25879df4d..daaf9ad0a0636ef463421d854497bc84687d2eec 100644
--- a/src/heap/spaces.cc
+++ b/src/heap/spaces.cc
@@ -1489,9 +1489,8 @@ void PagedSpace::Verify(ObjectVisitor* visitor) {
bool NewSpace::SetUp(int initial_semispace_capacity,
int maximum_semispace_capacity) {
- DCHECK_LE(initial_semispace_capacity, maximum_semispace_capacity);
+ DCHECK(initial_semispace_capacity <= maximum_semispace_capacity);
DCHECK(base::bits::IsPowerOfTwo32(maximum_semispace_capacity));
- DCHECK_GE(initial_semispace_capacity, 2 * Page::kPageSize);
to_space_.SetUp(initial_semispace_capacity, maximum_semispace_capacity);
from_space_.SetUp(initial_semispace_capacity, maximum_semispace_capacity);
@@ -1592,16 +1591,8 @@ bool SemiSpace::EnsureCurrentCapacity() {
current_page = current_page->next_page();
if (actual_pages > expected_pages) {
Page* to_remove = current_page->prev_page();
- if (to_remove == current_page_) {
- // Corner case: All pages have been moved within new space. We are
- // removing the page that contains the top pointer and need to set
- // it to the end of the intermediate generation.
- NewSpace* new_space = heap()->new_space();
- CHECK_EQ(new_space->top(), current_page_->area_start());
- current_page_ = to_remove->prev_page();
- CHECK(current_page_->InIntermediateGeneration());
- new_space->SetAllocationInfo(page_high(), page_high());
- }
+ // Make sure we don't overtake the actual top pointer.
+ CHECK_NE(to_remove, current_page_);
to_remove->Unlink();
heap()->memory_allocator()->Free<MemoryAllocator::kPooledAndQueue>(
to_remove);
@@ -1931,6 +1922,9 @@ bool SemiSpace::Commit() {
}
Reset();
AccountCommitted(current_capacity_);
+ if (age_mark_ == nullptr) {
+ age_mark_ = first_page()->area_start();
+ }
committed_ = true;
return true;
}
@@ -2042,7 +2036,7 @@ void SemiSpace::FixPagesFlags(intptr_t flags, intptr_t mask) {
if (id_ == kToSpace) {
page->ClearFlag(MemoryChunk::IN_FROM_SPACE);
page->SetFlag(MemoryChunk::IN_TO_SPACE);
- page->ClearFlag(MemoryChunk::IN_INTERMEDIATE_GENERATION);
+ page->ClearFlag(MemoryChunk::NEW_SPACE_BELOW_AGE_MARK);
page->ResetLiveBytes();
} else {
page->SetFlag(MemoryChunk::IN_FROM_SPACE);
@@ -2085,6 +2079,7 @@ void SemiSpace::Swap(SemiSpace* from, SemiSpace* to) {
std::swap(from->current_capacity_, to->current_capacity_);
std::swap(from->maximum_capacity_, to->maximum_capacity_);
std::swap(from->minimum_capacity_, to->minimum_capacity_);
+ std::swap(from->age_mark_, to->age_mark_);
std::swap(from->committed_, to->committed_);
std::swap(from->anchor_, to->anchor_);
std::swap(from->current_page_, to->current_page_);
@@ -2093,37 +2088,12 @@ void SemiSpace::Swap(SemiSpace* from, SemiSpace* to) {
from->FixPagesFlags(0, 0);
}
-void NewSpace::SealIntermediateGeneration() {
- fragmentation_in_intermediate_generation_ = 0;
- const Address mark = top();
-
- if (mark == to_space_.space_start()) {
- // Do not mark any pages as being part of the intermediate generation if no
- // objects got moved.
- return;
- }
-
- for (Page* p : NewSpacePageRange(to_space_.space_start(), mark)) {
- p->SetFlag(MemoryChunk::IN_INTERMEDIATE_GENERATION);
- }
-
- Page* p = Page::FromAllocationAreaAddress(mark);
- if (mark < p->area_end()) {
- heap()->CreateFillerObjectAt(mark, static_cast<int>(p->area_end() - mark),
- ClearRecordedSlots::kNo);
- fragmentation_in_intermediate_generation_ =
- static_cast<size_t>(p->area_end() - mark);
- DCHECK_EQ(to_space_.current_page(), p);
- if (to_space_.AdvancePage()) {
- UpdateAllocationInfo();
- } else {
- allocation_info_.Reset(to_space_.page_high(), to_space_.page_high());
- }
- }
- if (FLAG_trace_gc_verbose) {
- PrintIsolate(heap()->isolate(),
- "Sealing intermediate generation: bytes_lost=%zu\n",
- fragmentation_in_intermediate_generation_);
+void SemiSpace::set_age_mark(Address mark) {
+ DCHECK_EQ(Page::FromAllocationAreaAddress(mark)->owner(), this);
+ age_mark_ = mark;
+ // Mark all pages up to the one containing mark.
+ for (Page* p : NewSpacePageRange(space_start(), mark)) {
+ p->SetFlag(MemoryChunk::NEW_SPACE_BELOW_AGE_MARK);
}
}
« no previous file with comments | « src/heap/spaces.h ('k') | src/heap/spaces-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698