Title: [275948] trunk/Source
- Revision
- 275948
- Author
- [email protected]
- Date
- 2021-04-14 09:19:42 -0700 (Wed, 14 Apr 2021)
Log Message
Reduce maximum HashTable entry size to 128 bytes
https://bugs.webkit.org/show_bug.cgi?id=224381
Reviewed by Yusuke Suzuki.
Source/WebKit:
* WebProcess/WebPage/ViewUpdateDispatcher.cpp:
(WebKit::ViewUpdateDispatcher::visibleContentRectUpdate):
(WebKit::ViewUpdateDispatcher::dispatchVisibleContentRectUpdate):
* WebProcess/WebPage/ViewUpdateDispatcher.h:
(WebKit::ViewUpdateDispatcher::UpdateData::UpdateData):
Source/WTF:
It turns out that HashMaps use HashTable::Value as KeyValuePair, so sizeof(Key) + sizeof(Value) was double counting the key size.
This caused FontCascadeCache to be a false positive. It has a key size of a little over 100 bytes. Only counting it once reflects what is intended.
Also, the USE(ANGLE) exception was convenient for a downstream branch, but isn't needed. Next time they rebase they will use UniqueRef.
* wtf/HashTable.h:
(WTF::KeyTraits>::inlineLookup):
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (275947 => 275948)
--- trunk/Source/WTF/ChangeLog 2021-04-14 16:07:38 UTC (rev 275947)
+++ trunk/Source/WTF/ChangeLog 2021-04-14 16:19:42 UTC (rev 275948)
@@ -1,3 +1,17 @@
+2021-04-14 Alex Christensen <[email protected]>
+
+ Reduce maximum HashTable entry size to 128 bytes
+ https://bugs.webkit.org/show_bug.cgi?id=224381
+
+ Reviewed by Yusuke Suzuki.
+
+ It turns out that HashMaps use HashTable::Value as KeyValuePair, so sizeof(Key) + sizeof(Value) was double counting the key size.
+ This caused FontCascadeCache to be a false positive. It has a key size of a little over 100 bytes. Only counting it once reflects what is intended.
+ Also, the USE(ANGLE) exception was convenient for a downstream branch, but isn't needed. Next time they rebase they will use UniqueRef.
+
+ * wtf/HashTable.h:
+ (WTF::KeyTraits>::inlineLookup):
+
2021-04-13 Ada Chan <[email protected]>
Implement PlatformXRSystem::xrCoordinator() for USE(APPLE_INTERNAL_SDK)
Modified: trunk/Source/WTF/wtf/HashTable.h (275947 => 275948)
--- trunk/Source/WTF/wtf/HashTable.h 2021-04-14 16:07:38 UTC (rev 275947)
+++ trunk/Source/WTF/wtf/HashTable.h 2021-04-14 16:19:42 UTC (rev 275948)
@@ -665,11 +665,8 @@
template<typename HashTranslator, typename T>
ALWAYS_INLINE auto HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::inlineLookup(const T& key) -> ValueType*
{
-#if USE(ANGLE)
- static_assert(sizeof(Key) + sizeof(Value) < 250, "Your HashTable types are too big to efficiently move when rehashing. Consider using UniqueRef instead");
-#else
- // FIXME: https://bugs.webkit.org/show_bug.cgi?id=223637
- static_assert(sizeof(Key) + sizeof(Value) < 400, "Your HashTable types are too big to efficiently move when rehashing. Consider using UniqueRef instead");
+#if !PLATFORM(WIN) // FIXME: Get this working in the Windows build.
+ static_assert(sizeof(Value) <= 128, "Your HashTable types are too big to efficiently move when rehashing. Consider using UniqueRef instead");
#endif
checkKey<HashTranslator>(key);
Modified: trunk/Source/WebKit/ChangeLog (275947 => 275948)
--- trunk/Source/WebKit/ChangeLog 2021-04-14 16:07:38 UTC (rev 275947)
+++ trunk/Source/WebKit/ChangeLog 2021-04-14 16:19:42 UTC (rev 275948)
@@ -1,3 +1,16 @@
+2021-04-14 Alex Christensen <[email protected]>
+
+ Reduce maximum HashTable entry size to 128 bytes
+ https://bugs.webkit.org/show_bug.cgi?id=224381
+
+ Reviewed by Yusuke Suzuki.
+
+ * WebProcess/WebPage/ViewUpdateDispatcher.cpp:
+ (WebKit::ViewUpdateDispatcher::visibleContentRectUpdate):
+ (WebKit::ViewUpdateDispatcher::dispatchVisibleContentRectUpdate):
+ * WebProcess/WebPage/ViewUpdateDispatcher.h:
+ (WebKit::ViewUpdateDispatcher::UpdateData::UpdateData):
+
2021-04-14 Chris Dumez <[email protected]>
[iOS] WKMouseDeviceObserver is calling WebProcessProxy::send() on a non-main thread
Modified: trunk/Source/WebKit/WebProcess/WebPage/ViewUpdateDispatcher.cpp (275947 => 275948)
--- trunk/Source/WebKit/WebProcess/WebPage/ViewUpdateDispatcher.cpp 2021-04-14 16:07:38 UTC (rev 275947)
+++ trunk/Source/WebKit/WebProcess/WebPage/ViewUpdateDispatcher.cpp 2021-04-14 16:19:42 UTC (rev 275948)
@@ -64,9 +64,9 @@
updateListWasEmpty = m_latestUpdate.isEmpty();
auto iterator = m_latestUpdate.find(pageID);
if (iterator == m_latestUpdate.end())
- m_latestUpdate.set<UpdateData>(pageID, { visibleContentRectUpdateInfo, visibleContentRectUpdateInfo.timestamp() });
+ m_latestUpdate.set(pageID, makeUniqueRef<UpdateData>(visibleContentRectUpdateInfo, visibleContentRectUpdateInfo.timestamp()));
else
- iterator->value.visibleContentRectUpdateInfo = visibleContentRectUpdateInfo;
+ iterator->value.get().visibleContentRectUpdateInfo = visibleContentRectUpdateInfo;
}
if (updateListWasEmpty) {
RunLoop::main().dispatch([protectedThis = makeRef(*this)]() mutable {
@@ -77,15 +77,15 @@
void ViewUpdateDispatcher::dispatchVisibleContentRectUpdate()
{
- HashMap<WebCore::PageIdentifier, UpdateData> update;
+ HashMap<WebCore::PageIdentifier, UniqueRef<UpdateData>> update;
{
LockHolder locker(&m_dataMutex);
- update = WTFMove(m_latestUpdate);
+ update = std::exchange(m_latestUpdate, { });
}
for (auto& slot : update) {
if (WebPage* webPage = WebProcess::singleton().webPage(slot.key))
- webPage->updateVisibleContentRects(slot.value.visibleContentRectUpdateInfo, slot.value.oldestTimestamp);
+ webPage->updateVisibleContentRects(slot.value.get().visibleContentRectUpdateInfo, slot.value.get().oldestTimestamp);
}
}
Modified: trunk/Source/WebKit/WebProcess/WebPage/ViewUpdateDispatcher.h (275947 => 275948)
--- trunk/Source/WebKit/WebProcess/WebPage/ViewUpdateDispatcher.h 2021-04-14 16:07:38 UTC (rev 275947)
+++ trunk/Source/WebKit/WebProcess/WebPage/ViewUpdateDispatcher.h 2021-04-14 16:19:42 UTC (rev 275948)
@@ -54,6 +54,11 @@
void dispatchVisibleContentRectUpdate();
struct UpdateData {
+ WTF_MAKE_STRUCT_FAST_ALLOCATED;
+ UpdateData(const VisibleContentRectUpdateInfo& info, MonotonicTime timestamp)
+ : visibleContentRectUpdateInfo(info)
+ , oldestTimestamp(timestamp) { }
+
VisibleContentRectUpdateInfo visibleContentRectUpdateInfo;
MonotonicTime oldestTimestamp;
};
@@ -60,7 +65,7 @@
Ref<WorkQueue> m_queue;
Lock m_dataMutex;
- HashMap<WebCore::PageIdentifier, UpdateData> m_latestUpdate;
+ HashMap<WebCore::PageIdentifier, UniqueRef<UpdateData>> m_latestUpdate;
};
} // namespace WebKit
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes