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 // This module contains the platform-specific code. This make the rest of the | 5 // This module contains the platform-specific code. This make the rest of the |
6 // code less dependent on operating system, compilers and runtime libraries. | 6 // code less dependent on operating system, compilers and runtime libraries. |
7 // This module does specifically not deal with differences between different | 7 // This module does specifically not deal with differences between different |
8 // processor architecture. | 8 // processor architecture. |
9 // The platform classes have the same definition for all platforms. The | 9 // The platform classes have the same definition for all platforms. The |
10 // implementation for a particular platform is put in platform_<os>.cc. | 10 // implementation for a particular platform is put in platform_<os>.cc. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 #include "win32-headers.h" | 46 #include "win32-headers.h" |
47 #include "win32-math.h" | 47 #include "win32-math.h" |
48 | 48 |
49 int strncasecmp(const char* s1, const char* s2, int n); | 49 int strncasecmp(const char* s1, const char* s2, int n); |
50 | 50 |
51 // Visual C++ 2013 and higher implement this function. | 51 // Visual C++ 2013 and higher implement this function. |
52 #if (_MSC_VER < 1800) | 52 #if (_MSC_VER < 1800) |
53 inline int lrint(double flt) { | 53 inline int lrint(double flt) { |
54 int intgr; | 54 int intgr; |
55 #if V8_TARGET_ARCH_IA32 | 55 #if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87 |
56 __asm { | 56 __asm { |
57 fld flt | 57 fld flt |
58 fistp intgr | 58 fistp intgr |
59 }; | 59 }; |
60 #else | 60 #else |
61 intgr = static_cast<int>(flt + 0.5); | 61 intgr = static_cast<int>(flt + 0.5); |
62 if ((intgr & 1) != 0 && intgr - flt == 0.5) { | 62 if ((intgr & 1) != 0 && intgr - flt == 0.5) { |
63 // If the number is halfway between two integers, round to the even one. | 63 // If the number is halfway between two integers, round to the even one. |
64 intgr--; | 64 intgr--; |
65 } | 65 } |
66 #endif | 66 #endif |
67 return intgr; | 67 return intgr; |
68 } | 68 } |
69 #endif // _MSC_VER < 1800 | 69 #endif // _MSC_VER < 1800 |
70 | 70 |
71 #endif // V8_LIBC_MSVCRT | 71 #endif // V8_LIBC_MSVCRT |
72 | 72 |
73 namespace v8 { | 73 namespace v8 { |
74 namespace internal { | 74 namespace internal { |
75 | 75 |
76 // ---------------------------------------------------------------------------- | 76 // ---------------------------------------------------------------------------- |
77 // Fast TLS support | 77 // Fast TLS support |
78 | 78 |
79 #ifndef V8_NO_FAST_TLS | 79 #ifndef V8_NO_FAST_TLS |
80 | 80 |
81 #if defined(_MSC_VER) && V8_HOST_ARCH_IA32 | 81 #if defined(_MSC_VER) && (V8_HOST_ARCH_IA32) |
82 | 82 |
83 #define V8_FAST_TLS_SUPPORTED 1 | 83 #define V8_FAST_TLS_SUPPORTED 1 |
84 | 84 |
85 INLINE(intptr_t InternalGetExistingThreadLocal(intptr_t index)); | 85 INLINE(intptr_t InternalGetExistingThreadLocal(intptr_t index)); |
86 | 86 |
87 inline intptr_t InternalGetExistingThreadLocal(intptr_t index) { | 87 inline intptr_t InternalGetExistingThreadLocal(intptr_t index) { |
88 const intptr_t kTibInlineTlsOffset = 0xE10; | 88 const intptr_t kTibInlineTlsOffset = 0xE10; |
89 const intptr_t kTibExtraTlsOffset = 0xF94; | 89 const intptr_t kTibExtraTlsOffset = 0xF94; |
90 const intptr_t kMaxInlineSlots = 64; | 90 const intptr_t kMaxInlineSlots = 64; |
91 const intptr_t kMaxSlots = kMaxInlineSlots + 1024; | 91 const intptr_t kMaxSlots = kMaxInlineSlots + 1024; |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 static double nan_value(); | 285 static double nan_value(); |
286 | 286 |
287 // Support runtime detection of whether the hard float option of the | 287 // Support runtime detection of whether the hard float option of the |
288 // EABI is used. | 288 // EABI is used. |
289 static bool ArmUsingHardFloat(); | 289 static bool ArmUsingHardFloat(); |
290 | 290 |
291 // Returns the activation frame alignment constraint or zero if | 291 // Returns the activation frame alignment constraint or zero if |
292 // the platform doesn't care. Guaranteed to be a power of two. | 292 // the platform doesn't care. Guaranteed to be a power of two. |
293 static int ActivationFrameAlignment(); | 293 static int ActivationFrameAlignment(); |
294 | 294 |
295 #if defined(V8_TARGET_ARCH_IA32) | 295 #if defined(V8_TARGET_ARCH_IA32) || defined(V8_TARGET_ARCH_X87) |
296 // Limit below which the extra overhead of the MemCopy function is likely | 296 // Limit below which the extra overhead of the MemCopy function is likely |
297 // to outweigh the benefits of faster copying. | 297 // to outweigh the benefits of faster copying. |
298 static const int kMinComplexMemCopy = 64; | 298 static const int kMinComplexMemCopy = 64; |
299 | 299 |
300 // Copy memory area. No restrictions. | 300 // Copy memory area. No restrictions. |
301 static void MemMove(void* dest, const void* src, size_t size); | 301 static void MemMove(void* dest, const void* src, size_t size); |
302 typedef void (*MemMoveFunction)(void* dest, const void* src, size_t size); | 302 typedef void (*MemMoveFunction)(void* dest, const void* src, size_t size); |
303 | 303 |
304 // Keep the distinction of "move" vs. "copy" for the benefit of other | 304 // Keep the distinction of "move" vs. "copy" for the benefit of other |
305 // architectures. | 305 // architectures. |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 char name_[kMaxThreadNameLength]; | 584 char name_[kMaxThreadNameLength]; |
585 int stack_size_; | 585 int stack_size_; |
586 Semaphore* start_semaphore_; | 586 Semaphore* start_semaphore_; |
587 | 587 |
588 DISALLOW_COPY_AND_ASSIGN(Thread); | 588 DISALLOW_COPY_AND_ASSIGN(Thread); |
589 }; | 589 }; |
590 | 590 |
591 } } // namespace v8::internal | 591 } } // namespace v8::internal |
592 | 592 |
593 #endif // V8_PLATFORM_H_ | 593 #endif // V8_PLATFORM_H_ |
OLD | NEW |