inline SkArenaAlloc::allocObject()

Call overhead does appear to be showing up on our profiles.

Change-Id: If3875a8972769f45282e0eb1d4aef6324cd56878
Reviewed-on: https://skia-review.googlesource.com/17833
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
This commit is contained in:
Mike Klein 2017-05-24 12:19:02 -04:00 committed by Skia Commit-Bot
parent 6ecc373cde
commit 791625596d
2 changed files with 9 additions and 11 deletions

View File

@ -139,16 +139,6 @@ void SkArenaAlloc::ensureSpace(uint32_t size, uint32_t alignment) {
this->installPtrFooter(NextBlock, previousDtor, 0);
}
char* SkArenaAlloc::allocObject(uint32_t size, uint32_t alignment) {
uintptr_t mask = alignment - 1;
char* objStart = (char*)((uintptr_t)(fCursor + mask) & ~mask);
if ((ptrdiff_t)size > fEnd - objStart) {
this->ensureSpace(size, alignment);
objStart = (char*)((uintptr_t)(fCursor + mask) & ~mask);
}
return objStart;
}
char* SkArenaAlloc::allocObjectWithFooter(uint32_t sizeIncludingFooter, uint32_t alignment) {
uintptr_t mask = alignment - 1;

View File

@ -159,7 +159,15 @@ private:
void ensureSpace(uint32_t size, uint32_t alignment);
char* allocObject(uint32_t size, uint32_t alignment);
char* allocObject(uint32_t size, uint32_t alignment) {
uintptr_t mask = alignment - 1;
char* objStart = (char*)((uintptr_t)(fCursor + mask) & ~mask);
if ((ptrdiff_t)size > fEnd - objStart) {
this->ensureSpace(size, alignment);
objStart = (char*)((uintptr_t)(fCursor + mask) & ~mask);
}
return objStart;
}
char* allocObjectWithFooter(uint32_t sizeIncludingFooter, uint32_t alignment);