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

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

Issue 1325853003: [heap,cctest] Fix CodeRange tests that call AllocateRawMemory directly. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix 2nd half of test-spaces/Regress3540 ;) Created 5 years, 4 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 | « no previous file | 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 23ed123e66b51ee853d007da460f7b5d9e112ba4..aa30519506d691b8df57969aec2a8bddfe981831 100644
--- a/src/base/platform/platform.h
+++ b/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<intptr_t>(address_) <=
+ reinterpret_cast<intptr_t>(address)) &&
+ (reinterpret_cast<intptr_t>(address_) + size_ >=
+ reinterpret_cast<intptr_t>(address) + size);
+ }
+
void* address_; // Start address of the virtual memory.
size_t size_; // Size of the virtual memory.
};
« no previous file with comments | « no previous file | src/base/platform/platform-linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698