Lines Matching refs:Slot
115 // The slot header.
116 class Slot {
118 Slot* Next() const {
121 void SetNext(Slot* next) {
124 // The slot right before this slot in terms of the address.
125 Slot* Left(size_t bracket_size) {
126 return reinterpret_cast<Slot*>(reinterpret_cast<uintptr_t>(this) - bracket_size);
133 Slot* next_; // Next slot in the list.
145 Slot* Head() const {
146 return reinterpret_cast<Slot*>(head_);
148 Slot* Tail() const {
150 return reinterpret_cast<Slot*>(tail_);
156 Slot* Remove() {
157 Slot* slot;
161 Slot** headp = reinterpret_cast<Slot**>(&head_);
162 Slot** tailp = kUseTail ? reinterpret_cast<Slot**>(&tail_) : nullptr;
163 Slot* old_head = *headp;
175 Slot* old_head_next = old_head->Next();
176 slot = old_head;
183 slot->Clear();
188 return slot;
190 void Add(Slot* slot) {
194 DCHECK(slot != nullptr);
195 DCHECK(slot->Next() == nullptr);
196 Slot** headp = reinterpret_cast<Slot**>(&head_);
197 Slot** tailp = kUseTail ? reinterpret_cast<Slot**>(&tail_) : nullptr;
198 Slot* old_head = *headp;
204 *headp = slot;
206 *tailp = slot;
213 *headp = slot;
214 slot->SetNext(old_head);
235 Slot** headp = reinterpret_cast<Slot**>(&head_);
236 Slot** tailp = kUseTail ? reinterpret_cast<Slot**>(&tail_) : nullptr;
237 Slot* old_head = *headp;
269 Slot* head = reinterpret_cast<Slot*>(head_);
270 Slot* tail = kUseTail ? reinterpret_cast<Slot*>(tail_) : nullptr;
282 for (Slot* slot = head; slot != nullptr; slot = slot->Next()) {
284 if (kUseTail && slot->Next() == nullptr) {
285 CHECK_EQ(slot, tail);
293 // A pointer (Slot*) to the head of the list. Always 8 bytes so that we will have the same
297 // (won't open up enough space to cause an extra slot to be available).
299 // A pointer (Slot*) to the tail of the list. Always 8 bytes so that we will have the same
339 // | slot 0 |
341 // | slot 1 |
343 // | slot 2 |
347 // | last slot |
362 // Slot 0
363 // Slot 1
370 Slot* FirstSlot() const {
372 return reinterpret_cast<Slot*>(reinterpret_cast<uintptr_t>(this) + headerSizes[idx]);
374 Slot* LastSlot() {
378 Slot* last_slot = reinterpret_cast<Slot*>(end - bracket_size);
404 Slot* first_slot = FirstSlot();
405 // Add backwards so the first slot is at the head of the list.
406 for (Slot* slot = LastSlot(); slot >= first_slot; slot = slot->Left(bracket_size)) {
407 free_list_.Add(slot);
420 // Allocates a slot in a run.
422 // Frees a slot in a run. This is used in a non-bulk free.
424 // Add the given slot to the bulk free list. Returns the bracket size.
426 // Add the given slot to the thread-local free list.
448 // Zero the run's header and the slot headers.
466 // Check a given pointer is a valid slot address and return it as Slot*.
467 Slot* ToSlot(void* ptr) {
475 return reinterpret_cast<Slot*>(ptr);
477 Slot* slot) const {
480 const size_t offset_from_slot_base = reinterpret_cast<uint8_t*>(slot)
497 // The sizes (the slot sizes, in bytes) of the size brackets.
781 // Allocate/free a run slot.
785 // Allocate/free a run slot without acquiring locks.
840 return OFFSETOF_MEMBER(Slot, next_);
866 // Returns the size of the allocated slot for a given allocated memory chunk.
868 // Returns the size of the allocated slot for a given size.