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

Side by Side Diff: src/heap/spaces-inl.h

Issue 1896883003: Revert of 🏄 [heap] Add page evacuation mode for new->old (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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/spaces.cc ('k') | test/cctest/heap/test-heap.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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_SPACES_INL_H_ 5 #ifndef V8_HEAP_SPACES_INL_H_
6 #define V8_HEAP_SPACES_INL_H_ 6 #define V8_HEAP_SPACES_INL_H_
7 7
8 #include "src/heap/incremental-marking.h" 8 #include "src/heap/incremental-marking.h"
9 #include "src/heap/spaces.h" 9 #include "src/heap/spaces.h"
10 #include "src/isolate.h" 10 #include "src/isolate.h"
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 DCHECK(!chunk->IsFlagSet(in_to_space ? MemoryChunk::IN_FROM_SPACE 280 DCHECK(!chunk->IsFlagSet(in_to_space ? MemoryChunk::IN_FROM_SPACE
281 : MemoryChunk::IN_TO_SPACE)); 281 : MemoryChunk::IN_TO_SPACE));
282 NewSpacePage* page = static_cast<NewSpacePage*>(chunk); 282 NewSpacePage* page = static_cast<NewSpacePage*>(chunk);
283 heap->incremental_marking()->SetNewSpacePageFlags(page); 283 heap->incremental_marking()->SetNewSpacePageFlags(page);
284 return page; 284 return page;
285 } 285 }
286 286
287 // -------------------------------------------------------------------------- 287 // --------------------------------------------------------------------------
288 // PagedSpace 288 // PagedSpace
289 289
290 template <Page::InitializationMode mode>
291 Page* Page::Initialize(Heap* heap, MemoryChunk* chunk, Executability executable, 290 Page* Page::Initialize(Heap* heap, MemoryChunk* chunk, Executability executable,
292 PagedSpace* owner) { 291 PagedSpace* owner) {
293 Page* page = reinterpret_cast<Page*>(chunk); 292 Page* page = reinterpret_cast<Page*>(chunk);
294 page->mutex_ = new base::Mutex(); 293 page->mutex_ = new base::Mutex();
295 DCHECK(page->area_size() <= kAllocatableMemory); 294 DCHECK(page->area_size() <= kAllocatableMemory);
296 DCHECK(chunk->owner() == owner); 295 DCHECK(chunk->owner() == owner);
297 296
298 owner->IncreaseCapacity(page->area_size()); 297 owner->IncreaseCapacity(page->area_size());
299 heap->incremental_marking()->SetOldSpacePageFlags(chunk); 298 heap->incremental_marking()->SetOldSpacePageFlags(chunk);
300 299
301 // Make sure that categories are initialized before freeing the area. 300 // Make sure that categories are initialized before freeing the area.
302 page->InitializeFreeListCategories(); 301 page->InitializeFreeListCategories();
303 // In the case we do not free the memory, we effectively account for the whole 302 owner->Free(page->area_start(), page->area_size());
304 // page as allocated memory that cannot be used for further allocations.
305 if (mode == kFreeMemory) {
306 owner->Free(page->area_start(), page->area_size());
307 }
308 303
309 return page; 304 return page;
310 } 305 }
311 306
312 Page* Page::Convert(NewSpacePage* old_page, PagedSpace* new_owner) {
313 old_page->set_owner(new_owner);
314 old_page->SetFlags(0, ~0);
315 new_owner->AccountCommitted(old_page->size());
316 Page* new_page = Page::Initialize<kDoNotFreeMemory>(
317 old_page->heap(), old_page, NOT_EXECUTABLE, new_owner);
318 new_page->InsertAfter(new_owner->anchor()->prev_page());
319 return new_page;
320 }
321
322 void Page::InitializeFreeListCategories() { 307 void Page::InitializeFreeListCategories() {
323 for (int i = kFirstCategory; i < kNumberOfCategories; i++) { 308 for (int i = kFirstCategory; i < kNumberOfCategories; i++) {
324 categories_[i].Initialize(static_cast<FreeListCategoryType>(i)); 309 categories_[i].Initialize(static_cast<FreeListCategoryType>(i));
325 } 310 }
326 } 311 }
327 312
328 void MemoryChunk::IncrementLiveBytesFromGC(HeapObject* object, int by) { 313 void MemoryChunk::IncrementLiveBytesFromGC(HeapObject* object, int by) {
329 MemoryChunk::FromAddress(object->address())->IncrementLiveBytes(by); 314 MemoryChunk::FromAddress(object->address())->IncrementLiveBytes(by);
330 } 315 }
331 316
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 other->allocation_info_.Reset(nullptr, nullptr); 729 other->allocation_info_.Reset(nullptr, nullptr);
745 return true; 730 return true;
746 } 731 }
747 return false; 732 return false;
748 } 733 }
749 734
750 } // namespace internal 735 } // namespace internal
751 } // namespace v8 736 } // namespace v8
752 737
753 #endif // V8_HEAP_SPACES_INL_H_ 738 #endif // V8_HEAP_SPACES_INL_H_
OLDNEW
« no previous file with comments | « src/heap/spaces.cc ('k') | test/cctest/heap/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698