diff options
Diffstat (limited to 'deps/v8/src/platform-solaris.cc')
-rw-r--r-- | deps/v8/src/platform-solaris.cc | 54 |
1 files changed, 12 insertions, 42 deletions
diff --git a/deps/v8/src/platform-solaris.cc b/deps/v8/src/platform-solaris.cc index d46da9652f..85a420350b 100644 --- a/deps/v8/src/platform-solaris.cc +++ b/deps/v8/src/platform-solaris.cc @@ -1,4 +1,4 @@ -// Copyright 2011 the V8 project authors. All rights reserved. +// Copyright 2012 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: @@ -53,8 +53,8 @@ #include "v8.h" #include "platform.h" -#include "vm-state-inl.h" #include "v8threads.h" +#include "vm-state-inl.h" // It seems there is a bug in some Solaris distributions (experienced in @@ -84,33 +84,6 @@ namespace internal { static const pthread_t kNoThread = (pthread_t) 0; -static void* GetRandomMmapAddr() { - Isolate* isolate = Isolate::UncheckedCurrent(); - // Note that the current isolate isn't set up in a call path via - // CpuFeatures::Probe. We don't care about randomization in this case because - // the code page is immediately freed. - if (isolate != NULL) { -#ifdef V8_TARGET_ARCH_X64 - uint64_t rnd1 = V8::RandomPrivate(isolate); - uint64_t rnd2 = V8::RandomPrivate(isolate); - uint64_t raw_addr = (rnd1 << 32) ^ rnd2; - // Currently available CPUs have 48 bits of virtual addressing. Truncate - // the hint address to 46 bits to give the kernel a fighting chance of - // fulfilling our placement request. - raw_addr &= V8_UINT64_C(0x3ffffffff000); -#else - uint32_t raw_addr = V8::RandomPrivate(isolate); - // The range 0x20000000 - 0x60000000 is relatively unpopulated across a - // variety of ASLR modes (PAE kernel, NX compat mode, etc). - raw_addr &= 0x3ffff000; - raw_addr += 0x20000000; -#endif - return reinterpret_cast<void*>(raw_addr); - } - return NULL; -} - - double ceiling(double x) { return ceil(x); } @@ -167,7 +140,7 @@ double OS::LocalTimeOffset() { // We keep the lowest and highest addresses mapped as a quick way of // determining that pointers are outside the heap (used mostly in assertions -// and verification). The estimate is conservative, ie, not all addresses in +// and verification). The estimate is conservative, i.e., not all addresses in // 'allocated' space are actually allocated to our heap. The range is // [lowest, highest), inclusive on the low and and exclusive on the high end. static void* lowest_ever_allocated = reinterpret_cast<void*>(-1); @@ -363,7 +336,7 @@ VirtualMemory::VirtualMemory(size_t size, size_t alignment) ASSERT(IsAligned(alignment, static_cast<intptr_t>(OS::AllocateAlignment()))); size_t request_size = RoundUp(size + alignment, static_cast<intptr_t>(OS::AllocateAlignment())); - void* reservation = mmap(GetRandomMmapAddr(), + void* reservation = mmap(OS::GetRandomMmapAddr(), request_size, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, @@ -429,7 +402,7 @@ bool VirtualMemory::Uncommit(void* address, size_t size) { void* VirtualMemory::ReserveRegion(size_t size) { - void* result = mmap(GetRandomMmapAddr(), + void* result = mmap(OS::GetRandomMmapAddr(), size, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, @@ -480,17 +453,11 @@ class Thread::PlatformData : public Malloced { pthread_t thread_; // Thread handle for pthread. }; -Thread::Thread(const Options& options) - : data_(new PlatformData()), - stack_size_(options.stack_size) { - set_name(options.name); -} - -Thread::Thread(const char* name) +Thread::Thread(const Options& options) : data_(new PlatformData()), - stack_size_(0) { - set_name(name); + stack_size_(options.stack_size()) { + set_name(options.name()); } @@ -737,8 +704,10 @@ class SignalSender : public Thread { FULL_INTERVAL }; + static const int kSignalSenderStackSize = 32 * KB; + explicit SignalSender(int interval) - : Thread("SignalSender"), + : Thread(Thread::Options("SignalSender", kSignalSenderStackSize)), interval_(interval) {} static void InstallSignalHandler() { @@ -870,6 +839,7 @@ class SignalSender : public Thread { static bool signal_handler_installed_; static struct sigaction old_signal_handler_; + private: DISALLOW_COPY_AND_ASSIGN(SignalSender); }; |