Commit f82b30ce authored by Samuel Groß's avatar Samuel Groß Committed by V8 LUCI CQ

[base] Introduce fast path for AddressSpaceReservation::Allocate

In case the requested permissions are kNoAccess, nothing needs to be
done as the mapping backing an AddressSpaceReservation is always
mapped kNoAccess. This fixes a performance regression on macOS.

Bug: chromium:1287599
Change-Id: I77d80489caf477e29434f9d0a06899746cb9403f
Cq-Include-Trybots: luci.v8.try:v8_linux64_heap_sandbox_dbg_ng,v8_linux_arm64_sim_heap_sandbox_dbg_ng
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3398144Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Commit-Queue: Samuel Groß <saelo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78697}
parent cab1c91c
......@@ -889,6 +889,12 @@ bool AddressSpaceReservation::Allocate(void* address, size_t size,
OS::MemoryPermission access) {
// The region is already mmap'ed, so it just has to be made accessible now.
DCHECK(Contains(address, size));
if (access == OS::MemoryPermission::kNoAccess) {
// Nothing to do. We don't want to call SetPermissions with kNoAccess here
// as that will for example mark the pages as discardable, which is
// probably not desired here.
return true;
}
return OS::SetPermissions(address, size, access);
}
......
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