Changeset 166956 in webkit
- Timestamp:
- Apr 8, 2014, 1:36:07 PM (11 years ago)
- Location:
- trunk/Source/bmalloc
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/bmalloc/ChangeLog
r166944 r166956 1 2014-04-08 Geoffrey Garen <ggaren@apple.com> 2 3 Made bmalloc more #include friendly 4 https://bugs.webkit.org/show_bug.cgi?id=131386 5 6 Reviewed by Andreas Kling. 7 8 Marked a bunch of headers private so they can be used from client code 9 that #includes bmalloc.h. 10 11 Renamed ASSERT macros to BASSERT. This matches their header, which already 12 had to be renamed, and fixes conflicts with WTF's ASSERT macros. 13 14 * bmalloc.xcodeproj/project.pbxproj: 15 * bmalloc/Allocator.cpp: 16 (bmalloc::Allocator::allocateSlowCase): 17 * bmalloc/AsyncTask.h: 18 (bmalloc::Function>::runSlowCase): 19 * bmalloc/BAssert.h: 20 * bmalloc/BoundaryTag.h: 21 (bmalloc::BoundaryTag::setSize): 22 * bmalloc/BoundaryTagInlines.h: 23 (bmalloc::validate): 24 (bmalloc::BoundaryTag::init): 25 (bmalloc::BoundaryTag::deallocate): 26 (bmalloc::BoundaryTag::splitLarge): 27 (bmalloc::BoundaryTag::allocate): 28 * bmalloc/Chunk.h: 29 * bmalloc/Deallocator.cpp: 30 (bmalloc::Deallocator::processObjectLog): 31 (bmalloc::Deallocator::deallocateSlowCase): 32 * bmalloc/Deallocator.h: 33 (bmalloc::Deallocator::deallocateFastCase): 34 * bmalloc/FixedVector.h: 35 (bmalloc::Capacity>::operator): 36 (bmalloc::Capacity>::push): 37 (bmalloc::Capacity>::pop): 38 (bmalloc::Capacity>::shrink): 39 * bmalloc/Heap.cpp: 40 (bmalloc::Heap::allocateLarge): 41 * bmalloc/LargeChunk.h: 42 (bmalloc::LargeChunk::get): 43 (bmalloc::LargeChunk::endTag): 44 * bmalloc/Line.h: 45 (bmalloc::Line<Traits>::concurrentRef): 46 (bmalloc::Line<Traits>::deref): 47 * bmalloc/MediumAllocator.h: 48 (bmalloc::MediumAllocator::allocate): 49 * bmalloc/ObjectType.h: 50 (bmalloc::isSmall): 51 * bmalloc/Page.h: 52 (bmalloc::Page<Traits>::ref): 53 (bmalloc::Page<Traits>::deref): 54 * bmalloc/PerThread.h: 55 (bmalloc::PerThread<T>::getSlowCase): 56 * bmalloc/SegregatedFreeList.cpp: 57 (bmalloc::SegregatedFreeList::SegregatedFreeList): 58 (bmalloc::SegregatedFreeList::insert): 59 * bmalloc/SmallAllocator.h: 60 (bmalloc::SmallAllocator::allocate): 61 (bmalloc::SmallAllocator::refill): 62 * bmalloc/Syscall.h: 63 * bmalloc/VMAllocate.h: 64 (bmalloc::vmValidate): 65 (bmalloc::vmAllocate): 66 (bmalloc::vmDeallocatePhysicalPagesSloppy): 67 * bmalloc/Vector.h: 68 (bmalloc::Vector<T>::operator): 69 (bmalloc::Vector<T>::pop): 70 (bmalloc::Vector<T>::shrink): 71 * bmalloc/XLargeChunk.h: 72 (bmalloc::XLargeChunk::range): 73 (bmalloc::XLargeChunk::size): 74 1 75 2014-04-08 Geoffrey Garen <ggaren@apple.com> 2 76 -
trunk/Source/bmalloc/bmalloc.xcodeproj/project.pbxproj
r166910 r166956 11 11 1448C30118F3754C00502839 /* bmalloc.h in Headers */ = {isa = PBXBuildFile; fileRef = 1448C2FE18F3754300502839 /* bmalloc.h */; settings = {ATTRIBUTES = (Private, ); }; }; 12 12 14CC394C18EA8858004AFE34 /* libbmalloc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 14F271BE18EA3963008C152F /* libbmalloc.a */; }; 13 14DD788C18F48CAE00950702 /* LargeChunk.h in Headers */ = {isa = PBXBuildFile; fileRef = 147AAA8818CD17CE002201E4 /* LargeChunk.h */; settings = {ATTRIBUTES = (Private, ); }; }; 14 14DD788D18F48CC600950702 /* BeginTag.h in Headers */ = {isa = PBXBuildFile; fileRef = 1417F64518B54A700076FA3F /* BeginTag.h */; settings = {ATTRIBUTES = (Private, ); }; }; 15 14DD788E18F48CCD00950702 /* BoundaryTag.h in Headers */ = {isa = PBXBuildFile; fileRef = 1485655E18A43AF900ED6942 /* BoundaryTag.h */; settings = {ATTRIBUTES = (Private, ); }; }; 16 14DD789018F48CEB00950702 /* Sizes.h in Headers */ = {isa = PBXBuildFile; fileRef = 145F6874179DF84100D65598 /* Sizes.h */; settings = {ATTRIBUTES = (Private, ); }; }; 17 14DD789218F48CFC00950702 /* EndTag.h in Headers */ = {isa = PBXBuildFile; fileRef = 1417F64618B54A700076FA3F /* EndTag.h */; settings = {ATTRIBUTES = (Private, ); }; }; 18 14DD789318F48D0F00950702 /* ObjectType.h in Headers */ = {isa = PBXBuildFile; fileRef = 1485656018A43DBA00ED6942 /* ObjectType.h */; settings = {ATTRIBUTES = (Private, ); }; }; 19 14DD789818F48D4A00950702 /* Allocator.h in Headers */ = {isa = PBXBuildFile; fileRef = 145F6856179DC8CA00D65598 /* Allocator.h */; settings = {ATTRIBUTES = (Private, ); }; }; 20 14DD789918F48D4A00950702 /* Cache.h in Headers */ = {isa = PBXBuildFile; fileRef = 144469E517A46BFE00F9EA1D /* Cache.h */; settings = {ATTRIBUTES = (Private, ); }; }; 21 14DD789A18F48D4A00950702 /* Deallocator.h in Headers */ = {isa = PBXBuildFile; fileRef = 145F685A179DC90200D65598 /* Deallocator.h */; settings = {ATTRIBUTES = (Private, ); }; }; 22 14DD789B18F48D4A00950702 /* MediumAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = 1413E47018A0661700546D68 /* MediumAllocator.h */; settings = {ATTRIBUTES = (Private, ); }; }; 23 14DD789C18F48D4A00950702 /* SmallAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = 1413E462189DE1CD00546D68 /* SmallAllocator.h */; settings = {ATTRIBUTES = (Private, ); }; }; 24 14DD78B418F48D6B00950702 /* Chunk.h in Headers */ = {isa = PBXBuildFile; fileRef = 147AAA9418CE5CA6002201E4 /* Chunk.h */; settings = {ATTRIBUTES = (Private, ); }; }; 25 14DD78B518F48D6B00950702 /* Line.h in Headers */ = {isa = PBXBuildFile; fileRef = 14DA32071885F9E6007269E0 /* Line.h */; settings = {ATTRIBUTES = (Private, ); }; }; 26 14DD78B618F48D6B00950702 /* MediumChunk.h in Headers */ = {isa = PBXBuildFile; fileRef = 147AAA8E18CD89E3002201E4 /* MediumChunk.h */; settings = {ATTRIBUTES = (Private, ); }; }; 27 14DD78B718F48D6B00950702 /* MediumLine.h in Headers */ = {isa = PBXBuildFile; fileRef = 1452478518BC757C00F80098 /* MediumLine.h */; settings = {ATTRIBUTES = (Private, ); }; }; 28 14DD78B818F48D6B00950702 /* MediumPage.h in Headers */ = {isa = PBXBuildFile; fileRef = 143E29E918CAE8BE00FE8A0F /* MediumPage.h */; settings = {ATTRIBUTES = (Private, ); }; }; 29 14DD78B918F48D6B00950702 /* MediumTraits.h in Headers */ = {isa = PBXBuildFile; fileRef = 147AAA9618CE5FB6002201E4 /* MediumTraits.h */; settings = {ATTRIBUTES = (Private, ); }; }; 30 14DD78BA18F48D6B00950702 /* Page.h in Headers */ = {isa = PBXBuildFile; fileRef = 146BEE2318C980D60002D5A2 /* Page.h */; settings = {ATTRIBUTES = (Private, ); }; }; 31 14DD78BB18F48D6B00950702 /* SmallChunk.h in Headers */ = {isa = PBXBuildFile; fileRef = 147AAA8C18CD36A7002201E4 /* SmallChunk.h */; settings = {ATTRIBUTES = (Private, ); }; }; 32 14DD78BC18F48D6B00950702 /* SmallLine.h in Headers */ = {isa = PBXBuildFile; fileRef = 1452478618BC757C00F80098 /* SmallLine.h */; settings = {ATTRIBUTES = (Private, ); }; }; 33 14DD78BD18F48D6B00950702 /* SmallPage.h in Headers */ = {isa = PBXBuildFile; fileRef = 143E29ED18CAE90500FE8A0F /* SmallPage.h */; settings = {ATTRIBUTES = (Private, ); }; }; 34 14DD78BE18F48D6B00950702 /* SmallTraits.h in Headers */ = {isa = PBXBuildFile; fileRef = 147AAA9718CE5FB6002201E4 /* SmallTraits.h */; settings = {ATTRIBUTES = (Private, ); }; }; 35 14DD78C518F48D7500950702 /* Algorithm.h in Headers */ = {isa = PBXBuildFile; fileRef = 1421A87718EE462A00B4DD68 /* Algorithm.h */; settings = {ATTRIBUTES = (Private, ); }; }; 36 14DD78C618F48D7500950702 /* AsyncTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 1417F65218BA88A00076FA3F /* AsyncTask.h */; settings = {ATTRIBUTES = (Private, ); }; }; 37 14DD78C718F48D7500950702 /* BAssert.h in Headers */ = {isa = PBXBuildFile; fileRef = 1413E468189EEDE400546D68 /* BAssert.h */; settings = {ATTRIBUTES = (Private, ); }; }; 38 14DD78C818F48D7500950702 /* FixedVector.h in Headers */ = {isa = PBXBuildFile; fileRef = 14D9DB4517F2447100EAAB79 /* FixedVector.h */; settings = {ATTRIBUTES = (Private, ); }; }; 39 14DD78C918F48D7500950702 /* Inline.h in Headers */ = {isa = PBXBuildFile; fileRef = 1413E460189DCE1E00546D68 /* Inline.h */; settings = {ATTRIBUTES = (Private, ); }; }; 40 14DD78CA18F48D7500950702 /* Mutex.h in Headers */ = {isa = PBXBuildFile; fileRef = 144DCED617A649D90093B2F2 /* Mutex.h */; settings = {ATTRIBUTES = (Private, ); }; }; 41 14DD78CB18F48D7500950702 /* PerProcess.h in Headers */ = {isa = PBXBuildFile; fileRef = 14446A0717A61FA400F9EA1D /* PerProcess.h */; settings = {ATTRIBUTES = (Private, ); }; }; 42 14DD78CC18F48D7500950702 /* PerThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 144469FD17A61F1F00F9EA1D /* PerThread.h */; settings = {ATTRIBUTES = (Private, ); }; }; 43 14DD78CD18F48D7500950702 /* Range.h in Headers */ = {isa = PBXBuildFile; fileRef = 145F6878179E3A4400D65598 /* Range.h */; settings = {ATTRIBUTES = (Private, ); }; }; 44 14DD78CE18F48D7500950702 /* Syscall.h in Headers */ = {isa = PBXBuildFile; fileRef = 1417F64F18B7280C0076FA3F /* Syscall.h */; settings = {ATTRIBUTES = (Private, ); }; }; 45 14DD78CF18F48D7500950702 /* Vector.h in Headers */ = {isa = PBXBuildFile; fileRef = 1479E21217A1A255006D4E9D /* Vector.h */; settings = {ATTRIBUTES = (Private, ); }; }; 46 14DD78D018F48D7500950702 /* VMAllocate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1479E21417A1A63E006D4E9D /* VMAllocate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 47 14DD78D118F48EC600950702 /* XLargeChunk.h in Headers */ = {isa = PBXBuildFile; fileRef = 147AAA8918CD17CE002201E4 /* XLargeChunk.h */; settings = {ATTRIBUTES = (Private, ); }; }; 13 48 14F271C318EA3978008C152F /* Allocator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 145F6855179DC8CA00D65598 /* Allocator.cpp */; }; 14 49 14F271C418EA397B008C152F /* Cache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 144469E417A46BFE00F9EA1D /* Cache.cpp */; }; … … 249 284 buildActionMask = 2147483647; 250 285 files = ( 286 14DD78B518F48D6B00950702 /* Line.h in Headers */, 287 14DD78CF18F48D7500950702 /* Vector.h in Headers */, 288 14DD788C18F48CAE00950702 /* LargeChunk.h in Headers */, 289 14DD789218F48CFC00950702 /* EndTag.h in Headers */, 290 14DD78CC18F48D7500950702 /* PerThread.h in Headers */, 291 14DD78B418F48D6B00950702 /* Chunk.h in Headers */, 292 14DD78CA18F48D7500950702 /* Mutex.h in Headers */, 293 14DD78D118F48EC600950702 /* XLargeChunk.h in Headers */, 294 14DD78B918F48D6B00950702 /* MediumTraits.h in Headers */, 251 295 1448C30118F3754C00502839 /* bmalloc.h in Headers */, 296 14DD789A18F48D4A00950702 /* Deallocator.h in Headers */, 297 14DD788D18F48CC600950702 /* BeginTag.h in Headers */, 298 14DD78CD18F48D7500950702 /* Range.h in Headers */, 299 14DD789C18F48D4A00950702 /* SmallAllocator.h in Headers */, 300 14DD789918F48D4A00950702 /* Cache.h in Headers */, 301 14DD789B18F48D4A00950702 /* MediumAllocator.h in Headers */, 302 14DD78BE18F48D6B00950702 /* SmallTraits.h in Headers */, 303 14DD789018F48CEB00950702 /* Sizes.h in Headers */, 304 14DD78C718F48D7500950702 /* BAssert.h in Headers */, 305 14DD78D018F48D7500950702 /* VMAllocate.h in Headers */, 306 14DD78CE18F48D7500950702 /* Syscall.h in Headers */, 307 14DD78C618F48D7500950702 /* AsyncTask.h in Headers */, 308 14DD78BA18F48D6B00950702 /* Page.h in Headers */, 309 14DD78BB18F48D6B00950702 /* SmallChunk.h in Headers */, 310 14DD78C918F48D7500950702 /* Inline.h in Headers */, 311 14DD78B818F48D6B00950702 /* MediumPage.h in Headers */, 312 14DD78C518F48D7500950702 /* Algorithm.h in Headers */, 313 14DD78BD18F48D6B00950702 /* SmallPage.h in Headers */, 314 14DD788E18F48CCD00950702 /* BoundaryTag.h in Headers */, 315 14DD78C818F48D7500950702 /* FixedVector.h in Headers */, 316 14DD78B718F48D6B00950702 /* MediumLine.h in Headers */, 317 14DD78B618F48D6B00950702 /* MediumChunk.h in Headers */, 318 14DD78BC18F48D6B00950702 /* SmallLine.h in Headers */, 319 14DD789818F48D4A00950702 /* Allocator.h in Headers */, 320 14DD78CB18F48D7500950702 /* PerProcess.h in Headers */, 321 14DD789318F48D0F00950702 /* ObjectType.h in Headers */, 252 322 ); 253 323 runOnlyForDeploymentPostprocessing = 0; -
trunk/Source/bmalloc/bmalloc/Allocator.cpp
r166897 r166956 138 138 IF_DEBUG( 139 139 void* dummy; 140 ASSERT(!allocateFastCase(size, dummy));140 BASSERT(!allocateFastCase(size, dummy)); 141 141 ) 142 142 if (size <= smallMax) { -
trunk/Source/bmalloc/bmalloc/AsyncTask.h
r166910 r166956 110 110 } 111 111 112 ASSERT(oldState == Exited);112 BASSERT(oldState == Exited); 113 113 pthread_create(&m_thread, nullptr, &pthreadEntryPoint, this); 114 114 pthread_detach(m_thread); -
trunk/Source/bmalloc/bmalloc/BAssert.h
r166910 r166956 27 27 #define BAssert_h 28 28 29 #define ASSERT_IMPL(x) do { \29 #define BASSERT_IMPL(x) do { \ 30 30 if (!(x)) \ 31 31 *(int*)0xbbadbeef = 0; \ 32 32 } while(0); 33 33 34 #define RELEASE_ ASSERT(x)ASSERT_IMPL(x)34 #define RELEASE_BASSERT(x) BASSERT_IMPL(x) 35 35 36 36 #define UNUSED(x) (void)x … … 40 40 #if defined(NDEBUG) 41 41 42 #define ASSERT(x)42 #define BASSERT(x) 43 43 44 44 #define IF_DEBUG(x...) … … 51 51 #if !defined(NDEBUG) 52 52 53 #define ASSERT(x)ASSERT_IMPL(x)53 #define BASSERT(x) BASSERT_IMPL(x) 54 54 55 55 #define IF_DEBUG(x...) x -
trunk/Source/bmalloc/bmalloc/BoundaryTag.h
r166893 r166956 86 86 { 87 87 m_size = static_cast<unsigned>(size); 88 ASSERT(this->size() == size);89 ASSERT(!isXLarge());88 BASSERT(this->size() == size); 89 BASSERT(!isXLarge()); 90 90 } 91 91 -
trunk/Source/bmalloc/bmalloc/BoundaryTagInlines.h
r166910 r166956 42 42 EndTag* endTag = LargeChunk::endTag(range.begin(), range.size()); 43 43 44 ASSERT(!beginTag->isEnd());44 BASSERT(!beginTag->isEnd()); 45 45 if (beginTag->isXLarge()) 46 46 return; 47 47 ) 48 ASSERT(range.size() >= largeMin);49 ASSERT(beginTag->size() == range.size());50 51 ASSERT(beginTag->size() == endTag->size());52 ASSERT(beginTag->isFree() == endTag->isFree());53 ASSERT(beginTag->hasPhysicalPages() == endTag->hasPhysicalPages());54 ASSERT(beginTag->isXLarge() == endTag->isXLarge());55 ASSERT(static_cast<BoundaryTag*>(endTag) == static_cast<BoundaryTag*>(beginTag) || endTag->isEnd());48 BASSERT(range.size() >= largeMin); 49 BASSERT(beginTag->size() == range.size()); 50 51 BASSERT(beginTag->size() == endTag->size()); 52 BASSERT(beginTag->isFree() == endTag->isFree()); 53 BASSERT(beginTag->hasPhysicalPages() == endTag->hasPhysicalPages()); 54 BASSERT(beginTag->isXLarge() == endTag->isXLarge()); 55 BASSERT(static_cast<BoundaryTag*>(endTag) == static_cast<BoundaryTag*>(beginTag) || endTag->isEnd()); 56 56 } 57 57 … … 97 97 98 98 EndTag* leftSentinel = beginTag->prev(); 99 ASSERT(leftSentinel >= static_cast<void*>(chunk));99 BASSERT(leftSentinel >= static_cast<void*>(chunk)); 100 100 leftSentinel->setSize(largeMin); 101 101 leftSentinel->setFree(false); 102 102 103 103 BeginTag* rightSentinel = endTag->next(); 104 ASSERT(rightSentinel < static_cast<void*>(range.begin()));104 BASSERT(rightSentinel < static_cast<void*>(range.begin())); 105 105 rightSentinel->setSize(largeMin); 106 106 rightSentinel->setFree(false); … … 164 164 { 165 165 BeginTag* beginTag = LargeChunk::beginTag(object); 166 ASSERT(!beginTag->isFree());167 ASSERT(!beginTag->isXLarge())166 BASSERT(!beginTag->isFree()); 167 BASSERT(!beginTag->isXLarge()) 168 168 169 169 Range range(object, beginTag->size()); … … 183 183 184 184 leftover = Range(range.begin() + size, range.size() - size); 185 ASSERT(leftover.size() >= largeMin);185 BASSERT(leftover.size() >= largeMin); 186 186 BeginTag* leftoverBeginTag = LargeChunk::beginTag(leftover.begin()); 187 187 *leftoverBeginTag = *beginTag; … … 203 203 EndTag* endTag = LargeChunk::endTag(range.begin(), range.size()); 204 204 205 ASSERT(beginTag->isFree());205 BASSERT(beginTag->isFree()); 206 206 validate(beginTag->prev(), range, endTag->next()); 207 207 -
trunk/Source/bmalloc/bmalloc/Chunk.h
r166893 r166956 78 78 inline auto Chunk<Traits>::get(void* object) -> Chunk* 79 79 { 80 ASSERT(isSmallOrMedium(object));80 BASSERT(isSmallOrMedium(object)); 81 81 return static_cast<Chunk*>(mask(object, chunkMask)); 82 82 } -
trunk/Source/bmalloc/bmalloc/Deallocator.cpp
r166898 r166956 82 82 deallocateSmallLine(lock, line); 83 83 } else { 84 ASSERT(isSmallOrMedium(object));84 BASSERT(isSmallOrMedium(object)); 85 85 MediumLine* line = MediumLine::get(object); 86 86 if (!line->deref(lock)) … … 95 95 void Deallocator::deallocateSlowCase(void* object) 96 96 { 97 ASSERT(!deallocateFastCase(object));97 BASSERT(!deallocateFastCase(object)); 98 98 99 99 if (!object) -
trunk/Source/bmalloc/bmalloc/Deallocator.h
r166897 r166956 66 66 return false; 67 67 68 ASSERT(object);68 BASSERT(object); 69 69 70 70 if (m_objectLog.size() == m_objectLog.capacity()) -
trunk/Source/bmalloc/bmalloc/FixedVector.h
r166893 r166956 77 77 inline T& FixedVector<T, Capacity>::operator[](size_t i) 78 78 { 79 ASSERT(i < m_size);79 BASSERT(i < m_size); 80 80 return m_buffer[i]; 81 81 } … … 84 84 inline void FixedVector<T, Capacity>::push(const T& value) 85 85 { 86 ASSERT(m_size < Capacity);86 BASSERT(m_size < Capacity); 87 87 m_buffer[m_size++] = value; 88 88 } … … 98 98 inline T FixedVector<T, Capacity>::pop() 99 99 { 100 ASSERT(m_size);100 BASSERT(m_size); 101 101 return m_buffer[--m_size]; 102 102 } … … 105 105 inline void FixedVector<T, Capacity>::shrink(size_t size) 106 106 { 107 ASSERT(size <= m_size);107 BASSERT(size <= m_size); 108 108 m_size = size; 109 109 } -
trunk/Source/bmalloc/bmalloc/Heap.cpp
r166910 r166956 171 171 void* Heap::allocateLarge(std::lock_guard<Mutex>&, size_t size) 172 172 { 173 ASSERT(size <= largeMax);174 ASSERT(size >= largeMin);173 BASSERT(size <= largeMax); 174 BASSERT(size >= largeMin); 175 175 176 176 m_isAllocatingPages = true; -
trunk/Source/bmalloc/bmalloc/LargeChunk.h
r166893 r166956 77 77 inline LargeChunk* LargeChunk::get(void* object) 78 78 { 79 ASSERT(!isSmallOrMedium(object));79 BASSERT(!isSmallOrMedium(object)); 80 80 return static_cast<LargeChunk*>(mask(object, largeChunkMask)); 81 81 } … … 90 90 inline EndTag* LargeChunk::endTag(void* object, size_t size) 91 91 { 92 ASSERT(!isSmallOrMedium(object));92 BASSERT(!isSmallOrMedium(object)); 93 93 94 94 LargeChunk* chunk = get(object); -
trunk/Source/bmalloc/bmalloc/Line.h
r166897 r166956 59 59 inline auto Line<Traits>::get(void* object) -> Line* 60 60 { 61 ASSERT(isSmallOrMedium(object));61 BASSERT(isSmallOrMedium(object)); 62 62 Chunk* chunk = Chunk::get(object); 63 63 size_t lineNumber = (reinterpret_cast<char*>(object) - reinterpret_cast<char*>(chunk)) / lineSize; … … 83 83 inline void Line<Traits>::concurrentRef(unsigned char count) 84 84 { 85 ASSERT(!m_refCount); // Up-ref from zero can be lock-free because there are no other clients.86 ASSERT(count <= maxRefCount);85 BASSERT(!m_refCount); // Up-ref from zero can be lock-free because there are no other clients. 86 BASSERT(count <= maxRefCount); 87 87 m_refCount = count; 88 88 } … … 91 91 inline bool Line<Traits>::deref(std::lock_guard<Mutex>&, unsigned char count) 92 92 { 93 ASSERT(count <= m_refCount);93 BASSERT(count <= m_refCount); 94 94 m_refCount -= count; 95 95 return !m_refCount; -
trunk/Source/bmalloc/bmalloc/MediumAllocator.h
r166893 r166956 68 68 inline void* MediumAllocator::allocate(size_t size) 69 69 { 70 ASSERT(size <= m_remaining);71 ASSERT(size == roundUpToMultipleOf<alignment>(size));72 ASSERT(size >= MediumLine::minimumObjectSize);70 BASSERT(size <= m_remaining); 71 BASSERT(size == roundUpToMultipleOf<alignment>(size)); 72 BASSERT(size >= MediumLine::minimumObjectSize); 73 73 74 74 m_remaining -= size; 75 75 void* object = m_end - m_remaining - size; 76 ASSERT(isSmallOrMedium(object) && !isSmall(object));76 BASSERT(isSmallOrMedium(object) && !isSmall(object)); 77 77 78 78 ++m_objectCount; -
trunk/Source/bmalloc/bmalloc/ObjectType.h
r166893 r166956 43 43 inline bool isSmall(void* smallOrMedium) 44 44 { 45 ASSERT(isSmallOrMedium(smallOrMedium));45 BASSERT(isSmallOrMedium(smallOrMedium)); 46 46 return test(smallOrMedium, smallOrMediumSmallTypeMask); 47 47 } -
trunk/Source/bmalloc/bmalloc/Page.h
r166897 r166956 60 60 inline void Page<Traits>::ref(std::lock_guard<Mutex>&) 61 61 { 62 ASSERT(m_refCount < maxRefCount);62 BASSERT(m_refCount < maxRefCount); 63 63 ++m_refCount; 64 64 } … … 67 67 inline bool Page<Traits>::deref(std::lock_guard<Mutex>&) 68 68 { 69 ASSERT(m_refCount);69 BASSERT(m_refCount); 70 70 --m_refCount; 71 71 return !m_refCount; -
trunk/Source/bmalloc/bmalloc/PerThread.h
r166893 r166956 118 118 T* PerThread<T>::getSlowCase() 119 119 { 120 ASSERT(!getFastCase());120 BASSERT(!getFastCase()); 121 121 T* t = new T; 122 122 PerThreadStorage<T>::init(t, destructor); -
trunk/Source/bmalloc/bmalloc/SegregatedFreeList.cpp
r166910 r166956 33 33 SegregatedFreeList::SegregatedFreeList() 34 34 { 35 ASSERT(static_cast<size_t>(&select(largeMax) - m_lists.begin()) == m_lists.size() - 1);35 BASSERT(static_cast<size_t>(&select(largeMax) - m_lists.begin()) == m_lists.size() - 1); 36 36 } 37 37 … … 40 40 IF_DEBUG( 41 41 BeginTag* beginTag = LargeChunk::beginTag(range.begin()); 42 ASSERT(beginTag->isInFreeList(range.size()));42 BASSERT(beginTag->isInFreeList(range.size())); 43 43 ) 44 44 -
trunk/Source/bmalloc/bmalloc/SmallAllocator.h
r166893 r166956 80 80 inline void* SmallAllocator::allocate() 81 81 { 82 ASSERT(m_remaining);83 ASSERT(m_size >= SmallLine::minimumObjectSize);82 BASSERT(m_remaining); 83 BASSERT(m_size >= SmallLine::minimumObjectSize); 84 84 85 85 --m_remaining; 86 86 char* result = m_ptr; 87 87 m_ptr += m_size; 88 ASSERT(isSmall(result));88 BASSERT(isSmall(result)); 89 89 return result; 90 90 } … … 102 102 inline void SmallAllocator::refill(SmallLine* line) 103 103 { 104 ASSERT(!canAllocate());104 BASSERT(!canAllocate()); 105 105 line->concurrentRef(SmallLine::maxRefCount); 106 106 m_ptr = line->begin(); -
trunk/Source/bmalloc/bmalloc/Syscall.h
r166893 r166956 31 31 #define SYSCALL(x) do { \ 32 32 while ((x) == -1) \ 33 RELEASE_ ASSERT(errno == EAGAIN); \33 RELEASE_BASSERT(errno == EAGAIN); \ 34 34 } while (0); 35 35 -
trunk/Source/bmalloc/bmalloc/VMAllocate.h
r166910 r166956 51 51 { 52 52 UNUSED(vmSize); 53 ASSERT(vmSize);54 ASSERT(vmSize == bmalloc::vmSize(vmSize));53 BASSERT(vmSize); 54 BASSERT(vmSize == bmalloc::vmSize(vmSize)); 55 55 } 56 56 … … 62 62 // allowed to be larger than the OS's true page size. 63 63 UNUSED(p); 64 ASSERT(p);65 ASSERT(p == mask(p, ~(getpagesize() - 1)));64 BASSERT(p); 65 BASSERT(p == mask(p, ~(getpagesize() - 1))); 66 66 } 67 67 … … 84 84 { 85 85 vmValidate(vmSize); 86 ASSERT(isPowerOfTwo(alignment));86 BASSERT(isPowerOfTwo(alignment)); 87 87 88 88 size_t mappedSize = std::max(vmSize, alignment) + alignment; … … 119 119 inline void vmDeallocatePhysicalPagesSloppy(void* p, size_t size) 120 120 { 121 ASSERT(size >= vmPageSize);121 BASSERT(size >= vmPageSize); 122 122 123 123 char* begin = roundUpToMultipleOf<vmPageSize>(static_cast<char*>(p)); -
trunk/Source/bmalloc/bmalloc/Vector.h
r166893 r166956 95 95 inline T& Vector<T>::operator[](size_t i) 96 96 { 97 ASSERT(i < m_size);97 BASSERT(i < m_size); 98 98 return m_buffer[i]; 99 99 } … … 120 120 inline T Vector<T>::pop() 121 121 { 122 ASSERT(m_size);122 BASSERT(m_size); 123 123 T value = m_buffer[m_size - 1]; 124 124 shrink(m_size - 1); … … 129 129 inline T Vector<T>::pop(size_t i) 130 130 { 131 ASSERT(i < m_size);131 BASSERT(i < m_size); 132 132 std::swap(m_buffer[i], last()); 133 133 return pop(); … … 137 137 inline void Vector<T>::shrink(size_t size) 138 138 { 139 ASSERT(size <= m_size);139 BASSERT(size <= m_size); 140 140 m_size = size; 141 141 if (m_capacity > initialCapacity && m_size < m_capacity / shrinkFactor) -
trunk/Source/bmalloc/bmalloc/XLargeChunk.h
r166893 r166956 72 72 // can stuff our range into the remaining metadata. 73 73 Range& result = *reinterpret_cast<Range*>(roundUpToMultipleOf<alignment>(LargeChunk::beginTag(begin()) + 1)); 74 ASSERT(static_cast<void*>(&result) < static_cast<void*>(begin()));74 BASSERT(static_cast<void*>(&result) < static_cast<void*>(begin())); 75 75 return result; 76 76 } … … 81 81 // can stuff our size into the remaining metadata. 82 82 size_t& result = *reinterpret_cast<size_t*>(roundUpToMultipleOf<alignment>(&range() + 1)); 83 ASSERT(static_cast<void*>(&result) < static_cast<void*>(begin()));83 BASSERT(static_cast<void*>(&result) < static_cast<void*>(begin())); 84 84 return result; 85 85 }
Note:
See TracChangeset
for help on using the changeset viewer.