Index: src/platform-linux.cc |
diff --git a/src/platform-linux.cc b/src/platform-linux.cc |
index 5425a16e3c6cabfbb663716d44c090cadf65ce03..ba6ce0631b11a4781d7b2530ca8f2ca2e9db353c 100644 |
--- a/src/platform-linux.cc |
+++ b/src/platform-linux.cc |
@@ -76,29 +76,10 @@ |
namespace v8 { |
namespace internal { |
-// 0 is never a valid thread id on Linux since tids and pids share a |
-// name space and pid 0 is reserved (see man 2 kill). |
-static const pthread_t kNoThread = (pthread_t) 0; |
- |
- |
-double ceiling(double x) { |
- return ceil(x); |
-} |
- |
static Mutex* limit_mutex = NULL; |
-void OS::PostSetUp() { |
- POSIXPostSetUp(); |
-} |
- |
- |
-uint64_t OS::CpuFeaturesImpliedByPlatform() { |
- return 0; // Linux runs on anything. |
-} |
- |
- |
#ifdef __arm__ |
static bool CPUInfoContainsString(const char * search_string) { |
const char* file_name = "/proc/cpuinfo"; |
@@ -328,20 +309,6 @@ bool OS::MipsCpuHasFeature(CpuFeature feature) { |
#endif // def __mips__ |
-int OS::ActivationFrameAlignment() { |
-#if V8_TARGET_ARCH_ARM |
- // On EABI ARM targets this is required for fp correctness in the |
- // runtime system. |
- return 8; |
-#elif V8_TARGET_ARCH_MIPS |
- return 8; |
-#endif |
- // With gcc 4.4 the tree vectorization optimizer can generate code |
- // that requires 16 byte alignment such as movdqa on x86. |
- return 16; |
-} |
- |
- |
const char* OS::LocalTimezone(double time) { |
if (std::isnan(time)) return ""; |
time_t tv = static_cast<time_t>(floor(time/msPerSecond)); |
@@ -385,11 +352,6 @@ bool OS::IsOutsideAllocatedSpace(void* address) { |
} |
-size_t OS::AllocateAlignment() { |
- return sysconf(_SC_PAGESIZE); |
-} |
- |
- |
void* OS::Allocate(const size_t requested, |
size_t* allocated, |
bool is_executable) { |
@@ -408,51 +370,6 @@ void* OS::Allocate(const size_t requested, |
} |
-void OS::Free(void* address, const size_t size) { |
- // TODO(1240712): munmap has a return value which is ignored here. |
- int result = munmap(address, size); |
- USE(result); |
- ASSERT(result == 0); |
-} |
- |
- |
-void OS::Sleep(int milliseconds) { |
- unsigned int ms = static_cast<unsigned int>(milliseconds); |
- usleep(1000 * ms); |
-} |
- |
- |
-int OS::NumberOfCores() { |
- return sysconf(_SC_NPROCESSORS_ONLN); |
-} |
- |
- |
-void OS::Abort() { |
- // Redirect to std abort to signal abnormal program termination. |
- if (FLAG_break_on_abort) { |
- DebugBreak(); |
- } |
- abort(); |
-} |
- |
- |
-void OS::DebugBreak() { |
-// TODO(lrn): Introduce processor define for runtime system (!= V8_ARCH_x, |
-// which is the architecture of generated code). |
-#if defined(__arm__) || defined(__thumb__) |
- asm("bkpt 0"); |
-#elif defined(__aarch64__) |
- asm("brk 0"); |
-#elif defined(__mips__) |
- asm("break"); |
-#elif defined(__native_client__) |
- asm("hlt"); |
-#else |
- asm("int $3"); |
-#endif |
-} |
- |
- |
void OS::DumpBacktrace() { |
// backtrace is a glibc extension. |
#if defined(__GLIBC__) && !defined(__UCLIBC__) |
@@ -767,101 +684,6 @@ bool VirtualMemory::HasLazyCommits() { |
} |
-class Thread::PlatformData : public Malloced { |
- public: |
- PlatformData() : thread_(kNoThread) {} |
- |
- pthread_t thread_; // Thread handle for pthread. |
-}; |
- |
-Thread::Thread(const Options& options) |
- : data_(new PlatformData()), |
- stack_size_(options.stack_size()), |
- start_semaphore_(NULL) { |
- set_name(options.name()); |
-} |
- |
- |
-Thread::~Thread() { |
- delete data_; |
-} |
- |
- |
-static void* ThreadEntry(void* arg) { |
- Thread* thread = reinterpret_cast<Thread*>(arg); |
- // This is also initialized by the first argument to pthread_create() but we |
- // don't know which thread will run first (the original thread or the new |
- // one) so we initialize it here too. |
-#ifdef PR_SET_NAME |
- prctl(PR_SET_NAME, |
- reinterpret_cast<unsigned long>(thread->name()), // NOLINT |
- 0, 0, 0); |
-#endif |
- thread->data()->thread_ = pthread_self(); |
- ASSERT(thread->data()->thread_ != kNoThread); |
- thread->NotifyStartedAndRun(); |
- return NULL; |
-} |
- |
- |
-void Thread::set_name(const char* name) { |
- strncpy(name_, name, sizeof(name_)); |
- name_[sizeof(name_) - 1] = '\0'; |
-} |
- |
- |
-void Thread::Start() { |
- pthread_attr_t* attr_ptr = NULL; |
-#if defined(__native_client__) |
- // use default stack size. |
-#else |
- pthread_attr_t attr; |
- if (stack_size_ > 0) { |
- pthread_attr_init(&attr); |
- pthread_attr_setstacksize(&attr, static_cast<size_t>(stack_size_)); |
- attr_ptr = &attr; |
- } |
-#endif |
- int result = pthread_create(&data_->thread_, attr_ptr, ThreadEntry, this); |
- CHECK_EQ(0, result); |
- ASSERT(data_->thread_ != kNoThread); |
-} |
- |
- |
-void Thread::Join() { |
- pthread_join(data_->thread_, NULL); |
-} |
- |
- |
-Thread::LocalStorageKey Thread::CreateThreadLocalKey() { |
- pthread_key_t key; |
- int result = pthread_key_create(&key, NULL); |
- USE(result); |
- ASSERT(result == 0); |
- return static_cast<LocalStorageKey>(key); |
-} |
- |
- |
-void Thread::DeleteThreadLocalKey(LocalStorageKey key) { |
- pthread_key_t pthread_key = static_cast<pthread_key_t>(key); |
- int result = pthread_key_delete(pthread_key); |
- USE(result); |
- ASSERT(result == 0); |
-} |
- |
- |
-void* Thread::GetThreadLocal(LocalStorageKey key) { |
- pthread_key_t pthread_key = static_cast<pthread_key_t>(key); |
- return pthread_getspecific(pthread_key); |
-} |
- |
- |
-void Thread::SetThreadLocal(LocalStorageKey key, void* value) { |
- pthread_key_t pthread_key = static_cast<pthread_key_t>(key); |
- pthread_setspecific(pthread_key, value); |
-} |
- |
- |
class LinuxSemaphore : public Semaphore { |
public: |
explicit LinuxSemaphore(int count) { sem_init(&sem_, 0, count); } |