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

Add special handling for Windows in DetermineAddressSpaceLimit

On Windows pre 8.1, userspace is limited to 8TB of virtual address
space. Take that into account when determining the size and/or placement
of the virtual memory cage.

Bug: chromium:1218005
Change-Id: Idda94534cad67dc2db77e9ba459e3a4b239dac2a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3222763Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Commit-Queue: Samuel Groß <saelo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77402}
parent ee3b4ead
......@@ -33,6 +33,7 @@ namespace internal {
constexpr int KB = 1024;
constexpr int MB = KB * 1024;
constexpr int GB = MB * 1024;
constexpr int64_t TB = static_cast<int64_t>(GB) * 1024;
// Determine whether we are running in a simulated environment.
// Setting USE_SIMULATOR explicitly from the build script will force
......
......@@ -217,6 +217,14 @@ static Address DetermineAddressSpaceLimit() {
Address userspace_virtual_address_bits = virtual_address_bits - 1;
Address address_space_limit = 1ULL << userspace_virtual_address_bits;
#if defined(V8_OS_WIN_X64)
if (!IsWindows8Point1OrGreater()) {
// On Windows pre 8.1 userspace is limited to 8TB on X64. See
// https://docs.microsoft.com/en-us/windows/win32/memory/memory-limits-for-windows-releases
address_space_limit = 8ULL * TB;
}
#endif // V8_OS_WIN_X64
// TODO(saelo) we could try allocating memory in the upper half of the address
// space to see if it is really usable.
return address_space_limit;
......@@ -257,7 +265,7 @@ bool V8VirtualMemoryCage::Initialize(PageAllocator* page_allocator) {
size_to_reserve = kFakeVirtualMemoryCageMinReservationSize;
create_fake_cage = true;
}
#endif
#endif // V8_OS_WIN
// In any case, the (fake) cage must be at most as large as our address space.
DCHECK_LE(cage_size, address_space_limit);
......
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