[webkit-changes] [WebKit/WebKit] c2eede: Every Timer objects wastes 7 bytes for padding

Ryosuke Niwa noreply at github.com
Sun Feb 4 13:42:20 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c2eedea2d5307cb97dfadde9f990ce1ab625d2f5
      https://github.com/WebKit/WebKit/commit/c2eedea2d5307cb97dfadde9f990ce1ab625d2f5
  Author: Ryosuke Niwa <rniwa at webkit.org>
  Date:   2024-02-04 (Sun, 04 Feb 2024)

  Changed paths:
    M Source/WebCore/platform/ThreadTimers.h
    M Source/WebCore/platform/Timer.cpp
    M Source/WebCore/platform/Timer.h

  Log Message:
  -----------
  Every Timer objects wastes 7 bytes for padding
https://bugs.webkit.org/show_bug.cgi?id=268703

Reviewed by Darin Adler.

Use a CompactRefPtrTuple to avoid 7-byte padding at the end of each Timer object.
Also use iso-heap for ThreadTimerHeapItem since this object historically had bad
memory management bugs.

* Source/WebCore/platform/ThreadTimers.h:
* Source/WebCore/platform/Timer.cpp:
(WebCore::TimerHeapLessThanFunction::compare):
(WebCore::SameSizeAsTimer::~SameSizeAsTimer):
(WebCore::TimerBase::~TimerBase):
(WebCore::TimerBase::nextFireInterval const):
(WebCore::TimerBase::checkHeapIndex const):
(WebCore::TimerBase::heapDecreaseKey):
(WebCore::TimerBase::heapDelete):
(WebCore::TimerBase::heapDeleteMin):
(WebCore::TimerBase::heapInsert):
(WebCore::TimerBase::heapPop):
(WebCore::TimerBase::heapPopMin):
(WebCore::TimerBase::hasValidHeapPosition const):
(WebCore::TimerBase::updateHeapIfNeeded):
(WebCore::TimerBase::setNextFireTime):
* Source/WebCore/platform/Timer.h:
(WebCore::TimerBase::nextFireTime const):
(WebCore::TimerBase::hasReachedMaxNestingLevel const):
(WebCore::TimerBase::augmentFireInterval):
(WebCore::TimerBase::bitfields const):
(WebCore::TimerBase::setBitfields):
(WebCore::TimerBase::inHeap const):
(WebCore::TimerBase::stop):
(WebCore::TimerBase::setHasReachedMaxNestingLevel):
(WebCore::DeferrableOneShotTimer::DeferrableOneShotTimer):
(WebCore::DeferrableOneShotTimer::restart):
(WebCore::DeferrableOneShotTimer::stop):
(WebCore::DeferrableOneShotTimer::setShouldRestartWhenTimerFires):

Canonical link: https://commits.webkit.org/274077@main




More information about the webkit-changes mailing list