Changeset 180688 in webkit
- Timestamp:
- Feb 26, 2015, 11:30:11 AM (12 years ago)
- Location:
- trunk/Source/bmalloc
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
bmalloc/Algorithm.h (modified) (1 diff)
-
bmalloc/BoundaryTag.h (modified) (3 diffs)
-
bmalloc/Sizes.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/bmalloc/ChangeLog
r180604 r180688 1 2015-02-26 Geoffrey Garen <ggaren@apple.com> 2 3 bmalloc: free up a bit in BoundaryTag 4 https://bugs.webkit.org/show_bug.cgi?id=142048 5 6 Reviewed by Brady Eidson. 7 8 We were wasting a bit by accident, and I need one now. 9 10 * bmalloc/Algorithm.h: 11 (bmalloc::rightShift): Deleted. Not needed, now that I've simplified 12 the math. 13 14 * bmalloc/BoundaryTag.h: Since each boundary tag bucket is 1024 bytes 15 long, the maximum offset into a bucket is 1023. 16 17 You need 5 bits to count up to 1024, but only 4 to count up to 1023. 18 19 Math is hard. 20 21 (bmalloc::BoundaryTag::compactBegin): Switched to division because it 22 is simpler, and easier to match up with our ASSERT. The compiler will 23 turn division by constant power of two into a shift for us. 24 25 (bmalloc::BoundaryTag::setRange): Added an ASSERT for compactBegin 26 because we do encode it, so we should ASSERT that encoding did not 27 lose information. 28 29 * bmalloc/Sizes.h: Shifting is no longer used since we use division 30 instead. 31 1 32 2015-02-24 Stephanie Lewis <slewis@apple.com> 2 33 -
trunk/Source/bmalloc/bmalloc/Algorithm.h
r180359 r180688 54 54 } 55 55 56 template<typename T> inline constexpr T rightShift(T value, uintptr_t shift)57 {58 return reinterpret_cast<T>(reinterpret_cast<uintptr_t>(value) >> shift);59 }60 61 56 template<typename T> inline constexpr bool test(T value, uintptr_t mask) 62 57 { -
trunk/Source/bmalloc/bmalloc/BoundaryTag.h
r180576 r180688 69 69 private: 70 70 static const size_t flagBits = 3; 71 static const size_t compactBeginBits = 5;71 static const size_t compactBeginBits = 4; 72 72 static const size_t sizeBits = bitCount<unsigned>() - flagBits - compactBeginBits; 73 73 74 static_assert((1 << compactBeginBits) - 1 >= largeMin / largeAlignment, "compactBegin must be encodable in a BoundaryTag."); 75 static_assert((1 << sizeBits) - 1 >= largeMax, "largeMax must be encodable in a BoundaryTag."); 74 static_assert( 75 (1 << compactBeginBits) - 1 >= (largeMin - 1) / largeAlignment, 76 "compactBegin must be encodable in a BoundaryTag."); 77 78 static_assert( 79 (1 << sizeBits) - 1 >= largeMax, 80 "largeMax must be encodable in a BoundaryTag."); 76 81 77 82 bool m_isFree: 1; … … 85 90 { 86 91 return static_cast<unsigned>( 87 reinterpret_cast<uintptr_t>( 88 rightShift( 89 mask(object, largeMin - 1), largeAlignmentShift))); 92 reinterpret_cast<uintptr_t>(mask(object, largeMin - 1)) / largeAlignment); 90 93 } 91 94 … … 93 96 { 94 97 m_compactBegin = compactBegin(range.begin()); 98 BASSERT(this->compactBegin() == compactBegin(range.begin())); 99 95 100 m_size = static_cast<unsigned>(range.size()); 96 101 BASSERT(this->size() == range.size()); -
trunk/Source/bmalloc/bmalloc/Sizes.h
r179927 r180688 77 77 78 78 static const size_t largeAlignment = 64; 79 static const size_t largeAlignmentShift = 6;80 static_assert(1 << largeAlignmentShift == largeAlignment, "largeAlignmentShift be log2(largeAlignment).");81 79 static const size_t largeMax = largeChunkSize * 99 / 100; // Plenty of room for metadata. 82 80 static const size_t largeMin = mediumMax;
Note:
See TracChangeset
for help on using the changeset viewer.