| 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 Win32. | 5 // Platform-specific code for Win32. |
| 6 | 6 |
| 7 // Secure API functions are not available using MinGW with msvcrt.dll | 7 // Secure API functions are not available using MinGW with msvcrt.dll |
| 8 // on Windows XP. Make sure MINGW_HAS_SECURE_API is not defined to | 8 // on Windows XP. Make sure MINGW_HAS_SECURE_API is not defined to |
| 9 // disable definition of secure API functions in standard headers that | 9 // disable definition of secure API functions in standard headers that |
| 10 // would conflict with our own implementation. | 10 // would conflict with our own implementation. |
| 11 #ifdef __MINGW32__ | 11 #ifdef __MINGW32__ |
| 12 #include <_mingw.h> | 12 #include <_mingw.h> |
| 13 #ifdef MINGW_HAS_SECURE_API | 13 #ifdef MINGW_HAS_SECURE_API |
| 14 #undef MINGW_HAS_SECURE_API | 14 #undef MINGW_HAS_SECURE_API |
| 15 #endif // MINGW_HAS_SECURE_API | 15 #endif // MINGW_HAS_SECURE_API |
| 16 #endif // __MINGW32__ | 16 #endif // __MINGW32__ |
| 17 | 17 |
| 18 #ifdef _MSC_VER | |
| 19 #include <limits> | 18 #include <limits> |
| 20 #endif | |
| 21 | 19 |
| 22 #include "src/base/win32-headers.h" | 20 #include "src/base/win32-headers.h" |
| 23 | 21 |
| 24 #include "src/base/bits.h" | 22 #include "src/base/bits.h" |
| 25 #include "src/base/lazy-instance.h" | 23 #include "src/base/lazy-instance.h" |
| 26 #include "src/base/macros.h" | 24 #include "src/base/macros.h" |
| 27 #include "src/base/platform/platform.h" | 25 #include "src/base/platform/platform.h" |
| 28 #include "src/base/platform/time.h" | 26 #include "src/base/platform/time.h" |
| 29 #include "src/base/utils/random-number-generator.h" | 27 #include "src/base/utils/random-number-generator.h" |
| 30 | 28 |
| 31 #ifdef _MSC_VER | |
| 32 | |
| 33 // Case-insensitive bounded string comparisons. Use stricmp() on Win32. Usually | |
| 34 // defined in strings.h. | |
| 35 int strncasecmp(const char* s1, const char* s2, int n) { | |
| 36 return _strnicmp(s1, s2, n); | |
| 37 } | |
| 38 | |
| 39 #endif // _MSC_VER | |
| 40 | |
| 41 | 29 |
| 42 // Extra functions for MinGW. Most of these are the _s functions which are in | 30 // Extra functions for MinGW. Most of these are the _s functions which are in |
| 43 // the Microsoft Visual Studio C++ CRT. | 31 // the Microsoft Visual Studio C++ CRT. |
| 44 #ifdef __MINGW32__ | 32 #ifdef __MINGW32__ |
| 45 | 33 |
| 46 | 34 |
| 47 #ifndef __MINGW64_VERSION_MAJOR | 35 #ifndef __MINGW64_VERSION_MAJOR |
| 48 | 36 |
| 49 #define _TRUNCATE 0 | 37 #define _TRUNCATE 0 |
| 50 #define STRUNCATE 80 | 38 #define STRUNCATE 80 |
| (...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 void OS::Abort() { | 813 void OS::Abort() { |
| 826 if (g_hard_abort) { | 814 if (g_hard_abort) { |
| 827 V8_IMMEDIATE_CRASH(); | 815 V8_IMMEDIATE_CRASH(); |
| 828 } | 816 } |
| 829 // Make the MSVCRT do a silent abort. | 817 // Make the MSVCRT do a silent abort. |
| 830 raise(SIGABRT); | 818 raise(SIGABRT); |
| 831 } | 819 } |
| 832 | 820 |
| 833 | 821 |
| 834 void OS::DebugBreak() { | 822 void OS::DebugBreak() { |
| 835 #ifdef _MSC_VER | 823 #if V8_CC_MSVC |
| 836 // To avoid Visual Studio runtime support the following code can be used | 824 // To avoid Visual Studio runtime support the following code can be used |
| 837 // instead | 825 // instead |
| 838 // __asm { int 3 } | 826 // __asm { int 3 } |
| 839 __debugbreak(); | 827 __debugbreak(); |
| 840 #else | 828 #else |
| 841 ::DebugBreak(); | 829 ::DebugBreak(); |
| 842 #endif | 830 #endif |
| 843 } | 831 } |
| 844 | 832 |
| 845 | 833 |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1168 std::vector<OS::SharedLibraryAddress> OS::GetSharedLibraryAddresses() { | 1156 std::vector<OS::SharedLibraryAddress> OS::GetSharedLibraryAddresses() { |
| 1169 return std::vector<OS::SharedLibraryAddress>(); | 1157 return std::vector<OS::SharedLibraryAddress>(); |
| 1170 } | 1158 } |
| 1171 | 1159 |
| 1172 | 1160 |
| 1173 void OS::SignalCodeMovingGC() { } | 1161 void OS::SignalCodeMovingGC() { } |
| 1174 #endif // __MINGW32__ | 1162 #endif // __MINGW32__ |
| 1175 | 1163 |
| 1176 | 1164 |
| 1177 double OS::nan_value() { | 1165 double OS::nan_value() { |
| 1178 #ifdef _MSC_VER | |
| 1179 return std::numeric_limits<double>::quiet_NaN(); | 1166 return std::numeric_limits<double>::quiet_NaN(); |
| 1180 #else // _MSC_VER | |
| 1181 return NAN; | |
| 1182 #endif // _MSC_VER | |
| 1183 } | 1167 } |
| 1184 | 1168 |
| 1185 | 1169 |
| 1186 int OS::ActivationFrameAlignment() { | 1170 int OS::ActivationFrameAlignment() { |
| 1187 #ifdef _WIN64 | 1171 #ifdef _WIN64 |
| 1188 return 16; // Windows 64-bit ABI requires the stack to be 16-byte aligned. | 1172 return 16; // Windows 64-bit ABI requires the stack to be 16-byte aligned. |
| 1189 #elif defined(__MINGW32__) | 1173 #elif defined(__MINGW32__) |
| 1190 // With gcc 4.4 the tree vectorization optimizer can generate code | 1174 // With gcc 4.4 the tree vectorization optimizer can generate code |
| 1191 // that requires 16 byte alignment such as movdqa on x86. | 1175 // that requires 16 byte alignment such as movdqa on x86. |
| 1192 return 16; | 1176 return 16; |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1397 DCHECK(result); | 1381 DCHECK(result); |
| 1398 } | 1382 } |
| 1399 | 1383 |
| 1400 | 1384 |
| 1401 | 1385 |
| 1402 void Thread::YieldCPU() { | 1386 void Thread::YieldCPU() { |
| 1403 Sleep(0); | 1387 Sleep(0); |
| 1404 } | 1388 } |
| 1405 | 1389 |
| 1406 } } // namespace v8::base | 1390 } } // namespace v8::base |
| OLD | NEW |