37 static V8_INLINE void InitializeNativeHandle(pthread_mutex_t* mutex) {
41 pthread_mutexattr_t attr;
42 result = pthread_mutexattr_init(&attr);
44 result = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK);
46 result = pthread_mutex_init(mutex, &attr);
48 result = pthread_mutexattr_destroy(&attr);
51 result = pthread_mutex_init(mutex,
NULL);
52 #endif // defined(DEBUG)
58 static V8_INLINE void InitializeRecursiveNativeHandle(pthread_mutex_t* mutex) {
59 pthread_mutexattr_t attr;
60 int result = pthread_mutexattr_init(&attr);
62 result = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
64 result = pthread_mutex_init(mutex, &attr);
66 result = pthread_mutexattr_destroy(&attr);
72 static V8_INLINE void DestroyNativeHandle(pthread_mutex_t* mutex) {
73 int result = pthread_mutex_destroy(mutex);
79 static V8_INLINE void LockNativeHandle(pthread_mutex_t* mutex) {
80 int result = pthread_mutex_lock(mutex);
86 static V8_INLINE void UnlockNativeHandle(pthread_mutex_t* mutex) {
87 int result = pthread_mutex_unlock(mutex);
93 static V8_INLINE bool TryLockNativeHandle(pthread_mutex_t* mutex) {
94 int result = pthread_mutex_trylock(mutex);
95 if (result == EBUSY) {
104 static V8_INLINE void InitializeNativeHandle(PCRITICAL_SECTION
cs) {
105 InitializeCriticalSection(cs);
109 static V8_INLINE void InitializeRecursiveNativeHandle(PCRITICAL_SECTION
cs) {
110 InitializeCriticalSection(cs);
114 static V8_INLINE void DestroyNativeHandle(PCRITICAL_SECTION
cs) {
115 DeleteCriticalSection(cs);
119 static V8_INLINE void LockNativeHandle(PCRITICAL_SECTION
cs) {
120 EnterCriticalSection(cs);
124 static V8_INLINE void UnlockNativeHandle(PCRITICAL_SECTION
cs) {
125 LeaveCriticalSection(cs);
129 static V8_INLINE bool TryLockNativeHandle(PCRITICAL_SECTION
cs) {
130 return TryEnterCriticalSection(cs);
133 #endif // V8_OS_POSIX
137 InitializeNativeHandle(&native_handle_);
145 DestroyNativeHandle(&native_handle_);
151 LockNativeHandle(&native_handle_);
152 AssertUnheldAndMark();
156 void Mutex::Unlock() {
157 AssertHeldAndUnmark();
158 UnlockNativeHandle(&native_handle_);
162 bool Mutex::TryLock() {
163 if (!TryLockNativeHandle(&native_handle_)) {
166 AssertUnheldAndMark();
171 RecursiveMutex::RecursiveMutex() {
172 InitializeRecursiveNativeHandle(&native_handle_);
179 RecursiveMutex::~RecursiveMutex() {
180 DestroyNativeHandle(&native_handle_);
185 void RecursiveMutex::Lock() {
186 LockNativeHandle(&native_handle_);
194 void RecursiveMutex::Unlock() {
199 UnlockNativeHandle(&native_handle_);
203 bool RecursiveMutex::TryLock() {
204 if (!TryLockNativeHandle(&native_handle_)) {
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter NULL
#define ASSERT_LE(v1, v2)
#define ASSERT_LT(v1, v2)
#define ASSERT_EQ(v1, v2)