Title: [243022] trunk/Source/WebCore
- Revision
- 243022
- Author
- [email protected]
- Date
- 2019-03-15 16:12:12 -0700 (Fri, 15 Mar 2019)
Log Message
REGRESSION (r239814): Most classes that user Timer have 7 bytes of padding after the Timer
https://bugs.webkit.org/show_bug.cgi?id=194196
Reviewed by Simon Fraser.
Use std::nan as the value of m_unalignedNextFireTime to indicate the timer had been deleted
instead of having a dedicated boolean, which consumes 7 extra bytes for padding.
Note that some code in WebKit uses +Infinity as a fire time so we can't use that.
* platform/Timer.cpp:
(WebCore::TimerBase::TimerBase):
(WebCore::TimerBase::~TimerBase):
(WebCore::TimerBase::setNextFireTime):
(WebCore::TimerBase::nextUnalignedFireInterval const):
* platform/Timer.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (243021 => 243022)
--- trunk/Source/WebCore/ChangeLog 2019-03-15 23:09:40 UTC (rev 243021)
+++ trunk/Source/WebCore/ChangeLog 2019-03-15 23:12:12 UTC (rev 243022)
@@ -1,3 +1,22 @@
+2019-03-15 Ryosuke Niwa <[email protected]>
+
+ REGRESSION (r239814): Most classes that user Timer have 7 bytes of padding after the Timer
+ https://bugs.webkit.org/show_bug.cgi?id=194196
+
+ Reviewed by Simon Fraser.
+
+ Use std::nan as the value of m_unalignedNextFireTime to indicate the timer had been deleted
+ instead of having a dedicated boolean, which consumes 7 extra bytes for padding.
+
+ Note that some code in WebKit uses +Infinity as a fire time so we can't use that.
+
+ * platform/Timer.cpp:
+ (WebCore::TimerBase::TimerBase):
+ (WebCore::TimerBase::~TimerBase):
+ (WebCore::TimerBase::setNextFireTime):
+ (WebCore::TimerBase::nextUnalignedFireInterval const):
+ * platform/Timer.h:
+
2019-03-15 Sihui Liu <[email protected]>
[ Mojave WK1 ] Layout Test storage/indexeddb/database-odd-names.html is failing
Modified: trunk/Source/WebCore/platform/Timer.cpp (243021 => 243022)
--- trunk/Source/WebCore/platform/Timer.cpp 2019-03-15 23:09:40 UTC (rev 243021)
+++ trunk/Source/WebCore/platform/Timer.cpp 2019-03-15 23:12:12 UTC (rev 243022)
@@ -254,7 +254,6 @@
}
TimerBase::TimerBase()
- : m_wasDeleted(false)
{
}
@@ -264,11 +263,9 @@
RELEASE_ASSERT(canAccessThreadLocalDataForThread(m_thread.get()) || shouldSuppressThreadSafetyCheck());
stop();
ASSERT(!inHeap());
- if (m_heapItem) {
+ if (m_heapItem)
m_heapItem->clearTimer();
- m_heapItem = nullptr;
- }
- m_wasDeleted = true;
+ m_unalignedNextFireTime = MonotonicTime::nan();
}
void TimerBase::start(Seconds nextFireInterval, Seconds repeatInterval)
@@ -467,10 +464,13 @@
{
ASSERT(canAccessThreadLocalDataForThread(m_thread.get()));
RELEASE_ASSERT(canAccessThreadLocalDataForThread(m_thread.get()) || shouldSuppressThreadSafetyCheck());
- RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(!m_wasDeleted);
+ bool timerHasBeenDeleted = std::isnan(m_unalignedNextFireTime);
+ RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(!timerHasBeenDeleted);
- if (m_unalignedNextFireTime != newTime)
+ if (m_unalignedNextFireTime != newTime) {
+ RELEASE_ASSERT(!std::isnan(newTime));
m_unalignedNextFireTime = newTime;
+ }
// Keep heap valid while changing the next-fire time.
MonotonicTime oldTime = nextFireTime();
@@ -517,7 +517,9 @@
Seconds TimerBase::nextUnalignedFireInterval() const
{
ASSERT(isActive());
- return std::max(m_unalignedNextFireTime - MonotonicTime::now(), 0_s);
+ auto result = std::max(m_unalignedNextFireTime - MonotonicTime::now(), 0_s);
+ RELEASE_ASSERT(std::isfinite(result));
+ return result;
}
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/Timer.h (243021 => 243022)
--- trunk/Source/WebCore/platform/Timer.h 2019-03-15 23:09:40 UTC (rev 243021)
+++ trunk/Source/WebCore/platform/Timer.h 2019-03-15 23:12:12 UTC (rev 243022)
@@ -96,7 +96,6 @@
MonotonicTime m_unalignedNextFireTime; // m_nextFireTime not considering alignment interval
Seconds m_repeatInterval; // 0 if not repeating
- bool m_wasDeleted { false };
RefPtr<ThreadTimerHeapItem> m_heapItem;
Ref<Thread> m_thread { Thread::current() };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes