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

Unified Diff: src/platform-cygwin.cc

Issue 14162004: Unified the structure of VirtualMemory implementations across platforms a bit. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 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/platform-freebsd.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform-cygwin.cc
diff --git a/src/platform-cygwin.cc b/src/platform-cygwin.cc
index 042b2e54dea4b7ac706991516dc85e94ad5bd2ae..418a05e226148bb4b28fedb627d8eb62d195b7f8 100644
--- a/src/platform-cygwin.cc
+++ b/src/platform-cygwin.cc
@@ -319,15 +319,11 @@ int OS::StackWalk(Vector<OS::StackFrame> frames) {
// This causes VirtualMemory::Commit to not always commit the memory region
// specified.
-bool VirtualMemory::IsReserved() {
- return address_ != NULL;
-}
+VirtualMemory::VirtualMemory() : address_(NULL), size_(0) { }
-VirtualMemory::VirtualMemory(size_t size) {
- address_ = VirtualAlloc(NULL, size, MEM_RESERVE, PAGE_NOACCESS);
- size_ = size;
-}
+VirtualMemory::VirtualMemory(size_t size)
+ : address_(ReserveRegion(size)), size_(size) { }
VirtualMemory::~VirtualMemory() {
@@ -337,6 +333,17 @@ VirtualMemory::~VirtualMemory() {
}
+bool VirtualMemory::IsReserved() {
+ return address_ != NULL;
+}
+
+
+void VirtualMemory::Reset() {
+ address_ = NULL;
+ size_ = 0;
+}
+
+
bool VirtualMemory::Commit(void* address, size_t size, bool is_executable) {
int prot = is_executable ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE;
if (NULL == VirtualAlloc(address, size, MEM_COMMIT, prot)) {
@@ -365,6 +372,29 @@ bool VirtualMemory::Guard(void* address) {
}
+void* VirtualMemory::ReserveRegion(size_t size) {
+ return VirtualAlloc(NULL, size, MEM_RESERVE, PAGE_NOACCESS);
+}
+
+
+bool VirtualMemory::CommitRegion(void* base, size_t size, bool is_executable) {
+ UNIMPLEMENTED();
+ return false;
+}
+
+
+bool VirtualMemory::UncommitRegion(void* base, size_t size) {
+ UNIMPLEMENTED();
+ return false;
+}
+
+
+bool VirtualMemory::ReleaseRegion(void* base, size_t size) {
+ UNIMPLEMENTED();
+ return false;
+}
+
+
bool VirtualMemory::HasLazyCommits() {
// TODO(alph): implement for the platform.
return false;
« no previous file with comments | « no previous file | src/platform-freebsd.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698