Index: src/platform-tls-mac.h |
diff --git a/src/platform-tls-mac.h b/src/platform-tls-mac.h |
index 86a3347d0f710825808a231031a4f81851b15ffa..3543f5ec8e416d85997ef62b644cc70feea6160f 100644 |
--- a/src/platform-tls-mac.h |
+++ b/src/platform-tls-mac.h |
@@ -37,20 +37,21 @@ namespace internal { |
#define V8_FAST_TLS_SUPPORTED 1 |
+extern intptr_t kMacTlsBaseOffset; |
+ |
INLINE(intptr_t InternalGetExistingThreadLocal(intptr_t index)); |
inline intptr_t InternalGetExistingThreadLocal(intptr_t index) { |
- // The constants below are taken from pthreads.s from the XNU kernel |
- // sources archive at www.opensource.apple.com. |
+ intptr_t offset = kMacTlsBaseOffset + kPointerSize * index; |
intptr_t result; |
#if defined(V8_HOST_ARCH_IA32) |
- asm("movl %%gs:0x48(,%1,4), %0;" |
+ asm("movl %%gs:(%1), %0;" |
Mark Mentovai
2011/04/01 14:28:01
It seems like you should be able to move the arith
Vitaly Repeshko
2011/04/01 15:45:18
Given that we have to load the base from a static
|
:"=r"(result) // Output must be a writable register. |
- :"0"(index)); // Input is the same as output. |
+ :"0"(offset)); // Input is the same as output. |
#else |
- asm("movq %%gs:0x60(,%1,8), %0;" |
+ asm("movq %%gs:(%1), %0;" |
:"=r"(result) |
- :"0"(index)); |
+ :"0"(offset)); |
#endif |
return result; |
} |