diff --git a/src/heap/spaces.cc b/src/heap/spaces.cc index 3e626a6015..8f3323025c 100644 --- a/src/heap/spaces.cc +++ b/src/heap/spaces.cc @@ -691,56 +691,6 @@ Page* Page::ConvertNewToOld(Page* old_page) { return new_page; } -// Commit MemoryChunk area to the requested size. -bool MemoryChunk::CommitArea(size_t requested) { - size_t guard_size = - IsFlagSet(IS_EXECUTABLE) ? MemoryAllocator::CodePageGuardSize() : 0; - size_t header_size = area_start() - address() - guard_size; - size_t commit_size = - ::RoundUp(header_size + requested, MemoryAllocator::GetCommitPageSize()); - size_t committed_size = ::RoundUp(header_size + (area_end() - area_start()), - MemoryAllocator::GetCommitPageSize()); - - if (commit_size > committed_size) { - // Commit size should be less or equal than the reserved size. - DCHECK(commit_size <= size() - 2 * guard_size); - // Append the committed area. - Address start = address() + committed_size + guard_size; - size_t length = commit_size - committed_size; - if (reservation_.IsReserved()) { - Executability executable = - IsFlagSet(IS_EXECUTABLE) ? EXECUTABLE : NOT_EXECUTABLE; - if (!heap()->memory_allocator()->CommitMemory(start, length, - executable)) { - return false; - } - } else { - CodeRange* code_range = heap_->memory_allocator()->code_range(); - DCHECK(code_range->valid() && IsFlagSet(IS_EXECUTABLE)); - if (!code_range->CommitRawMemory(start, length)) return false; - } - - if (Heap::ShouldZapGarbage()) { - heap_->memory_allocator()->ZapBlock(start, length); - } - } else if (commit_size < committed_size) { - DCHECK_LT(0, commit_size); - // Shrink the committed area. - size_t length = committed_size - commit_size; - Address start = address() + committed_size + guard_size - length; - if (reservation_.IsReserved()) { - if (!reservation_.Uncommit(start, length)) return false; - } else { - CodeRange* code_range = heap_->memory_allocator()->code_range(); - DCHECK(code_range->valid() && IsFlagSet(IS_EXECUTABLE)); - if (!code_range->UncommitRawMemory(start, length)) return false; - } - } - - area_end_ = area_start_ + requested; - return true; -} - size_t MemoryChunk::CommittedPhysicalMemory() { if (!base::OS::HasLazyCommits() || owner()->identity() == LO_SPACE) return size(); diff --git a/src/heap/spaces.h b/src/heap/spaces.h index 093ddb2e81..f59a6a19be 100644 --- a/src/heap/spaces.h +++ b/src/heap/spaces.h @@ -506,8 +506,6 @@ class MemoryChunk { Address area_end() { return area_end_; } size_t area_size() { return static_cast(area_end() - area_start()); } - bool CommitArea(size_t requested); - // Approximate amount of physical memory committed for this chunk. size_t CommittedPhysicalMemory(); diff --git a/test/cctest/heap/test-spaces.cc b/test/cctest/heap/test-spaces.cc index 222c592b15..d9deb10475 100644 --- a/test/cctest/heap/test-spaces.cc +++ b/test/cctest/heap/test-spaces.cc @@ -85,7 +85,6 @@ static void VerifyMemoryChunk(Isolate* isolate, CodeRange* code_range, size_t reserve_area_size, size_t commit_area_size, - size_t second_commit_area_size, Executability executable) { MemoryAllocator* memory_allocator = new MemoryAllocator(isolate); CHECK(memory_allocator->SetUp(heap->MaxReserved(), 0)); @@ -117,17 +116,6 @@ static void VerifyMemoryChunk(Isolate* isolate, memory_chunk->address() + memory_chunk->size()); CHECK(static_cast(memory_chunk->area_size()) == commit_area_size); - Address area_start = memory_chunk->area_start(); - - memory_chunk->CommitArea(second_commit_area_size); - CHECK(area_start == memory_chunk->area_start()); - CHECK(memory_chunk->area_start() < - memory_chunk->address() + memory_chunk->size()); - CHECK(memory_chunk->area_end() <= - memory_chunk->address() + memory_chunk->size()); - CHECK(static_cast(memory_chunk->area_size()) == - second_commit_area_size); - memory_allocator->Free(memory_chunk); } memory_allocator->TearDown(); @@ -181,11 +169,10 @@ TEST(MemoryChunk) { Heap* heap = isolate->heap(); size_t reserve_area_size = 1 * MB; - size_t initial_commit_area_size, second_commit_area_size; + size_t initial_commit_area_size; for (int i = 0; i < 100; i++) { initial_commit_area_size = PseudorandomAreaSize(); - second_commit_area_size = PseudorandomAreaSize(); // With CodeRange. CodeRange* code_range = new CodeRange(isolate); @@ -197,7 +184,6 @@ TEST(MemoryChunk) { code_range, reserve_area_size, initial_commit_area_size, - second_commit_area_size, EXECUTABLE); VerifyMemoryChunk(isolate, @@ -205,7 +191,6 @@ TEST(MemoryChunk) { code_range, reserve_area_size, initial_commit_area_size, - second_commit_area_size, NOT_EXECUTABLE); delete code_range; @@ -216,7 +201,6 @@ TEST(MemoryChunk) { code_range, reserve_area_size, initial_commit_area_size, - second_commit_area_size, EXECUTABLE); VerifyMemoryChunk(isolate, @@ -224,7 +208,6 @@ TEST(MemoryChunk) { code_range, reserve_area_size, initial_commit_area_size, - second_commit_area_size, NOT_EXECUTABLE); delete code_range; }