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

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

Issue 9537011: Merge r10809 into 3.7 branch (Closed) Base URL: http://v8.googlecode.com/svn/branches/3.7/
Patch Set: Created 8 years, 9 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/serialize.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 static size_t allocate_alignment = 0; 824 static size_t allocate_alignment = 0;
825 if (allocate_alignment == 0) { 825 if (allocate_alignment == 0) {
826 SYSTEM_INFO info; 826 SYSTEM_INFO info;
827 GetSystemInfo(&info); 827 GetSystemInfo(&info);
828 allocate_alignment = info.dwAllocationGranularity; 828 allocate_alignment = info.dwAllocationGranularity;
829 } 829 }
830 return allocate_alignment; 830 return allocate_alignment;
831 } 831 }
832 832
833 833
834 intptr_t OS::CommitPageSize() {
835 return 4096;
836 }
837
838
834 void* OS::Allocate(const size_t requested, 839 void* OS::Allocate(const size_t requested,
835 size_t* allocated, 840 size_t* allocated,
836 bool is_executable) { 841 bool is_executable) {
837 // The address range used to randomize RWX allocations in OS::Allocate 842 // The address range used to randomize RWX allocations in OS::Allocate
838 // Try not to map pages into the default range that windows loads DLLs 843 // Try not to map pages into the default range that windows loads DLLs
839 // Use a multiple of 64k to prevent committing unused memory. 844 // Use a multiple of 64k to prevent committing unused memory.
840 // Note: This does not guarantee RWX regions will be within the 845 // Note: This does not guarantee RWX regions will be within the
841 // range kAllocationRandomAddressMin to kAllocationRandomAddressMax 846 // range kAllocationRandomAddressMin to kAllocationRandomAddressMax
842 #ifdef V8_HOST_ARCH_64_BIT 847 #ifdef V8_HOST_ARCH_64_BIT
843 static const intptr_t kAllocationRandomAddressMin = 0x0000000080000000; 848 static const intptr_t kAllocationRandomAddressMin = 0x0000000080000000;
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
1474 int prot = is_executable ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE; 1479 int prot = is_executable ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE;
1475 if (NULL == VirtualAlloc(base, size, MEM_COMMIT, prot)) { 1480 if (NULL == VirtualAlloc(base, size, MEM_COMMIT, prot)) {
1476 return false; 1481 return false;
1477 } 1482 }
1478 1483
1479 UpdateAllocatedSpaceLimits(base, static_cast<int>(size)); 1484 UpdateAllocatedSpaceLimits(base, static_cast<int>(size));
1480 return true; 1485 return true;
1481 } 1486 }
1482 1487
1483 1488
1489 bool VirtualMemory::Guard(void* address) {
1490 if (NULL == VirtualAlloc(address,
1491 OS::CommitPageSize(),
1492 MEM_COMMIT,
1493 PAGE_READONLY | PAGE_GUARD)) {
1494 return false;
1495 }
1496 return true;
1497 }
1498
1499
1484 bool VirtualMemory::UncommitRegion(void* base, size_t size) { 1500 bool VirtualMemory::UncommitRegion(void* base, size_t size) {
1485 return VirtualFree(base, size, MEM_DECOMMIT) != 0; 1501 return VirtualFree(base, size, MEM_DECOMMIT) != 0;
1486 } 1502 }
1487 1503
1488 1504
1489 bool VirtualMemory::ReleaseRegion(void* base, size_t size) { 1505 bool VirtualMemory::ReleaseRegion(void* base, size_t size) {
1490 return VirtualFree(base, 0, MEM_RELEASE) != 0; 1506 return VirtualFree(base, 0, MEM_RELEASE) != 0;
1491 } 1507 }
1492 1508
1493 1509
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
2033 2049
2034 2050
2035 void Sampler::Stop() { 2051 void Sampler::Stop() {
2036 ASSERT(IsActive()); 2052 ASSERT(IsActive());
2037 SamplerThread::RemoveActiveSampler(this); 2053 SamplerThread::RemoveActiveSampler(this);
2038 SetActive(false); 2054 SetActive(false);
2039 } 2055 }
2040 2056
2041 2057
2042 } } // namespace v8::internal 2058 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-solaris.cc ('k') | src/serialize.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698