Commit d6f0db8b authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[heap] Remove dead {MemoryChunk::CommitArea} method.

R=hpayer@chromium.org
BUG=v8:6792

Change-Id: Iba360a83c8c1d929c29c0a4e0c5f32cef8755c85
Reviewed-on: https://chromium-review.googlesource.com/758650Reviewed-by: 's avatarHannes Payer <hpayer@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49287}
parent 6c613288
......@@ -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();
......
......@@ -506,8 +506,6 @@ class MemoryChunk {
Address area_end() { return area_end_; }
size_t area_size() { return static_cast<size_t>(area_end() - area_start()); }
bool CommitArea(size_t requested);
// Approximate amount of physical memory committed for this chunk.
size_t CommittedPhysicalMemory();
......
......@@ -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<size_t>(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<size_t>(memory_chunk->area_size()) ==
second_commit_area_size);
memory_allocator->Free<MemoryAllocator::kFull>(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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment