Lines Matching refs:size

310   // Represents a run of memory slots of the same size.
353 uint8_t size_bracket_idx_; // The index of the size bracket of this run.
366 // Returns the byte size of the header.
424 // Add the given slot to the bulk free list. Returns the bracket size.
461 // size.
495 // The number of size brackets.
497 // The sizes (the slot sizes, in bytes) of the size brackets.
499 // The numbers of pages that are used for runs for each size bracket.
501 // The numbers of slots of the runs for each size bracket.
503 // The header sizes in bytes of the runs for each size bracket.
510 // Returns the byte size of the bracket size from the index.
515 // Returns the index of the size bracket from the bracket size.
516 static size_t BracketSizeToIndex(size_t size) {
517 DCHECK(8 <= size &&
518 ((size <= kMaxThreadLocalBracketSize && size % kThreadLocalBracketQuantumSize == 0) ||
519 (size <= kMaxRegularBracketSize && size % kBracketQuantumSize == 0) ||
520 size == 1 * KB || size == 2 * KB));
522 if (UNLIKELY(size == 1 * KB)) {
524 } else if (UNLIKELY(size == 2 * KB)) {
526 } else if (LIKELY(size <= kMaxThreadLocalBracketSize)) {
527 DCHECK_EQ(size % kThreadLocalBracketQuantumSize, 0U);
528 idx = size / kThreadLocalBracketQuantumSize - 1;
530 DCHECK(size <= kMaxRegularBracketSize);
531 DCHECK_EQ((size - kMaxThreadLocalBracketSize) % kBracketQuantumSize, 0U);
532 idx = ((size - kMaxThreadLocalBracketSize) / kBracketQuantumSize - 1)
535 DCHECK(bracketSizes[idx] == size);
538 // Returns true if the given allocation size is for a thread local allocation.
539 static bool IsSizeForThreadLocal(size_t size) {
540 bool is_size_for_thread_local = size <= kMaxThreadLocalBracketSize;
541 DCHECK(size > kLargeSizeThreshold ||
542 (is_size_for_thread_local == (SizeToIndex(size) < kNumThreadLocalSizeBrackets)));
545 // Rounds up the size up the nearest bracket size.
546 static size_t RoundToBracketSize(size_t size) {
547 DCHECK(size <= kLargeSizeThreshold);
548 if (LIKELY(size <= kMaxThreadLocalBracketSize)) {
549 return RoundUp(size, kThreadLocalBracketQuantumSize);
550 } else if (size <= kMaxRegularBracketSize) {
551 return RoundUp(size, kBracketQuantumSize);
552 } else if (UNLIKELY(size <= 1 * KB)) {
555 DCHECK_LE(size, 2 * KB);
559 // Returns the size bracket index from the byte size with rounding.
560 static size_t SizeToIndex(size_t size) {
561 DCHECK(size <= kLargeSizeThreshold);
562 if (LIKELY(size <= kMaxThreadLocalBracketSize)) {
563 return RoundUp(size, kThreadLocalBracketQuantumSize) / kThreadLocalBracketQuantumSize - 1;
564 } else if (size <= kMaxRegularBracketSize) {
565 return (RoundUp(size, kBracketQuantumSize) - kMaxThreadLocalBracketSize) / kBracketQuantumSize
567 } else if (size <= 1 * KB) {
570 DCHECK_LE(size, 2 * KB);
575 static size_t SizeToIndexAndBracketSize(size_t size, size_t* bracket_size_out) {
576 DCHECK(size <= kLargeSizeThreshold);
579 if (LIKELY(size <= kMaxThreadLocalBracketSize)) {
580 bracket_size = RoundUp(size, kThreadLocalBracketQuantumSize);
582 } else if (size <= kMaxRegularBracketSize) {
583 bracket_size = RoundUp(size, kBracketQuantumSize);
586 } else if (size <= 1 * KB) {
590 DCHECK(size <= 2 * KB);
594 DCHECK_EQ(idx, SizeToIndex(size)) << idx;
597 DCHECK_LE(size, bracket_size) << idx;
598 DCHECK(size > kMaxRegularBracketSize ||
599 (size <= kMaxThreadLocalBracketSize &&
600 bracket_size - size < kThreadLocalBracketQuantumSize) ||
601 (size <= kMaxRegularBracketSize && bracket_size - size < kBracketQuantumSize)) << idx;
607 // address is page size aligned.
621 // A memory allocation request larger than this size is treated as a large object and allocated
661 // We use thread-local runs for the size brackets whose indexes
669 // The size of the largest bracket we use thread-local runs for.
673 // We use regular (8 or 16-bytes increment) runs for the size brackets whose indexes are less than
677 // The size of the largest regular (8 or 16-byte increment) bracket. Non-regular brackets are the
681 // The bracket size increment for the thread-local brackets (<= kMaxThreadLocalBracketSize bytes).
687 // The bracket size increment for the non-thread-local, regular brackets (of size <=
725 // the size brackes that do not use thread-local
728 // The mutexes, one per size bracket.
747 // The table that indicates the size of free page runs. These sizes
763 // Under kPageReleaseModeSize(AndEnd), if the free page run size is
782 void* AllocFromRun(Thread* self, size_t size, size_t* bytes_allocated, size_t* usable_size,
787 void* AllocFromRunThreadUnsafe(Thread* self, size_t size, size_t* bytes_allocated,
792 // Returns the bracket size.
796 // Used to allocate a new thread local run for a size bracket.
799 // Used to acquire a new/reused run for a size bracket. Used when a
807 void* AllocLargeObject(Thread* self, size_t size, size_t* bytes_allocated,
846 void* Alloc(Thread* self, size_t size, size_t* bytes_allocated, size_t* usable_size,
856 ALWAYS_INLINE bool CanAllocFromThreadLocalRun(Thread* self, size_t size);
859 ALWAYS_INLINE void* AllocFromThreadLocalRun(Thread* self, size_t size, size_t* bytes_allocated);
862 // size in bulk, that is the maximum value for the
864 ALWAYS_INLINE size_t MaxBytesBulkAllocatedFor(size_t size);
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.