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

Unified Diff: src/heap/spaces.cc

Issue 1686413002: [heap] Cleanup MemoryChunk's declarations (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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 ea2adc5e27cfbc2cd46e098ac7b8a46b00a62411..05eb239f048cad98093781f36a39cfa1cf5fd97c 100644
--- a/src/heap/spaces.cc
+++ b/src/heap/spaces.cc
@@ -428,7 +428,7 @@ NewSpacePage* NewSpacePage::Initialize(Heap* heap, Address start,
MemoryChunk* chunk =
MemoryChunk::Initialize(heap, start, Page::kPageSize, area_start,
- area_end, NOT_EXECUTABLE, semi_space);
+ area_end, NOT_EXECUTABLE, semi_space, nullptr);
bool in_to_space = (semi_space->id() != kFromSpace);
chunk->SetFlag(in_to_space ? MemoryChunk::IN_TO_SPACE
: MemoryChunk::IN_FROM_SPACE);
@@ -449,10 +449,10 @@ void NewSpacePage::InitializeAsAnchor(SemiSpace* semi_space) {
SetFlags(0, ~0);
}
-
MemoryChunk* MemoryChunk::Initialize(Heap* heap, Address base, size_t size,
Address area_start, Address area_end,
- Executability executable, Space* owner) {
+ Executability executable, Space* owner,
+ base::VirtualMemory* reservation) {
MemoryChunk* chunk = FromAddress(base);
DCHECK(base == chunk->address());
@@ -490,6 +490,10 @@ MemoryChunk* MemoryChunk::Initialize(Heap* heap, Address base, size_t size,
chunk->SetFlag(IS_EXECUTABLE);
}
+ if (reservation != nullptr) {
+ chunk->reservation_.TakeControl(reservation);
+ }
+
return chunk;
}
@@ -691,10 +695,8 @@ MemoryChunk* MemoryAllocator::AllocateChunk(intptr_t reserve_area_size,
PerformAllocationCallback(space, kAllocationActionAllocate, chunk_size);
}
- MemoryChunk* result = MemoryChunk::Initialize(
- heap, base, chunk_size, area_start, area_end, executable, owner);
- result->set_reserved_memory(&reservation);
- return result;
+ return MemoryChunk::Initialize(heap, base, chunk_size, area_start, area_end,
+ executable, owner, &reservation);
}
@@ -920,19 +922,13 @@ bool MemoryAllocator::CommitExecutableMemory(base::VirtualMemory* vm,
// -----------------------------------------------------------------------------
// MemoryChunk implementation
-void MemoryChunk::IncrementLiveBytesFromMutator(HeapObject* object, int by) {
- MemoryChunk* chunk = MemoryChunk::FromAddress(object->address());
- if (!chunk->InNewSpace() && !static_cast<Page*>(chunk)->SweepingDone()) {
- static_cast<PagedSpace*>(chunk->owner())->Allocate(by);
- }
- chunk->IncrementLiveBytes(by);
-}
-
-
void MemoryChunk::ReleaseAllocatedMemory() {
delete slots_buffer_;
+ slots_buffer_ = nullptr;
delete skip_list_;
+ skip_list_ = nullptr;
delete mutex_;
+ mutex_ = nullptr;
ReleaseOldToNewSlots();
}
« 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