Don't use LOG() from platform.

All places that use OS::Allocate either CHECK() that the result is non-NULL,
or use a reasonable fallback if they can't mmap memory.

BUG=none
R=mstarzinger@chromium.org
LOG=n

Review URL: https://codereview.chromium.org/326323002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21810 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
jochen@chromium.org 2014-06-12 14:11:27 +00:00
parent 0ffe8b109d
commit 79a9eaf950
8 changed files with 8 additions and 35 deletions

View File

@ -52,10 +52,7 @@ void* OS::Allocate(const size_t requested,
const size_t msize = RoundUp(requested, sysconf(_SC_PAGESIZE));
int prot = PROT_READ | PROT_WRITE | (is_executable ? PROT_EXEC : 0);
void* mbase = mmap(NULL, msize, prot, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (mbase == MAP_FAILED) {
LOG(Isolate::Current(), StringEvent("OS::Allocate", "mmap failed"));
return NULL;
}
if (mbase == MAP_FAILED) return NULL;
*allocated = msize;
return mbase;
}

View File

@ -61,10 +61,7 @@ void* OS::Allocate(const size_t requested,
int prot = PROT_READ | PROT_WRITE | (executable ? PROT_EXEC : 0);
void* mbase = mmap(NULL, msize, prot, MAP_PRIVATE | MAP_ANON, -1, 0);
if (mbase == MAP_FAILED) {
LOG(Isolate::Current(), StringEvent("OS::Allocate", "mmap failed"));
return NULL;
}
if (mbase == MAP_FAILED) return NULL;
*allocated = msize;
return mbase;
}

View File

@ -118,11 +118,7 @@ void* OS::Allocate(const size_t requested,
int prot = PROT_READ | PROT_WRITE | (is_executable ? PROT_EXEC : 0);
void* addr = OS::GetRandomMmapAddr();
void* mbase = mmap(addr, msize, prot, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (mbase == MAP_FAILED) {
LOG(i::Isolate::Current(),
StringEvent("OS::Allocate", "mmap failed"));
return NULL;
}
if (mbase == MAP_FAILED) return NULL;
*allocated = msize;
return mbase;
}

View File

@ -61,10 +61,7 @@ void* OS::Allocate(const size_t requested,
MAP_PRIVATE | MAP_ANON,
kMmapFd,
kMmapFdOffset);
if (mbase == MAP_FAILED) {
LOG(Isolate::Current(), StringEvent("OS::Allocate", "mmap failed"));
return NULL;
}
if (mbase == MAP_FAILED) return NULL;
*allocated = msize;
return mbase;
}

View File

@ -59,11 +59,7 @@ void* OS::Allocate(const size_t requested,
int prot = PROT_READ | PROT_WRITE | (is_executable ? PROT_EXEC : 0);
void* addr = OS::GetRandomMmapAddr();
void* mbase = mmap(addr, msize, prot, MAP_PRIVATE | MAP_ANON, -1, 0);
if (mbase == MAP_FAILED) {
LOG(i::Isolate::Current(),
StringEvent("OS::Allocate", "mmap failed"));
return NULL;
}
if (mbase == MAP_FAILED) return NULL;
*allocated = msize;
return mbase;
}

View File

@ -110,11 +110,7 @@ void* OS::Allocate(const size_t requested,
int prot = PROT_READ | PROT_WRITE | (is_executable ? PROT_EXEC : 0);
void* addr = OS::GetRandomMmapAddr();
void* mbase = mmap(addr, msize, prot, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (mbase == MAP_FAILED) {
LOG(i::Isolate::Current(),
StringEvent("OS::Allocate", "mmap failed"));
return NULL;
}
if (mbase == MAP_FAILED) return NULL;
*allocated = msize;
return mbase;
}

View File

@ -77,10 +77,7 @@ void* OS::Allocate(const size_t requested,
int prot = PROT_READ | PROT_WRITE | (is_executable ? PROT_EXEC : 0);
void* mbase = mmap(NULL, msize, prot, MAP_PRIVATE | MAP_ANON, -1, 0);
if (mbase == MAP_FAILED) {
LOG(Isolate::Current(), StringEvent("OS::Allocate", "mmap failed"));
return NULL;
}
if (mbase == MAP_FAILED) return NULL;
*allocated = msize;
return mbase;
}

View File

@ -766,10 +766,7 @@ void* OS::Allocate(const size_t requested,
MEM_COMMIT | MEM_RESERVE,
prot);
if (mbase == NULL) {
LOG(Isolate::Current(), StringEvent("OS::Allocate", "VirtualAlloc failed"));
return NULL;
}
if (mbase == NULL) return NULL;
ASSERT(IsAligned(reinterpret_cast<size_t>(mbase), OS::AllocateAlignment()));