Revision: 16648
Author: [email protected]
Date: Wed Sep 11 11:33:18 2013 UTC
Log: Don't align size on allocation granularity for unaligned
ReserveRegion calls.
Also add additional ASSERTs to help tracking the flaky
test-alloc/CodeRange in Windows.
[email protected]
Review URL: https://codereview.chromium.org/23542027
http://code.google.com/p/v8/source/detail?r=16648
Modified:
/branches/bleeding_edge/src/platform/virtual-memory.cc
=======================================
--- /branches/bleeding_edge/src/platform/virtual-memory.cc Wed Sep 11
10:28:09 2013 UTC
+++ /branches/bleeding_edge/src/platform/virtual-memory.cc Wed Sep 11
11:33:18 2013 UTC
@@ -158,7 +158,7 @@
if (size < 64 * KB) {
size = 64 * KB;
}
- size = RoundUp(size, GetAllocationGranularity());
+ size = RoundUp(size, GetPageSize());
LPVOID address = NULL;
// Try and randomize the allocation address (up to three attempts).
for (unsigned attempts = 0; address == NULL && attempts < 3; ++attempts)
{
@@ -189,13 +189,14 @@
ASSERT_NE(NULL, size_return);
ASSERT(IsAligned(alignment, GetAllocationGranularity()));
- size_t reserved_size;
+ size_t reserved_size = RoundUp(size + alignment,
GetAllocationGranularity());
Address reserved_base = static_cast<Address>(
- ReserveRegion(size + alignment, &reserved_size));
+ ReserveRegion(reserved_size, &reserved_size));
if (reserved_base == NULL) {
return NULL;
}
ASSERT_LE(size, reserved_size);
+ ASSERT_LE(size + alignment, reserved_size);
ASSERT(IsAligned(reserved_size, GetPageSize()));
// Try reducing the size by freeing and then reallocating a specific
area.
@@ -218,6 +219,7 @@
}
// Resizing failed, just go with a bigger area.
+ ASSERT(IsAligned(reserved_size, GetAllocationGranularity()));
return ReserveRegion(reserved_size, size_return);
}
@@ -291,6 +293,7 @@
allocation_granularity = system_info.dwAllocationGranularity;
MemoryBarrier();
}
+ ASSERT_GE(allocation_granularity, GetPageSize());
return allocation_granularity;
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.