8 #include <mach/mach_init.h>
23 Semaphore::Semaphore(
int count) {
24 kern_return_t result = semaphore_create(
25 mach_task_self(), &native_handle_, SYNC_POLICY_FIFO, count);
31 Semaphore::~Semaphore() {
32 kern_return_t result = semaphore_destroy(mach_task_self(), native_handle_);
38 void Semaphore::Signal() {
39 kern_return_t result = semaphore_signal(native_handle_);
45 void Semaphore::Wait() {
47 kern_return_t result = semaphore_wait(native_handle_);
48 if (result == KERN_SUCCESS)
return;
54 bool Semaphore::WaitFor(
const TimeDelta& rel_time) {
55 TimeTicks now = TimeTicks::Now();
56 TimeTicks end = now + rel_time;
64 ts = (end - now).ToMachTimespec();
66 kern_return_t result = semaphore_timedwait(native_handle_, ts);
67 if (result == KERN_SUCCESS)
return true;
68 if (result == KERN_OPERATION_TIMED_OUT)
return false;
70 now = TimeTicks::Now();
76 Semaphore::Semaphore(
int count) {
78 int result = sem_init(&native_handle_, 0, count);
84 Semaphore::~Semaphore() {
85 int result = sem_destroy(&native_handle_);
91 void Semaphore::Signal() {
92 int result = sem_post(&native_handle_);
98 void Semaphore::Wait() {
100 int result = sem_wait(&native_handle_);
101 if (result == 0)
return;
109 bool Semaphore::WaitFor(
const TimeDelta& rel_time) {
115 int result = sem_trywait(&native_handle_);
116 if (result == 0)
return true;
117 DCHECK(errno == EAGAIN || errno == EINTR);
118 }
while (!timer.HasExpired(rel_time));
122 const Time time = Time::NowFromSystemTime() + rel_time;
123 const struct timespec ts = time.ToTimespec();
127 int result = sem_timedwait(&native_handle_, &ts);
128 if (result == 0)
return true;
129 #if V8_LIBC_GLIBC && !V8_GLIBC_PREREQ(2, 4)
136 if (result == -1 && errno == ETIMEDOUT) {
149 Semaphore::Semaphore(
int count) {
151 native_handle_ = ::CreateSemaphoreA(
NULL, count, 0x7fffffff,
NULL);
156 Semaphore::~Semaphore() {
157 BOOL result = CloseHandle(native_handle_);
163 void Semaphore::Signal() {
165 BOOL result = ReleaseSemaphore(native_handle_, 1, &dummy);
171 void Semaphore::Wait() {
172 DWORD result = WaitForSingleObject(native_handle_, INFINITE);
173 DCHECK(result == WAIT_OBJECT_0);
178 bool Semaphore::WaitFor(
const TimeDelta& rel_time) {
179 TimeTicks now = TimeTicks::Now();
180 TimeTicks end = now + rel_time;
182 int64_t msec = (end - now).InMilliseconds();
183 if (msec >=
static_cast<int64_t
>(INFINITE)) {
184 DWORD result = WaitForSingleObject(native_handle_, INFINITE - 1);
185 if (result == WAIT_OBJECT_0) {
188 DCHECK(result == WAIT_TIMEOUT);
189 now = TimeTicks::Now();
191 DWORD result = WaitForSingleObject(
192 native_handle_, (msec < 0) ? 0 :
static_cast<DWORD>(msec));
193 if (result == WAIT_TIMEOUT) {
196 DCHECK(result == WAIT_OBJECT_0);
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL
#define DCHECK(condition)
#define DCHECK_EQ(v1, v2)
typedef DWORD(__stdcall *DLL_FUNC_TYPE(SymGetOptions))(VOID)
typedef BOOL(__stdcall *DLL_FUNC_TYPE(SymInitialize))(IN HANDLE hProcess
Debugger support for the V8 JavaScript engine.