| 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 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 759 // VirtualAlloc rounds allocated size to page size automatically. | 759 // VirtualAlloc rounds allocated size to page size automatically. |
| 760 size_t msize = RoundUp(requested, static_cast<int>(GetPageSize())); | 760 size_t msize = RoundUp(requested, static_cast<int>(GetPageSize())); |
| 761 | 761 |
| 762 // Windows XP SP2 allows Data Excution Prevention (DEP). | 762 // Windows XP SP2 allows Data Excution Prevention (DEP). |
| 763 int prot = is_executable ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE; | 763 int prot = is_executable ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE; |
| 764 | 764 |
| 765 LPVOID mbase = RandomizedVirtualAlloc(msize, | 765 LPVOID mbase = RandomizedVirtualAlloc(msize, |
| 766 MEM_COMMIT | MEM_RESERVE, | 766 MEM_COMMIT | MEM_RESERVE, |
| 767 prot); | 767 prot); |
| 768 | 768 |
| 769 if (mbase == NULL) { | 769 if (mbase == NULL) return NULL; |
| 770 LOG(Isolate::Current(), StringEvent("OS::Allocate", "VirtualAlloc failed")); | |
| 771 return NULL; | |
| 772 } | |
| 773 | 770 |
| 774 ASSERT(IsAligned(reinterpret_cast<size_t>(mbase), OS::AllocateAlignment())); | 771 ASSERT(IsAligned(reinterpret_cast<size_t>(mbase), OS::AllocateAlignment())); |
| 775 | 772 |
| 776 *allocated = msize; | 773 *allocated = msize; |
| 777 return mbase; | 774 return mbase; |
| 778 } | 775 } |
| 779 | 776 |
| 780 | 777 |
| 781 void OS::Free(void* address, const size_t size) { | 778 void OS::Free(void* address, const size_t size) { |
| 782 // TODO(1240712): VirtualFree has a return value which is ignored here. | 779 // TODO(1240712): VirtualFree has a return value which is ignored here. |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1396 ASSERT(result); | 1393 ASSERT(result); |
| 1397 } | 1394 } |
| 1398 | 1395 |
| 1399 | 1396 |
| 1400 | 1397 |
| 1401 void Thread::YieldCPU() { | 1398 void Thread::YieldCPU() { |
| 1402 Sleep(0); | 1399 Sleep(0); |
| 1403 } | 1400 } |
| 1404 | 1401 |
| 1405 } } // namespace v8::internal | 1402 } } // namespace v8::internal |
| OLD | NEW |