From 39728d331a1ae2989bc1922d3c97ee1fe3289670 Mon Sep 17 00:00:00 2001 From: Herb Derby Date: Wed, 25 Jan 2017 17:05:05 -0500 Subject: [PATCH] Simplify Footers in SkArenaAlloc to 64-bit values using pointers. TBR=mtklein@google.com Change-Id: I72c6cf6857b2bb00f4259cc9c4de2d51d454e6ab Reviewed-on: https://skia-review.googlesource.com/7582 Reviewed-by: Herb Derby Commit-Queue: Herb Derby --- src/core/SkArenaAlloc.cpp | 23 +++++++++-------------- src/core/SkArenaAlloc.h | 14 +++++++++----- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/core/SkArenaAlloc.cpp b/src/core/SkArenaAlloc.cpp index 787c5cab8c..90b703721e 100644 --- a/src/core/SkArenaAlloc.cpp +++ b/src/core/SkArenaAlloc.cpp @@ -23,8 +23,8 @@ void SkArenaAlloc::RunDtorsOnBlock(char* footerEnd) { Footer footer; memcpy(&footer, footerEnd - sizeof(Footer), sizeof(Footer)); - FooterAction* action = (FooterAction*)((char*)end_chain + (footer >> 5)); - ptrdiff_t padding = footer & 31; + FooterAction* action = (FooterAction*)(footer >> 6); + ptrdiff_t padding = footer & 63; footerEnd = action(footerEnd) - padding; } @@ -65,27 +65,22 @@ void SkArenaAlloc::reset() { new (this) SkArenaAlloc{fFirstBlock, fFirstSize, fExtraSize}; } -void SkArenaAlloc::installFooter(FooterAction* releaser, ptrdiff_t padding) { - ptrdiff_t releaserDiff = (char *)releaser - (char *)end_chain; - ptrdiff_t footerData = SkLeftShift((int64_t)releaserDiff, 5) | padding; - if (padding >= 32 || !SkTFitsIn