Commit 46b932f4 authored by bjaideep's avatar bjaideep Committed by Commit bot

AIX:Proposal to use kSemaphoreAlignmentMask instead kPointerAlignmentMask

native_handle_ on AIX64 is of type int, and therefore fails
on an operation with a pointer type. Use
kSemaphoreAlignmentMask as sizeof(int) on AIX and
sizeof(pointer) otherwise.

R=jochen@chromium.org, mbrandy@us.ibm.com

BUG=v8:4767
LOG=N

Review-Url: https://codereview.chromium.org/1936003002
Cr-Commit-Position: refs/heads/master@{#35988}
parent f71e1664
...@@ -78,9 +78,15 @@ Semaphore::Semaphore(int count) { ...@@ -78,9 +78,15 @@ Semaphore::Semaphore(int count) {
// Unaligned native handle can later cause a failure in semaphore signal. // Unaligned native handle can later cause a failure in semaphore signal.
// Check the alignment here to catch the failure earlier. // Check the alignment here to catch the failure earlier.
// Context: crbug.com/605349. // Context: crbug.com/605349.
const uintptr_t kPointerAlignmentMask = sizeof(void*) - 1; #if V8_OS_AIX
// On aix sem_t is of type int
const uintptr_t kSemaphoreAlignmentMask = sizeof(int) - 1;
#else
const uintptr_t kSemaphoreAlignmentMask = sizeof(void*) - 1;
#endif
CHECK_EQ( CHECK_EQ(
0, reinterpret_cast<uintptr_t>(&native_handle_) & kPointerAlignmentMask); 0, reinterpret_cast<uintptr_t>(&native_handle_) &
kSemaphoreAlignmentMask);
DCHECK(count >= 0); DCHECK(count >= 0);
#if V8_LIBC_GLIBC #if V8_LIBC_GLIBC
// sem_init in glibc prior to 2.1 does not zero out semaphores. // sem_init in glibc prior to 2.1 does not zero out semaphores.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment