OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Platform-specific code for POSIX goes here. This is not a platform on its | 5 // Platform-specific code for POSIX goes here. This is not a platform on its |
6 // own, but contains the parts which are the same across the POSIX platforms | 6 // own, but contains the parts which are the same across the POSIX platforms |
7 // Linux, MacOS, FreeBSD, OpenBSD, NetBSD and QNX. | 7 // Linux, MacOS, FreeBSD, OpenBSD, NetBSD and QNX. |
8 | 8 |
9 #include <dlfcn.h> | 9 #include <dlfcn.h> |
10 #include <pthread.h> | 10 #include <pthread.h> |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 // If the length is zero, the assignment fails. | 435 // If the length is zero, the assignment fails. |
436 if (str.length() > 0) | 436 if (str.length() > 0) |
437 str[str.length() - 1] = '\0'; | 437 str[str.length() - 1] = '\0'; |
438 return -1; | 438 return -1; |
439 } else { | 439 } else { |
440 return n; | 440 return n; |
441 } | 441 } |
442 } | 442 } |
443 | 443 |
444 | 444 |
445 #if V8_TARGET_ARCH_IA32 | 445 #if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87 |
446 static void MemMoveWrapper(void* dest, const void* src, size_t size) { | 446 static void MemMoveWrapper(void* dest, const void* src, size_t size) { |
447 memmove(dest, src, size); | 447 memmove(dest, src, size); |
448 } | 448 } |
449 | 449 |
450 | 450 |
451 // Initialize to library version so we can call this at any time during startup. | 451 // Initialize to library version so we can call this at any time during startup. |
452 static OS::MemMoveFunction memmove_function = &MemMoveWrapper; | 452 static OS::MemMoveFunction memmove_function = &MemMoveWrapper; |
453 | 453 |
454 // Defined in codegen-ia32.cc. | 454 // Defined in codegen-ia32.cc. |
455 OS::MemMoveFunction CreateMemMoveFunction(); | 455 OS::MemMoveFunction CreateMemMoveFunction(); |
(...skipping 28 matching lines...) Expand all Loading... |
484 | 484 |
485 #elif defined(V8_HOST_ARCH_MIPS) | 485 #elif defined(V8_HOST_ARCH_MIPS) |
486 OS::MemCopyUint8Function OS::memcopy_uint8_function = &OS::MemCopyUint8Wrapper; | 486 OS::MemCopyUint8Function OS::memcopy_uint8_function = &OS::MemCopyUint8Wrapper; |
487 // Defined in codegen-mips.cc. | 487 // Defined in codegen-mips.cc. |
488 OS::MemCopyUint8Function CreateMemCopyUint8Function( | 488 OS::MemCopyUint8Function CreateMemCopyUint8Function( |
489 OS::MemCopyUint8Function stub); | 489 OS::MemCopyUint8Function stub); |
490 #endif | 490 #endif |
491 | 491 |
492 | 492 |
493 void OS::PostSetUp() { | 493 void OS::PostSetUp() { |
494 #if V8_TARGET_ARCH_IA32 | 494 #if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87 |
495 OS::MemMoveFunction generated_memmove = CreateMemMoveFunction(); | 495 OS::MemMoveFunction generated_memmove = CreateMemMoveFunction(); |
496 if (generated_memmove != NULL) { | 496 if (generated_memmove != NULL) { |
497 memmove_function = generated_memmove; | 497 memmove_function = generated_memmove; |
498 } | 498 } |
499 #elif defined(V8_HOST_ARCH_ARM) | 499 #elif defined(V8_HOST_ARCH_ARM) |
500 OS::memcopy_uint8_function = | 500 OS::memcopy_uint8_function = |
501 CreateMemCopyUint8Function(&OS::MemCopyUint8Wrapper); | 501 CreateMemCopyUint8Function(&OS::MemCopyUint8Wrapper); |
502 OS::memcopy_uint16_uint8_function = | 502 OS::memcopy_uint16_uint8_function = |
503 CreateMemCopyUint16Uint8Function(&OS::MemCopyUint16Uint8Wrapper); | 503 CreateMemCopyUint16Uint8Function(&OS::MemCopyUint16Uint8Wrapper); |
504 #elif defined(V8_HOST_ARCH_MIPS) | 504 #elif defined(V8_HOST_ARCH_MIPS) |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 | 751 |
752 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { | 752 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { |
753 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); | 753 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); |
754 int result = pthread_setspecific(pthread_key, value); | 754 int result = pthread_setspecific(pthread_key, value); |
755 ASSERT_EQ(0, result); | 755 ASSERT_EQ(0, result); |
756 USE(result); | 756 USE(result); |
757 } | 757 } |
758 | 758 |
759 | 759 |
760 } } // namespace v8::internal | 760 } } // namespace v8::internal |
OLD | NEW |