Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Unified Diff: src/base/platform/platform-linux.cc

Issue 521473003: More PNaCL fixes (without GYP/Makefile tweaks) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/base/platform/platform-posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/base/platform/platform-linux.cc
diff --git a/src/base/platform/platform-linux.cc b/src/base/platform/platform-linux.cc
index fca170916c4c9b63cb7555da6d2989fc306e2913..41f3315f5b18e0c3fb08dc7c6f136fb5cece5f82 100644
--- a/src/base/platform/platform-linux.cc
+++ b/src/base/platform/platform-linux.cc
@@ -9,9 +9,7 @@
#include <semaphore.h>
#include <signal.h>
#include <stdlib.h>
-#include <sys/prctl.h>
#include <sys/resource.h>
-#include <sys/syscall.h>
#include <sys/time.h>
#include <sys/types.h>
@@ -46,6 +44,15 @@
#include "src/base/macros.h"
#include "src/base/platform/platform.h"
+#if V8_OS_NACL
+#if !defined(MAP_NORESERVE)
+// PNaCL doesn't have this, so we always grab all of the memory, which is bad.
+#define MAP_NORESERVE 0
+#endif
+#else
+#include <sys/prctl.h>
+#include <sys/syscall.h>
+#endif
namespace v8 {
namespace base {
@@ -95,20 +102,30 @@ bool OS::ArmUsingHardFloat() {
const char* OS::LocalTimezone(double time, TimezoneCache* cache) {
+#if V8_OS_NACL
+ // Missing support for tm_zone field.
+ return "";
+#else
if (std::isnan(time)) return "";
time_t tv = static_cast<time_t>(std::floor(time/msPerSecond));
struct tm* t = localtime(&tv);
if (NULL == t) return "";
return t->tm_zone;
+#endif
}
double OS::LocalTimeOffset(TimezoneCache* cache) {
+#if V8_OS_NACL
+ // Missing support for tm_zone field.
+ return 0;
+#else
time_t tv = time(NULL);
struct tm* t = localtime(&tv);
// tm_gmtoff includes any daylight savings offset, so subtract it.
return static_cast<double>(t->tm_gmtoff * msPerSecond -
(t->tm_isdst > 0 ? 3600 * msPerSecond : 0));
+#endif
}
@@ -260,18 +277,15 @@ void OS::SignalCodeMovingGC() {
OS::PrintError("Failed to open %s\n", OS::GetGCFakeMMapFile());
OS::Abort();
}
- void* addr = mmap(OS::GetRandomMmapAddr(),
- size,
-#if defined(__native_client__)
+ void* addr = mmap(OS::GetRandomMmapAddr(), size,
+#if V8_OS_NACL
// The Native Client port of V8 uses an interpreter,
// so code pages don't need PROT_EXEC.
PROT_READ,
#else
PROT_READ | PROT_EXEC,
#endif
- MAP_PRIVATE,
- fileno(f),
- 0);
+ MAP_PRIVATE, fileno(f), 0);
DCHECK(addr != MAP_FAILED);
OS::Free(addr, size);
fclose(f);
@@ -387,7 +401,7 @@ void* VirtualMemory::ReserveRegion(size_t size) {
bool VirtualMemory::CommitRegion(void* base, size_t size, bool is_executable) {
-#if defined(__native_client__)
+#if V8_OS_NACL
// The Native Client port of V8 uses an interpreter,
// so code pages don't need PROT_EXEC.
int prot = PROT_READ | PROT_WRITE;
« no previous file with comments | « no previous file | src/base/platform/platform-posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698