Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: src/platform-win32.cc

Issue 7352007: Add guard pages in front of platform allocations (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: '' Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/platform-solaris.cc ('k') | src/spaces.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 920 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 return mbase; 931 return mbase;
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
942 #ifdef ENABLE_HEAP_PROTECTION 941 #ifdef ENABLE_HEAP_PROTECTION
943 942
944 void OS::Protect(void* address, size_t size) { 943 void OS::Protect(void* address, size_t size) {
945 // TODO(1240712): VirtualProtect has a return value which is ignored here. 944 // TODO(1240712): VirtualProtect has a return value which is ignored here.
946 DWORD old_protect; 945 DWORD old_protect;
947 VirtualProtect(address, size, PAGE_READONLY, &old_protect); 946 VirtualProtect(address, size, PAGE_READONLY, &old_protect);
948 } 947 }
949 948
950 949
951 void OS::Unprotect(void* address, size_t size, bool is_executable) { 950 void OS::Unprotect(void* address, size_t size, bool is_executable) {
952 // TODO(1240712): VirtualProtect has a return value which is ignored here. 951 // TODO(1240712): VirtualProtect has a return value which is ignored here.
953 DWORD new_protect = is_executable ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE; 952 DWORD new_protect = is_executable ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE;
954 DWORD old_protect; 953 DWORD old_protect;
955 VirtualProtect(address, size, new_protect, &old_protect); 954 VirtualProtect(address, size, new_protect, &old_protect);
956 } 955 }
957 956
958 #endif 957 void OS::Guard(void* address, const size_t size) {
958 DWORD oldprotect;
959 VirtualProtect(address, size, PAGE_READONLY | PAGE_GUARD, &oldprotect);
960 }
961
962 #endif // ENABLE_HEAP_PROTECTION
959 963
960 964
961 void OS::Sleep(int milliseconds) { 965 void OS::Sleep(int milliseconds) {
962 ::Sleep(milliseconds); 966 ::Sleep(milliseconds);
963 } 967 }
964 968
965 969
966 void OS::Abort() { 970 void OS::Abort() {
967 if (!IsDebuggerPresent()) { 971 if (!IsDebuggerPresent()) {
968 #ifdef _MSC_VER 972 #ifdef _MSC_VER
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after
2030 2034
2031 void Sampler::Stop() { 2035 void Sampler::Stop() {
2032 ASSERT(IsActive()); 2036 ASSERT(IsActive());
2033 SamplerThread::RemoveActiveSampler(this); 2037 SamplerThread::RemoveActiveSampler(this);
2034 SetActive(false); 2038 SetActive(false);
2035 } 2039 }
2036 2040
2037 #endif // ENABLE_LOGGING_AND_PROFILING 2041 #endif // ENABLE_LOGGING_AND_PROFILING
2038 2042
2039 } } // namespace v8::internal 2043 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-solaris.cc ('k') | src/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698