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

Unified Diff: src/platform-posix.cc

Issue 353113003: Remove dependency from platform files on v8.h (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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 | « src/platform-openbsd.cc ('k') | src/platform-qnx.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform-posix.cc
diff --git a/src/platform-posix.cc b/src/platform-posix.cc
index ae47bd4d3fac7467806729160696ecc908598b25..928edb86a5dc1c397f1c2bc79747dd7a71ef44a7 100644
--- a/src/platform-posix.cc
+++ b/src/platform-posix.cc
@@ -8,6 +8,7 @@
#include <dlfcn.h>
#include <errno.h>
+#include <limits.h>
#include <pthread.h>
#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__)
#include <pthread_np.h> // for pthread_set_name_np
@@ -41,10 +42,13 @@
#include <android/log.h> // NOLINT
#endif
-#include "src/v8.h"
+#include <cmath>
+#include <cstdlib>
#include "src/base/lazy-instance.h"
+#include "src/base/macros.h"
#include "src/platform.h"
+#include "src/platform/time.h"
#include "src/utils/random-number-generator.h"
#ifdef V8_FAST_TLS_SUPPORTED
@@ -54,8 +58,16 @@
namespace v8 {
namespace internal {
+namespace {
+
// 0 is never a valid thread id.
-static const pthread_t kNoThread = (pthread_t) 0;
+const pthread_t kNoThread = (pthread_t) 0;
+
+bool g_hard_abort = false;
+
+const char* g_gc_fake_mmap = NULL;
+
+} // namespace
int OS::NumberOfProcessorsOnline() {
@@ -191,8 +203,18 @@ static base::LazyInstance<RandomNumberGenerator>::type
platform_random_number_generator = LAZY_INSTANCE_INITIALIZER;
-void OS::SetRandomSeed(int64_t seed) {
- platform_random_number_generator.Pointer()->SetSeed(seed);
+void OS::Initialize(int64_t random_seed, bool hard_abort,
+ const char* const gc_fake_mmap) {
+ if (random_seed) {
+ platform_random_number_generator.Pointer()->SetSeed(random_seed);
+ }
+ g_hard_abort = hard_abort;
+ g_gc_fake_mmap = gc_fake_mmap;
+}
+
+
+const char* OS::GetGCFakeMMapFile() {
+ return g_gc_fake_mmap;
}
@@ -253,7 +275,7 @@ void OS::Sleep(int milliseconds) {
void OS::Abort() {
- if (FLAG_hard_abort) {
+ if (g_hard_abort) {
V8_IMMEDIATE_CRASH();
}
// Redirect to std abort to signal abnormal program termination.
« no previous file with comments | « src/platform-openbsd.cc ('k') | src/platform-qnx.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698