Commit 96ffe928 authored by Hannes Payer's avatar Hannes Payer Committed by Commit Bot

[heap] Use area_size() when changing the memory protection mode of the...

[heap] Use area_size() when changing the memory protection mode of the allocation area in a MemoryChunk.

Bug: chromium:774108,v8:6792
Change-Id: I6cd280c2c6f159719bea523d1bcf11c290e594f6
Reviewed-on: https://chromium-review.googlesource.com/758359Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Hannes Payer <hpayer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49218}
parent 363d04fc
......@@ -546,10 +546,9 @@ void MemoryChunk::SetReadAndExecutable() {
if (write_unprotect_counter_ == 0) {
Address protect_start =
address() + MemoryAllocator::CodePageAreaStartOffset();
size_t protect_size = size() - MemoryAllocator::CodePageAreaStartOffset();
DCHECK(
IsAddressAligned(protect_start, MemoryAllocator::GetCommitPageSize()));
base::OS::SetReadAndExecutable(protect_start, protect_size);
base::OS::SetReadAndExecutable(protect_start, area_size());
}
}
......@@ -567,10 +566,9 @@ void MemoryChunk::SetReadAndWritable() {
if (write_unprotect_counter_ == 1) {
Address unprotect_start =
address() + MemoryAllocator::CodePageAreaStartOffset();
size_t unprotect_size = size() - MemoryAllocator::CodePageAreaStartOffset();
DCHECK(IsAddressAligned(unprotect_start,
MemoryAllocator::GetCommitPageSize()));
base::OS::SetReadAndWritable(unprotect_start, unprotect_size, false);
base::OS::SetReadAndWritable(unprotect_start, area_size(), false);
}
}
......@@ -587,10 +585,9 @@ void MemoryChunk::SetReadWriteAndExecutable() {
DCHECK_LE(write_unprotect_counter_, 3);
Address unprotect_start =
address() + MemoryAllocator::CodePageAreaStartOffset();
size_t unprotect_size = size() - MemoryAllocator::CodePageAreaStartOffset();
DCHECK(
IsAddressAligned(unprotect_start, MemoryAllocator::GetCommitPageSize()));
base::OS::SetReadWriteAndExecutable(unprotect_start, unprotect_size);
base::OS::SetReadWriteAndExecutable(unprotect_start, area_size());
}
MemoryChunk* MemoryChunk::Initialize(Heap* heap, Address base, size_t size,
......
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