Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Unified Diff: src/base/platform/platform.h

Issue 2101383002: [heap] Reland uncommit unused large object page memory. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/base/hashmap.h ('k') | src/base/platform/platform-linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/base/platform/platform.h
diff --git a/src/base/platform/platform.h b/src/base/platform/platform.h
index 9464fb11231dbcd59efed2846ff4d4894681f83f..d3b6c9c1cf3d758276ccc39c50a20b51fc9f9f98 100644
--- a/src/base/platform/platform.h
+++ b/src/base/platform/platform.h
@@ -337,6 +337,23 @@ class VirtualMemory {
// Creates a single guard page at the given address.
bool Guard(void* address);
+ // Releases the memory after |free_start|.
+ void ReleasePartial(void* free_start) {
+ DCHECK(IsReserved());
+ // Notice: Order is important here. The VirtualMemory object might live
+ // inside the allocated region.
+ size_t size = size_ - (reinterpret_cast<size_t>(free_start) -
+ reinterpret_cast<size_t>(address_));
+ CHECK(InVM(free_start, size));
+ DCHECK_LT(address_, free_start);
+ DCHECK_LT(free_start, reinterpret_cast<void*>(
+ reinterpret_cast<size_t>(address_) + size_));
+ bool result = ReleasePartialRegion(address_, size_, free_start, size);
+ USE(result);
+ DCHECK(result);
+ size_ -= size;
+ }
+
void Release() {
DCHECK(IsReserved());
// Notice: Order is important here. The VirtualMemory object might live
@@ -369,6 +386,12 @@ class VirtualMemory {
// and the same size it was reserved with.
static bool ReleaseRegion(void* base, size_t size);
+ // Must be called with a base pointer that has been returned by ReserveRegion
+ // and the same size it was reserved with.
+ // [free_start, free_start + free_size] is the memory that will be released.
+ static bool ReleasePartialRegion(void* base, size_t size, void* free_start,
+ size_t free_size);
+
// Returns true if OS performs lazy commits, i.e. the memory allocation call
// defers actual physical memory allocation till the first memory access.
// Otherwise returns false.
« no previous file with comments | « src/base/hashmap.h ('k') | src/base/platform/platform-linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698