From 79a9eaf9503227df246f80de9f2c1a1f1bbd0237 Mon Sep 17 00:00:00 2001 From: "jochen@chromium.org" Date: Thu, 12 Jun 2014 14:11:27 +0000 Subject: [PATCH] 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 --- src/platform-cygwin.cc | 5 +---- src/platform-freebsd.cc | 5 +---- src/platform-linux.cc | 6 +----- src/platform-macos.cc | 5 +---- src/platform-openbsd.cc | 6 +----- src/platform-qnx.cc | 6 +----- src/platform-solaris.cc | 5 +---- src/platform-win32.cc | 5 +---- 8 files changed, 8 insertions(+), 35 deletions(-) diff --git a/src/platform-cygwin.cc b/src/platform-cygwin.cc index 1502858..35c65c7 100644 --- a/src/platform-cygwin.cc +++ b/src/platform-cygwin.cc @@ -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; } diff --git a/src/platform-freebsd.cc b/src/platform-freebsd.cc index 3ae2c58..ba59678 100644 --- a/src/platform-freebsd.cc +++ b/src/platform-freebsd.cc @@ -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; } diff --git a/src/platform-linux.cc b/src/platform-linux.cc index f982d01..ee0b951 100644 --- a/src/platform-linux.cc +++ b/src/platform-linux.cc @@ -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; } diff --git a/src/platform-macos.cc b/src/platform-macos.cc index e7a89f2..6535d27 100644 --- a/src/platform-macos.cc +++ b/src/platform-macos.cc @@ -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; } diff --git a/src/platform-openbsd.cc b/src/platform-openbsd.cc index 8b426dd..c0b5aae 100644 --- a/src/platform-openbsd.cc +++ b/src/platform-openbsd.cc @@ -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; } diff --git a/src/platform-qnx.cc b/src/platform-qnx.cc index 66ffb0c..19ce885 100644 --- a/src/platform-qnx.cc +++ b/src/platform-qnx.cc @@ -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; } diff --git a/src/platform-solaris.cc b/src/platform-solaris.cc index 8fc923a..fe1f9da 100644 --- a/src/platform-solaris.cc +++ b/src/platform-solaris.cc @@ -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; } diff --git a/src/platform-win32.cc b/src/platform-win32.cc index 1caadbe..52888fe 100644 --- a/src/platform-win32.cc +++ b/src/platform-win32.cc @@ -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(mbase), OS::AllocateAlignment())); -- 2.7.4