| 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 | 18 #ifdef _MSC_VER |
| 19 #include <limits> | 19 #include <limits> |
| 20 #endif | 20 #endif |
| 21 | 21 |
| 22 #include "src/base/win32-headers.h" | 22 #include "src/base/win32-headers.h" |
| 23 | 23 |
| 24 #include "src/base/bits.h" |
| 24 #include "src/base/lazy-instance.h" | 25 #include "src/base/lazy-instance.h" |
| 25 #include "src/base/macros.h" | 26 #include "src/base/macros.h" |
| 26 #include "src/base/platform/platform.h" | 27 #include "src/base/platform/platform.h" |
| 27 #include "src/base/platform/time.h" | 28 #include "src/base/platform/time.h" |
| 28 #include "src/base/utils/random-number-generator.h" | 29 #include "src/base/utils/random-number-generator.h" |
| 29 | 30 |
| 30 #ifdef _MSC_VER | 31 #ifdef _MSC_VER |
| 31 | 32 |
| 32 // Case-insensitive bounded string comparisons. Use stricmp() on Win32. Usually | 33 // Case-insensitive bounded string comparisons. Use stricmp() on Win32. Usually |
| 33 // defined in strings.h. | 34 // defined in strings.h. |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 | 694 |
| 694 | 695 |
| 695 // Get the system's page size used by VirtualAlloc() or the next power | 696 // Get the system's page size used by VirtualAlloc() or the next power |
| 696 // of two. The reason for always returning a power of two is that the | 697 // of two. The reason for always returning a power of two is that the |
| 697 // rounding up in OS::Allocate expects that. | 698 // rounding up in OS::Allocate expects that. |
| 698 static size_t GetPageSize() { | 699 static size_t GetPageSize() { |
| 699 static size_t page_size = 0; | 700 static size_t page_size = 0; |
| 700 if (page_size == 0) { | 701 if (page_size == 0) { |
| 701 SYSTEM_INFO info; | 702 SYSTEM_INFO info; |
| 702 GetSystemInfo(&info); | 703 GetSystemInfo(&info); |
| 703 page_size = RoundUpToPowerOf2(info.dwPageSize); | 704 page_size = base::bits::RoundUpToPowerOfTwo32(info.dwPageSize); |
| 704 } | 705 } |
| 705 return page_size; | 706 return page_size; |
| 706 } | 707 } |
| 707 | 708 |
| 708 | 709 |
| 709 // The allocation alignment is the guaranteed alignment for | 710 // The allocation alignment is the guaranteed alignment for |
| 710 // VirtualAlloc'ed blocks of memory. | 711 // VirtualAlloc'ed blocks of memory. |
| 711 size_t OS::AllocateAlignment() { | 712 size_t OS::AllocateAlignment() { |
| 712 static size_t allocate_alignment = 0; | 713 static size_t allocate_alignment = 0; |
| 713 if (allocate_alignment == 0) { | 714 if (allocate_alignment == 0) { |
| (...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1396 DCHECK(result); | 1397 DCHECK(result); |
| 1397 } | 1398 } |
| 1398 | 1399 |
| 1399 | 1400 |
| 1400 | 1401 |
| 1401 void Thread::YieldCPU() { | 1402 void Thread::YieldCPU() { |
| 1402 Sleep(0); | 1403 Sleep(0); |
| 1403 } | 1404 } |
| 1404 | 1405 |
| 1405 } } // namespace v8::base | 1406 } } // namespace v8::base |
| OLD | NEW |