Changeset 287007 in webkit
- Timestamp:
- Dec 13, 2021, 7:28:02 PM (5 years ago)
- Location:
- branches/safari-613.1.11-branch/Source/WTF
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
wtf/posix/OSAllocatorPOSIX.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-613.1.11-branch/Source/WTF/ChangeLog
r286514 r287007 1 2021-12-13 Russell Epstein <repstein@apple.com> 2 3 Cherry-pick r286849. rdar://problem/86445989 4 5 Reduce maximum mmap size for Structure regions to help placate ios 6 https://bugs.webkit.org/show_bug.cgi?id=234091 7 8 Reviewed by Saam Barati. 9 10 Use mach_vm_map since that supports memory alignement so we don't have to map 2x desired address space then free then trim. 11 12 * wtf/PlatformHave.h: 13 * wtf/posix/OSAllocatorPOSIX.cpp: 14 (WTF::OSAllocator::reserveUncommittedAligned): 15 16 17 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@286849 268f45cc-cd09-0410-ab3c-d52691b4dbfc 18 19 2021-12-10 Keith Miller <keith_miller@apple.com> 20 21 Reduce maximum mmap size for Structure regions to help placate ios 22 https://bugs.webkit.org/show_bug.cgi?id=234091 23 24 Reviewed by Saam Barati. 25 26 Use mach_vm_map since that supports memory alignement so we don't have to map 2x desired address space then free then trim. 27 28 * wtf/PlatformHave.h: 29 * wtf/posix/OSAllocatorPOSIX.cpp: 30 (WTF::OSAllocator::reserveUncommittedAligned): 31 1 32 2021-12-03 Chris Dumez <cdumez@apple.com> 2 33 -
branches/safari-613.1.11-branch/Source/WTF/wtf/posix/OSAllocatorPOSIX.cpp
r286345 r287007 45 45 #endif // ENABLE(JIT_CAGE) 46 46 47 #if OS(DARWIN) 48 #include <wtf/spi/cocoa/MachVMSPI.h> 49 #endif 50 47 51 namespace WTF { 48 52 … … 74 78 } 75 79 76 77 // FIXME: Make a smarter version of this for Linux flavors that have aligned mmap.78 80 void* OSAllocator::reserveUncommittedAligned(size_t bytes, Usage usage, bool writable, bool executable, bool jitCageEnabled, bool includesGuardPages) 79 81 { 80 82 ASSERT(hasOneBitSet(bytes) && bytes >= pageSize()); 83 84 #if PLATFORM(MAC) || USE(APPLE_INTERNAL_SDK) 85 UNUSED_PARAM(usage); // Not supported for mach API. 86 ASSERT_UNUSED(includesGuardPages, !includesGuardPages); 87 ASSERT_UNUSED(jitCageEnabled, !jitCageEnabled); // Not supported for mach API. 88 vm_prot_t protections = VM_PROT_READ; 89 if (writable) 90 protections |= VM_PROT_WRITE; 91 if (executable) 92 protections |= VM_PROT_EXECUTE; 93 94 const vm_inherit_t childProcessInheritance = VM_INHERIT_DEFAULT; 95 const bool copy = false; 96 const int flags = VM_FLAGS_ANYWHERE; 97 98 void* aligned = nullptr; 99 kern_return_t result = mach_vm_map(mach_task_self(), reinterpret_cast<mach_vm_address_t*>(&aligned), bytes, bytes - 1, flags, MEMORY_OBJECT_NULL, 0, copy, protections, protections, childProcessInheritance); 100 RELEASE_ASSERT(result == KERN_SUCCESS, result, bytes); 101 #if HAVE(MADV_FREE_REUSE) 102 if (aligned) { 103 // To support the "reserve then commit" model, we have to initially decommit. 104 while (madvise(aligned, bytes, MADV_FREE_REUSABLE) == -1 && errno == EAGAIN) { } 105 } 106 #endif 107 108 return aligned; 109 #else 81 110 // Double the size so we can ensure enough mapped memory to get an aligned start. 82 111 size_t mappedSize = bytes * 2; … … 96 125 97 126 return aligned; 127 #endif 98 128 } 99 129
Note:
See TracChangeset
for help on using the changeset viewer.