Changeset 74431 in webkit for trunk/JavaScriptCore/wtf/PageReservation.h
- Timestamp:
- Dec 21, 2010, 3:53:25 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/wtf/PageReservation.h
r74382 r74431 58 58 public: 59 59 PageReservation() 60 : m_writable(false) 61 , m_executable(false) 62 #ifndef NDEBUG 63 , m_committed(0) 64 #endif 60 65 { 61 66 } … … 70 75 ASSERT(isPageAligned(start)); 71 76 ASSERT(isPageAligned(size)); 77 ASSERT(contains(start, size)); 72 78 73 79 #ifndef NDEBUG … … 82 88 ASSERT(isPageAligned(start)); 83 89 ASSERT(isPageAligned(size)); 90 ASSERT(contains(start, size)); 84 91 85 92 #ifndef NDEBUG … … 92 99 { 93 100 ASSERT(isPageAligned(size)); 94 return PageReservation(OSAllocator::reserve (size, usage, writable, executable), size, writable, executable);101 return PageReservation(OSAllocator::reserveUncommitted(size, usage, writable, executable), size, writable, executable); 95 102 } 96 103 … … 98 105 { 99 106 ASSERT(!m_committed); 100 ASSERT(*this);101 107 102 // Zero these before calling release; if this is *inside* allocation, 103 // we won't be able to clear then after the call to OSAllocator::release. 104 void* base = m_base; 105 size_t size = m_size; 106 m_base = 0; 107 m_size = 0; 108 // Clear base & size before calling release; if this is *inside* allocation 109 // then we won't be able to clear then after deallocating the memory. 110 PageReservation tmp; 111 std::swap(tmp, *this); 108 112 109 OSAllocator::release(base, size); 113 ASSERT(tmp); 114 ASSERT(!*this); 115 116 OSAllocator::releaseDecommitted(tmp.base(), tmp.size()); 110 117 } 111 118 … … 113 120 PageReservation(void* base, size_t size, bool writable, bool executable) 114 121 : PageBlock(base, size) 122 , m_writable(writable) 123 , m_executable(executable) 115 124 #ifndef NDEBUG 116 125 , m_committed(0) 117 126 #endif 118 , m_writable(writable)119 , m_executable(executable)120 127 { 121 128 } 122 129 130 bool m_writable; 131 bool m_executable; 123 132 #ifndef NDEBUG 124 133 size_t m_committed; 125 134 #endif 126 bool m_writable;127 bool m_executable;128 135 }; 129 136
Note:
See TracChangeset
for help on using the changeset viewer.