v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
platform-solaris.cc
Go to the documentation of this file.
1// Copyright 2012 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Platform-specific code for Solaris 10 goes here. For the POSIX-compatible
6// parts, the implementation is in platform-posix.cc.
7
8#ifdef __sparc
9# error "V8 does not support the SPARC CPU architecture."
10#endif
11
12#include <dlfcn.h> // dladdr
13#include <errno.h>
14#include <ieeefp.h> // finite()
15#include <pthread.h>
16#include <semaphore.h>
17#include <signal.h> // sigemptyset(), etc
18#include <sys/mman.h> // mmap()
19#include <sys/regset.h>
20#include <sys/stack.h> // for stack alignment
21#include <sys/time.h> // gettimeofday(), timeradd()
22#include <time.h>
23#include <ucontext.h> // walkstack(), getcontext()
24#include <unistd.h> // getpagesize(), usleep()
25
26#include <cmath>
27
28#undef MAP_TYPE
29
30#include "src/base/macros.h"
33
34namespace v8 {
35namespace base {
36
38 const char* LocalTimezone(double time) override;
39
40 double LocalTimeOffset(double time, bool is_utc) override;
42};
43
44const char* SolarisTimezoneCache::LocalTimezone(double time) {
45 if (std::isnan(time)) return "";
46 time_t tv = static_cast<time_t>(std::floor(time/msPerSecond));
47 struct tm tm;
48 struct tm* t = localtime_r(&tv, &tm);
49 if (nullptr == t) return "";
50 return tzname[0]; // The location of the timezone string on Solaris.
51}
52
53double SolarisTimezoneCache::LocalTimeOffset(double time, bool is_utc) {
54 tzset();
55 return -static_cast<double>(timezone * msPerSecond);
56}
57
59
60std::vector<OS::SharedLibraryAddress> OS::GetSharedLibraryAddresses() {
61 return std::vector<SharedLibraryAddress>();
62}
63
65
67
68std::optional<OS::MemoryRange> OS::GetFirstFreeMemoryRangeWithin(
69 OS::Address boundary_start, OS::Address boundary_end, size_t minimum_size,
70 size_t alignment) {
71 return std::nullopt;
72}
73
74// static
75Stack::StackSlot Stack::ObtainCurrentThreadStackStart() {
76 pthread_attr_t attr;
77 int error;
78 pthread_attr_init(&attr);
79 error = pthread_attr_get_np(pthread_self(), &attr);
80 if (!error) {
81 void* base;
82 size_t size;
83 error = pthread_attr_getstack(&attr, &base, &size);
84 CHECK(!error);
85 pthread_attr_destroy(&attr);
86 return reinterpret_cast<uint8_t*>(base) + size;
87 }
88 pthread_attr_destroy(&attr);
89 return nullptr;
90}
91
92} // namespace base
93} // namespace v8
static void SignalCodeMovingGC()
static std::vector< SharedLibraryAddress > GetSharedLibraryAddresses()
uintptr_t Address
Definition platform.h:315
static TimezoneCache * CreateTimezoneCache()
static std::optional< MemoryRange > GetFirstFreeMemoryRangeWithin(Address boundary_start, Address boundary_end, size_t minimum_size, size_t alignment)
static void AdjustSchedulingParams()
double LocalTimeOffset(double time, bool is_utc) override
const char * LocalTimezone(double time) override
static Stack::StackSlot ObtainCurrentThreadStackStart()
#define CHECK(condition)
Definition logging.h:124