Commit 79a9eaf9 authored by jochen@chromium.org's avatar jochen@chromium.org

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
parent 0ffe8b10
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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()));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment