Lines Matching refs:size
516 static size_t BracketSizeToIndex(size_t size) { in BracketSizeToIndex() argument
517 DCHECK(8 <= size && in BracketSizeToIndex()
518 ((size <= kMaxThreadLocalBracketSize && size % kThreadLocalBracketQuantumSize == 0) || in BracketSizeToIndex()
519 (size <= kMaxRegularBracketSize && size % kBracketQuantumSize == 0) || in BracketSizeToIndex()
520 size == 1 * KB || size == 2 * KB)); in BracketSizeToIndex()
522 if (UNLIKELY(size == 1 * KB)) { in BracketSizeToIndex()
524 } else if (UNLIKELY(size == 2 * KB)) { in BracketSizeToIndex()
526 } else if (LIKELY(size <= kMaxThreadLocalBracketSize)) { in BracketSizeToIndex()
527 DCHECK_EQ(size % kThreadLocalBracketQuantumSize, 0U); in BracketSizeToIndex()
528 idx = size / kThreadLocalBracketQuantumSize - 1; in BracketSizeToIndex()
530 DCHECK(size <= kMaxRegularBracketSize); in BracketSizeToIndex()
531 DCHECK_EQ((size - kMaxThreadLocalBracketSize) % kBracketQuantumSize, 0U); in BracketSizeToIndex()
532 idx = ((size - kMaxThreadLocalBracketSize) / kBracketQuantumSize - 1) in BracketSizeToIndex()
535 DCHECK(bracketSizes[idx] == size); in BracketSizeToIndex()
539 static bool IsSizeForThreadLocal(size_t size) { in IsSizeForThreadLocal() argument
540 bool is_size_for_thread_local = size <= kMaxThreadLocalBracketSize; in IsSizeForThreadLocal()
541 DCHECK(size > kLargeSizeThreshold || in IsSizeForThreadLocal()
542 (is_size_for_thread_local == (SizeToIndex(size) < kNumThreadLocalSizeBrackets))); in IsSizeForThreadLocal()
546 static size_t RoundToBracketSize(size_t size) { in RoundToBracketSize() argument
547 DCHECK(size <= kLargeSizeThreshold); in RoundToBracketSize()
548 if (LIKELY(size <= kMaxThreadLocalBracketSize)) { in RoundToBracketSize()
549 return RoundUp(size, kThreadLocalBracketQuantumSize); in RoundToBracketSize()
550 } else if (size <= kMaxRegularBracketSize) { in RoundToBracketSize()
551 return RoundUp(size, kBracketQuantumSize); in RoundToBracketSize()
552 } else if (UNLIKELY(size <= 1 * KB)) { in RoundToBracketSize()
555 DCHECK_LE(size, 2 * KB); in RoundToBracketSize()
560 static size_t SizeToIndex(size_t size) { in SizeToIndex() argument
561 DCHECK(size <= kLargeSizeThreshold); in SizeToIndex()
562 if (LIKELY(size <= kMaxThreadLocalBracketSize)) { in SizeToIndex()
563 return RoundUp(size, kThreadLocalBracketQuantumSize) / kThreadLocalBracketQuantumSize - 1; in SizeToIndex()
564 } else if (size <= kMaxRegularBracketSize) { in SizeToIndex()
565 return (RoundUp(size, kBracketQuantumSize) - kMaxThreadLocalBracketSize) / kBracketQuantumSize in SizeToIndex()
567 } else if (size <= 1 * KB) { in SizeToIndex()
570 DCHECK_LE(size, 2 * KB); in SizeToIndex()
575 static size_t SizeToIndexAndBracketSize(size_t size, size_t* bracket_size_out) { in SizeToIndexAndBracketSize() argument
576 DCHECK(size <= kLargeSizeThreshold); in SizeToIndexAndBracketSize()
579 if (LIKELY(size <= kMaxThreadLocalBracketSize)) { in SizeToIndexAndBracketSize()
580 bracket_size = RoundUp(size, kThreadLocalBracketQuantumSize); in SizeToIndexAndBracketSize()
582 } else if (size <= kMaxRegularBracketSize) { in SizeToIndexAndBracketSize()
583 bracket_size = RoundUp(size, kBracketQuantumSize); in SizeToIndexAndBracketSize()
586 } else if (size <= 1 * KB) { in SizeToIndexAndBracketSize()
590 DCHECK(size <= 2 * KB); in SizeToIndexAndBracketSize()
594 DCHECK_EQ(idx, SizeToIndex(size)) << idx; in SizeToIndexAndBracketSize()
597 DCHECK_LE(size, bracket_size) << idx; in SizeToIndexAndBracketSize()
598 DCHECK(size > kMaxRegularBracketSize || in SizeToIndexAndBracketSize()
599 (size <= kMaxThreadLocalBracketSize && in SizeToIndexAndBracketSize()
600 bracket_size - size < kThreadLocalBracketQuantumSize) || in SizeToIndexAndBracketSize()
601 (size <= kMaxRegularBracketSize && bracket_size - size < kBracketQuantumSize)) << idx; in SizeToIndexAndBracketSize()
785 void* AllocFromRun(Thread* self, size_t size, size_t* bytes_allocated, size_t* usable_size,
790 void* AllocFromRunThreadUnsafe(Thread* self, size_t size, size_t* bytes_allocated,
810 void* AllocLargeObject(Thread* self, size_t size, size_t* bytes_allocated,
849 void* Alloc(Thread* self, size_t size, size_t* bytes_allocated, size_t* usable_size,
859 ALWAYS_INLINE bool CanAllocFromThreadLocalRun(Thread* self, size_t size);
862 ALWAYS_INLINE void* AllocFromThreadLocalRun(Thread* self, size_t size, size_t* bytes_allocated);
867 ALWAYS_INLINE size_t MaxBytesBulkAllocatedFor(size_t size);