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. |
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 | 779 |
780 // Windows XP SP2 allows Data Excution Prevention (DEP). | 780 // Windows XP SP2 allows Data Excution Prevention (DEP). |
781 int prot = is_executable ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE; | 781 int prot = is_executable ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE; |
782 | 782 |
783 LPVOID mbase = RandomizedVirtualAlloc(msize, | 783 LPVOID mbase = RandomizedVirtualAlloc(msize, |
784 MEM_COMMIT | MEM_RESERVE, | 784 MEM_COMMIT | MEM_RESERVE, |
785 prot); | 785 prot); |
786 | 786 |
787 if (mbase == NULL) return NULL; | 787 if (mbase == NULL) return NULL; |
788 | 788 |
789 DCHECK((static_cast<uintptr_t>(mbase) % OS::AllocateAlignment()) == 0); | 789 DCHECK((reinterpret_cast<uintptr_t>(mbase) % OS::AllocateAlignment()) == 0); |
790 | 790 |
791 *allocated = msize; | 791 *allocated = msize; |
792 return mbase; | 792 return mbase; |
793 } | 793 } |
794 | 794 |
795 | 795 |
796 void OS::Free(void* address, const size_t size) { | 796 void OS::Free(void* address, const size_t size) { |
797 // TODO(1240712): VirtualFree has a return value which is ignored here. | 797 // TODO(1240712): VirtualFree has a return value which is ignored here. |
798 VirtualFree(address, 0, MEM_RELEASE); | 798 VirtualFree(address, 0, MEM_RELEASE); |
799 USE(size); | 799 USE(size); |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1397 DCHECK(result); | 1397 DCHECK(result); |
1398 } | 1398 } |
1399 | 1399 |
1400 | 1400 |
1401 | 1401 |
1402 void Thread::YieldCPU() { | 1402 void Thread::YieldCPU() { |
1403 Sleep(0); | 1403 Sleep(0); |
1404 } | 1404 } |
1405 | 1405 |
1406 } } // namespace v8::base | 1406 } } // namespace v8::base |
OLD | NEW |