OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
932 } | 932 } |
933 | 933 |
934 | 934 |
935 void OS::Free(void* address, const size_t size) { | 935 void OS::Free(void* address, const size_t size) { |
936 // TODO(1240712): VirtualFree has a return value which is ignored here. | 936 // TODO(1240712): VirtualFree has a return value which is ignored here. |
937 VirtualFree(address, 0, MEM_RELEASE); | 937 VirtualFree(address, 0, MEM_RELEASE); |
938 USE(size); | 938 USE(size); |
939 } | 939 } |
940 | 940 |
941 | 941 |
942 #ifdef ENABLE_HEAP_PROTECTION | |
943 | |
944 void OS::Protect(void* address, size_t size) { | |
945 // TODO(1240712): VirtualProtect has a return value which is ignored here. | |
946 DWORD old_protect; | |
947 VirtualProtect(address, size, PAGE_READONLY, &old_protect); | |
948 } | |
949 | |
950 | |
951 void OS::Unprotect(void* address, size_t size, bool is_executable) { | |
952 // TODO(1240712): VirtualProtect has a return value which is ignored here. | |
953 DWORD new_protect = is_executable ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE; | |
954 DWORD old_protect; | |
955 VirtualProtect(address, size, new_protect, &old_protect); | |
956 } | |
957 | |
958 #endif | |
959 | |
960 | |
961 void OS::Sleep(int milliseconds) { | 942 void OS::Sleep(int milliseconds) { |
962 ::Sleep(milliseconds); | 943 ::Sleep(milliseconds); |
963 } | 944 } |
964 | 945 |
965 | 946 |
966 void OS::Abort() { | 947 void OS::Abort() { |
967 if (!IsDebuggerPresent()) { | 948 if (!IsDebuggerPresent()) { |
968 #ifdef _MSC_VER | 949 #ifdef _MSC_VER |
969 // Make the MSVCRT do a silent abort. | 950 // Make the MSVCRT do a silent abort. |
970 _set_abort_behavior(0, _WRITE_ABORT_MSG); | 951 _set_abort_behavior(0, _WRITE_ABORT_MSG); |
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2030 | 2011 |
2031 void Sampler::Stop() { | 2012 void Sampler::Stop() { |
2032 ASSERT(IsActive()); | 2013 ASSERT(IsActive()); |
2033 SamplerThread::RemoveActiveSampler(this); | 2014 SamplerThread::RemoveActiveSampler(this); |
2034 SetActive(false); | 2015 SetActive(false); |
2035 } | 2016 } |
2036 | 2017 |
2037 #endif // ENABLE_LOGGING_AND_PROFILING | 2018 #endif // ENABLE_LOGGING_AND_PROFILING |
2038 | 2019 |
2039 } } // namespace v8::internal | 2020 } } // namespace v8::internal |
OLD | NEW |