aboutsummaryrefslogtreecommitdiff
path: root/deps/v8/src/base/platform/platform.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/base/platform/platform.h')
-rw-r--r--deps/v8/src/base/platform/platform.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/deps/v8/src/base/platform/platform.h b/deps/v8/src/base/platform/platform.h
index 23ed123e66..2d08ecbd7f 100644
--- a/deps/v8/src/base/platform/platform.h
+++ b/deps/v8/src/base/platform/platform.h
@@ -272,6 +272,7 @@ class OS {
DISALLOW_IMPLICIT_CONSTRUCTORS(OS);
};
+
// Represents and controls an area of reserved memory.
// Control of the reserved memory can be assigned to another VirtualMemory
// object by assignment or copy-contructing. This removes the reserved memory
@@ -329,6 +330,7 @@ class VirtualMemory {
// inside the allocated region.
void* address = address_;
size_t size = size_;
+ CHECK(InVM(address, size));
Reset();
bool result = ReleaseRegion(address, size);
USE(result);
@@ -360,6 +362,13 @@ class VirtualMemory {
static bool HasLazyCommits();
private:
+ bool InVM(void* address, size_t size) {
+ return (reinterpret_cast<uintptr_t>(address_) <=
+ reinterpret_cast<uintptr_t>(address)) &&
+ ((reinterpret_cast<uintptr_t>(address_) + size_) >=
+ (reinterpret_cast<uintptr_t>(address) + size));
+ }
+
void* address_; // Start address of the virtual memory.
size_t size_; // Size of the virtual memory.
};