Bug 186733

Summary: ensurePropertyReplacementWatchpointSet wastes 308KB of HashTable capacity on cnn.com
Product: WebKit Reporter: Simon Fraser (smfr) <simon.fraser>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: keith_miller, saam, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Description Simon Fraser (smfr) 2018-06-16 12:28:12 PDT
Using tooling from bug 186698, loading can and running "notifyutil -p com.apple.WebKit.dumpHashTableCapacity" shows:

Wasted capacity: 168032 bytes (used 34720 of 202752 bytes, utilization: 17.12%) - 1441 allocations
1   0x116684e05 WTF::HashTable<int, WTF::KeyValuePair<int, WTF::RefPtr<JSC::WatchpointSet, WTF::DumbPtrTraits<JSC::WatchpointSet> > >, WTF::KeyValuePairKeyExtractor<WTF::KeyValuePair<int, WTF::RefPtr<JSC::WatchpointSet, WTF::DumbPtrTraits<JSC::WatchpointSet> > > >, WTF::IntHash<int>, WTF::HashMap<int, WTF::RefPtr<JSC::WatchpointSet, WTF::DumbPtrTraits<JSC::WatchpointSet> >, WTF::IntHash<int>, WTF::UnsignedWithZeroKeyHashTraits<int>, WTF::HashTraits<WTF::RefPtr<JSC::WatchpointSet, WTF::DumbPtrTraits<JSC::WatchpointSet> > > >::KeyValuePairTraits, WTF::UnsignedWithZeroKeyHashTraits<int> >::HashTable()
2   0x116684de5 WTF::HashMap<int, WTF::RefPtr<JSC::WatchpointSet, WTF::DumbPtrTraits<JSC::WatchpointSet> >, WTF::IntHash<int>, WTF::UnsignedWithZeroKeyHashTraits<int>, WTF::HashTraits<WTF::RefPtr<JSC::WatchpointSet, WTF::DumbPtrTraits<JSC::WatchpointSet> > > >::HashMap()
3   0x116684dc5 WTF::HashMap<int, WTF::RefPtr<JSC::WatchpointSet, WTF::DumbPtrTraits<JSC::WatchpointSet> >, WTF::IntHash<int>, WTF::UnsignedWithZeroKeyHashTraits<int>, WTF::HashTraits<WTF::RefPtr<JSC::WatchpointSet, WTF::DumbPtrTraits<JSC::WatchpointSet> > > >::HashMap()
4   0x1166754f2 JSC::Structure::ensurePropertyReplacementWatchpointSet(JSC::VM&, int)
5   0x1157cf3af JSC::PropertyCondition::isWatchableWhenValid(JSC::Structure*, JSC::PropertyCondition::WatchabilityEffort) const
6   0x1157cf510 JSC::PropertyCondition::isWatchable(JSC::Structure*, JSC::JSObject*, JSC::PropertyCondition::WatchabilityEffort) const
7   0x1157bdca0 JSC::ObjectPropertyCondition::isWatchable(JSC::Structure*, JSC::PropertyCondition::WatchabilityEffort) const
8   0x1157bb17b JSC::ObjectPropertyCondition::isWatchable(JSC::PropertyCondition::WatchabilityEffort) const
Comment 1 Radar WebKit Bug Importer 2018-06-16 12:28:35 PDT
<rdar://problem/41189144>
Comment 2 Simon Fraser (smfr) 2018-06-16 12:29:58 PDT
Also this code path:

Wasted capacity: 140416 bytes (used 44928 of 185344 bytes, utilization: 24.24%) - 1018 allocations
1   0x116684e05 WTF::HashTable<int, WTF::KeyValuePair<int, WTF::RefPtr<JSC::WatchpointSet, WTF::DumbPtrTraits<JSC::WatchpointSet> > >, WTF::KeyValuePairKeyExtractor<WTF::KeyValuePair<int, WTF::RefPtr<JSC::WatchpointSet, WTF::DumbPtrTraits<JSC::WatchpointSet> > > >, WTF::IntHash<int>, WTF::HashMap<int, WTF::RefPtr<JSC::WatchpointSet, WTF::DumbPtrTraits<JSC::WatchpointSet> >, WTF::IntHash<int>, WTF::UnsignedWithZeroKeyHashTraits<int>, WTF::HashTraits<WTF::RefPtr<JSC::WatchpointSet, WTF::DumbPtrTraits<JSC::WatchpointSet> > > >::KeyValuePairTraits, WTF::UnsignedWithZeroKeyHashTraits<int> >::HashTable()
2   0x116684de5 WTF::HashMap<int, WTF::RefPtr<JSC::WatchpointSet, WTF::DumbPtrTraits<JSC::WatchpointSet> >, WTF::IntHash<int>, WTF::UnsignedWithZeroKeyHashTraits<int>, WTF::HashTraits<WTF::RefPtr<JSC::WatchpointSet, WTF::DumbPtrTraits<JSC::WatchpointSet> > > >::HashMap()
3   0x116684dc5 WTF::HashMap<int, WTF::RefPtr<JSC::WatchpointSet, WTF::DumbPtrTraits<JSC::WatchpointSet> >, WTF::IntHash<int>, WTF::UnsignedWithZeroKeyHashTraits<int>, WTF::HashTraits<WTF::RefPtr<JSC::WatchpointSet, WTF::DumbPtrTraits<JSC::WatchpointSet> > > >::HashMap()
4   0x1166754f2 JSC::Structure::ensurePropertyReplacementWatchpointSet(JSC::VM&, int)
5   0x116675b58 JSC::Structure::didCachePropertyReplacement(JSC::VM&, int)
6   0x11626c20a llint_slow_path_put_by_id
7   0x11531710f llint_entry
8   0x11531b8d6 llint_entry
Comment 3 Simon Fraser (smfr) 2018-06-16 12:33:47 PDT
Also:

Wasted capacity: 67888 bytes (used 18000 of 85888 bytes, utilization: 20.96%) - 551 allocations
1   0x116684e05 WTF::HashTable<int, WTF::KeyValuePair<int, WTF::RefPtr<JSC::WatchpointSet, WTF::DumbPtrTraits<JSC::WatchpointSet> > >, WTF::KeyValuePairKeyExtractor<WTF::KeyValuePair<int, WTF::RefPtr<JSC::WatchpointSet, WTF::DumbPtrTraits<JSC::WatchpointSet> > > >, WTF::IntHash<int>, WTF::HashMap<int, WTF::RefPtr<JSC::WatchpointSet, WTF::DumbPtrTraits<JSC::WatchpointSet> >, WTF::IntHash<int>, WTF::UnsignedWithZeroKeyHashTraits<int>, WTF::HashTraits<WTF::RefPtr<JSC::WatchpointSet, WTF::DumbPtrTraits<JSC::WatchpointSet> > > >::KeyValuePairTraits, WTF::UnsignedWithZeroKeyHashTraits<int> >::HashTable()
2   0x116684de5 WTF::HashMap<int, WTF::RefPtr<JSC::WatchpointSet, WTF::DumbPtrTraits<JSC::WatchpointSet> >, WTF::IntHash<int>, WTF::UnsignedWithZeroKeyHashTraits<int>, WTF::HashTraits<WTF::RefPtr<JSC::WatchpointSet, WTF::DumbPtrTraits<JSC::WatchpointSet> > > >::HashMap()
3   0x116684dc5 WTF::HashMap<int, WTF::RefPtr<JSC::WatchpointSet, WTF::DumbPtrTraits<JSC::WatchpointSet> >, WTF::IntHash<int>, WTF::UnsignedWithZeroKeyHashTraits<int>, WTF::HashTraits<WTF::RefPtr<JSC::WatchpointSet, WTF::DumbPtrTraits<JSC::WatchpointSet> > > >::HashMap()
4   0x1166754f2 JSC::Structure::ensurePropertyReplacementWatchpointSet(JSC::VM&, int)
5   0x1156e0cb3 JSC::Structure::startWatchingPropertyForReplacements(JSC::VM&, int)
6   0x11624959d JSC::tryCacheGetByID(JSC::ExecState*, JSC::JSValue, JSC::Identifier const&, JSC::PropertySlot const&, JSC::StructureStubInfo&, JSC::GetByIDKind)
7   0x116247627 JSC::repatchGetByID(JSC::ExecState*, JSC::JSValue, JSC::Identifier const&, JSC::PropertySlot const&, JSC::StructureStubInfo&, JSC::GetByIDKind)
8   0x116226f97 operationGetByIdOptimize::$_1::operator()(bool, JSC::PropertySlot&) const