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

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

Issue 9452002: Ensure that executable pages are properly guarded. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 10 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after
1497 int prot = is_executable ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE; 1497 int prot = is_executable ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE;
1498 if (NULL == VirtualAlloc(base, size, MEM_COMMIT, prot)) { 1498 if (NULL == VirtualAlloc(base, size, MEM_COMMIT, prot)) {
1499 return false; 1499 return false;
1500 } 1500 }
1501 1501
1502 UpdateAllocatedSpaceLimits(base, static_cast<int>(size)); 1502 UpdateAllocatedSpaceLimits(base, static_cast<int>(size));
1503 return true; 1503 return true;
1504 } 1504 }
1505 1505
1506 1506
1507 bool VirtualMemory::Guard(void* address) {
1508 if (NULL == VirtualAlloc(address,
1509 OS::CommitPageSize(),
1510 MEM_COMMIT,
1511 PAGE_READONLY | PAGE_GUARD)) {
1512 return false;
1513 }
1514 return true;
1515 }
1516
1517
1507 bool VirtualMemory::UncommitRegion(void* base, size_t size) { 1518 bool VirtualMemory::UncommitRegion(void* base, size_t size) {
1508 return VirtualFree(base, size, MEM_DECOMMIT) != 0; 1519 return VirtualFree(base, size, MEM_DECOMMIT) != 0;
1509 } 1520 }
1510 1521
1511 1522
1512 bool VirtualMemory::ReleaseRegion(void* base, size_t size) { 1523 bool VirtualMemory::ReleaseRegion(void* base, size_t size) {
1513 return VirtualFree(base, 0, MEM_RELEASE) != 0; 1524 return VirtualFree(base, 0, MEM_RELEASE) != 0;
1514 } 1525 }
1515 1526
1516 1527
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
2051 2062
2052 2063
2053 void Sampler::Stop() { 2064 void Sampler::Stop() {
2054 ASSERT(IsActive()); 2065 ASSERT(IsActive());
2055 SamplerThread::RemoveActiveSampler(this); 2066 SamplerThread::RemoveActiveSampler(this);
2056 SetActive(false); 2067 SetActive(false);
2057 } 2068 }
2058 2069
2059 2070
2060 } } // namespace v8::internal 2071 } } // namespace v8::internal
OLDNEW
« src/platform-freebsd.cc ('K') | « src/platform-solaris.cc ('k') | src/serialize.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698