V8: Don't use mprotect on Cygwin as virtual memory is managed directly via WinAPI calls.

Upstream fix: http://codereview.chromium.org/7549009
pull/22966/head
Bert Belder 2011-08-02 18:34:11 +02:00
parent 91ecfbcae8
commit a962cca390
2 changed files with 8 additions and 0 deletions

View File

@ -166,6 +166,12 @@ void OS::Free(void* address, const size_t size) {
} }
void OS::Guard(void* address, const size_t size) {
DWORD oldprotect;
VirtualProtect(address, size, PAGE_READONLY | PAGE_GUARD, &oldprotect);
}
void OS::Sleep(int milliseconds) { void OS::Sleep(int milliseconds) {
unsigned int ms = static_cast<unsigned int>(milliseconds); unsigned int ms = static_cast<unsigned int>(milliseconds);
usleep(1000 * ms); usleep(1000 * ms);

View File

@ -70,10 +70,12 @@ intptr_t OS::MaxVirtualMemory() {
} }
#ifndef __CYGWIN__
// Create guard pages. // Create guard pages.
void OS::Guard(void* address, const size_t size) { void OS::Guard(void* address, const size_t size) {
mprotect(address, size, PROT_NONE); mprotect(address, size, PROT_NONE);
} }
#endif // __CYGWIN__
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------