Reviewers: Michael Starzinger,
Description:
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
[email protected]
LOG=n
Please review this at https://codereview.chromium.org/326323002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+8, -35 lines):
M src/platform-cygwin.cc
M src/platform-freebsd.cc
M src/platform-linux.cc
M src/platform-macos.cc
M src/platform-openbsd.cc
M src/platform-qnx.cc
M src/platform-solaris.cc
M src/platform-win32.cc
Index: src/platform-cygwin.cc
diff --git a/src/platform-cygwin.cc b/src/platform-cygwin.cc
index
15a59130d0af3e3e0bfec38d98d4ccee7dd22294..e139775dad322057b8a6aac413903d454a49e89e
100644
--- a/src/platform-cygwin.cc
+++ b/src/platform-cygwin.cc
@@ -53,10 +53,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;
}
Index: src/platform-freebsd.cc
diff --git a/src/platform-freebsd.cc b/src/platform-freebsd.cc
index
084e54b3c8579d9d078d5db447bdac795c874efb..0193fcc7e46c5bd37cbf3cbe898c0aabe9a9fa5c
100644
--- a/src/platform-freebsd.cc
+++ b/src/platform-freebsd.cc
@@ -62,10 +62,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;
}
Index: src/platform-linux.cc
diff --git a/src/platform-linux.cc b/src/platform-linux.cc
index
c1e0ca26d428cc52539d28bb116faf0f29c7a9ec..e5a0b0e3f087e6b1b89975e13b931400dcb5e041
100644
--- a/src/platform-linux.cc
+++ b/src/platform-linux.cc
@@ -119,11 +119,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;
}
Index: src/platform-macos.cc
diff --git a/src/platform-macos.cc b/src/platform-macos.cc
index
e7a89f2e3ee0c83618496ae0be429304c97cd839..6535d274b0eac80a9446288946eda1ec0649b4bb
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;
}
Index: src/platform-openbsd.cc
diff --git a/src/platform-openbsd.cc b/src/platform-openbsd.cc
index
3b820bc3d034009adc315fed4e11e77ee679f0c5..6d0507cee6cdd92ed139a44bd0ff2ec221dc608d
100644
--- a/src/platform-openbsd.cc
+++ b/src/platform-openbsd.cc
@@ -60,11 +60,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;
}
Index: src/platform-qnx.cc
diff --git a/src/platform-qnx.cc b/src/platform-qnx.cc
index
4738ef542a291f85eea330cce38848cdb5c47268..883945dbbbe5ddf747d80470597a9437b080c7ea
100644
--- a/src/platform-qnx.cc
+++ b/src/platform-qnx.cc
@@ -111,11 +111,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;
}
Index: src/platform-solaris.cc
diff --git a/src/platform-solaris.cc b/src/platform-solaris.cc
index
8a3e6c66fbf4842012adb23cf215bd8b389f643b..d3cce20069c3ecc125d257d89770b51242be7025
100644
--- a/src/platform-solaris.cc
+++ b/src/platform-solaris.cc
@@ -78,10 +78,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;
}
Index: src/platform-win32.cc
diff --git a/src/platform-win32.cc b/src/platform-win32.cc
index
03fb8b6491aad3d0bc9aba4f4e62c3b7395e9330..cbd7148ff40a72e9a48a4234491696ac9e5e2b2c
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<size_t>(mbase),
OS::AllocateAlignment()));
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.