OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 // for an freed entry. Given that the smallest entry size is | 178 // for an freed entry. Given that the smallest entry size is |
179 // allocationGranurarity, HeapObjectHeader must fit into the size. | 179 // allocationGranurarity, HeapObjectHeader must fit into the size. |
180 static_assert(sizeof(HeapObjectHeader) <= allocationGranularity, "size o
f HeapObjectHeader must be smaller than allocationGranularity"); | 180 static_assert(sizeof(HeapObjectHeader) <= allocationGranularity, "size o
f HeapObjectHeader must be smaller than allocationGranularity"); |
181 #if CPU(64BIT) | 181 #if CPU(64BIT) |
182 static_assert(sizeof(HeapObjectHeader) == 8, "size of HeapObjectHeader m
ust be 8 byte aligned"); | 182 static_assert(sizeof(HeapObjectHeader) == 8, "size of HeapObjectHeader m
ust be 8 byte aligned"); |
183 #endif | 183 #endif |
184 | 184 |
185 ASSERT(gcInfoIndex < GCInfoTable::maxIndex); | 185 ASSERT(gcInfoIndex < GCInfoTable::maxIndex); |
186 ASSERT(size < nonLargeObjectPageSizeMax); | 186 ASSERT(size < nonLargeObjectPageSizeMax); |
187 ASSERT(!(size & allocationMask)); | 187 ASSERT(!(size & allocationMask)); |
188 m_encoded = (gcInfoIndex << headerGCInfoIndexShift) | size | (gcInfoInde
x == gcInfoIndexForFreeListHeader ? headerFreedBitMask : 0); | 188 m_encoded = static_cast<uint32_t>((gcInfoIndex << headerGCInfoIndexShift
) | size | (gcInfoIndex == gcInfoIndexForFreeListHeader ? headerFreedBitMask : 0
)); |
189 } | 189 } |
190 | 190 |
191 NO_SANITIZE_ADDRESS | 191 NO_SANITIZE_ADDRESS |
192 bool isFree() const { return m_encoded & headerFreedBitMask; } | 192 bool isFree() const { return m_encoded & headerFreedBitMask; } |
193 NO_SANITIZE_ADDRESS | 193 NO_SANITIZE_ADDRESS |
194 bool isPromptlyFreed() const { return (m_encoded & headerPromptlyFreedBitMas
k) == headerPromptlyFreedBitMask; } | 194 bool isPromptlyFreed() const { return (m_encoded & headerPromptlyFreedBitMas
k) == headerPromptlyFreedBitMask; } |
195 NO_SANITIZE_ADDRESS | 195 NO_SANITIZE_ADDRESS |
196 void markPromptlyFreed() { m_encoded |= headerPromptlyFreedBitMask; } | 196 void markPromptlyFreed() { m_encoded |= headerPromptlyFreedBitMask; } |
197 size_t size() const; | 197 size_t size() const; |
198 | 198 |
199 NO_SANITIZE_ADDRESS | 199 NO_SANITIZE_ADDRESS |
200 size_t gcInfoIndex() const { return (m_encoded & headerGCInfoIndexMask) >> h
eaderGCInfoIndexShift; } | 200 size_t gcInfoIndex() const { return (m_encoded & headerGCInfoIndexMask) >> h
eaderGCInfoIndexShift; } |
201 NO_SANITIZE_ADDRESS | 201 NO_SANITIZE_ADDRESS |
202 void setSize(size_t size) { m_encoded = size | (m_encoded & ~headerSizeMask)
; } | 202 void setSize(size_t size) |
| 203 { |
| 204 ASSERT(size < nonLargeObjectPageSizeMax); |
| 205 m_encoded = static_cast<uint32_t>(size) | (m_encoded & ~headerSizeMask); |
| 206 } |
203 bool isMarked() const; | 207 bool isMarked() const; |
204 void mark(); | 208 void mark(); |
205 void unmark(); | 209 void unmark(); |
206 void markDead(); | 210 void markDead(); |
207 bool isDead() const; | 211 bool isDead() const; |
208 | 212 |
209 Address payload(); | 213 Address payload(); |
210 size_t payloadSize(); | 214 size_t payloadSize(); |
211 Address payloadEnd(); | 215 Address payloadEnd(); |
212 | 216 |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 SET_MEMORY_ACCESSIBLE(result, allocationSize - sizeof(HeapObjectHeader))
; | 873 SET_MEMORY_ACCESSIBLE(result, allocationSize - sizeof(HeapObjectHeader))
; |
870 ASSERT(findPageFromAddress(headerAddress + allocationSize - 1)); | 874 ASSERT(findPageFromAddress(headerAddress + allocationSize - 1)); |
871 return result; | 875 return result; |
872 } | 876 } |
873 return outOfLineAllocate(allocationSize, gcInfoIndex); | 877 return outOfLineAllocate(allocationSize, gcInfoIndex); |
874 } | 878 } |
875 | 879 |
876 } // namespace blink | 880 } // namespace blink |
877 | 881 |
878 #endif // HeapPage_h | 882 #endif // HeapPage_h |
OLD | NEW |