| Index: src/heap/spaces.cc
|
| diff --git a/src/heap/spaces.cc b/src/heap/spaces.cc
|
| index bffde49c5c5e54ef855ba30acd62e08f12548a9d..8982a2953273abbe35993b57ab63ee43d42ae0d7 100644
|
| --- a/src/heap/spaces.cc
|
| +++ b/src/heap/spaces.cc
|
| @@ -1484,9 +1484,8 @@
|
|
|
| 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);
|
| @@ -1587,16 +1586,8 @@
|
| 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);
|
| @@ -1922,6 +1913,9 @@
|
| }
|
| Reset();
|
| AccountCommitted(current_capacity_);
|
| + if (age_mark_ == nullptr) {
|
| + age_mark_ = first_page()->area_start();
|
| + }
|
| committed_ = true;
|
| return true;
|
| }
|
| @@ -2033,7 +2027,7 @@
|
| 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);
|
| @@ -2076,6 +2070,7 @@
|
| 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_);
|
| @@ -2084,39 +2079,16 @@
|
| 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);
|
| + }
|
| +}
|
| +
|
|
|
| #ifdef DEBUG
|
| void SemiSpace::Print() {}
|
|
|