Bug 186740

Summary: CodeBlockSet wastes 190KB of HashTable capacity on nytimes.com
Product: WebKit Reporter: Simon Fraser (smfr) <simon.fraser>
Component: JavaScriptCoreAssignee: Yusuke Suzuki <ysuzuki>
Status: NEW ---    
Severity: Normal CC: ews-watchlist, guijemont, guijemont+jsc-armv7-ews, keith_miller, mark.lam, msaboff, saam, simon.fraser, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

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

Wasted capacity: 189656 bytes (used 72488 of 262144 bytes, utilization: 27.65%) - 1 allocations
1   0x116005465 WTF::HashTable<JSC::CodeBlock*, JSC::CodeBlock*, WTF::IdentityExtractor, WTF::PtrHash<JSC::CodeBlock*>, WTF::HashTraits<JSC::CodeBlock*>, WTF::HashTraits<JSC::CodeBlock*> >::HashTable()
2   0x116005445 WTF::HashSet<JSC::CodeBlock*, WTF::PtrHash<JSC::CodeBlock*>, WTF::HashTraits<JSC::CodeBlock*> >::HashSet()
3   0x116001de5 WTF::HashSet<JSC::CodeBlock*, WTF::PtrHash<JSC::CodeBlock*>, WTF::HashTraits<JSC::CodeBlock*> >::HashSet()
4   0x116001da9 JSC::CodeBlockSet::CodeBlockSet()
5   0x116001e05 JSC::CodeBlockSet::CodeBlockSet()
6   0x11600ff64 JSC::Heap::Heap(JSC::VM*, JSC::HeapType)
7   0x1160126b3 JSC::Heap::Heap(JSC::VM*, JSC::HeapType)
8   0x1166b8e72 JSC::VM::VM(JSC::VM::VMType, JSC::HeapType)
Comment 1 Radar WebKit Bug Importer 2018-06-16 12:42:55 PDT
<rdar://problem/41189289>
Comment 2 Yusuke Suzuki 2019-04-27 23:46:30 PDT
CodeBlockSet is basically duplicate to IsoSubspace's set feature. But it exists for Debuggers and Sampling Profilers. If they are not enabled, we should not use this.
Comment 3 Yusuke Suzuki 2019-04-28 02:19:41 PDT
Created attachment 368426 [details]
Patch

WIP
Comment 4 Yusuke Suzuki 2019-04-28 04:25:44 PDT
I think we can implement CodeBlockSet with IsoCellSet with a bit interesting lock to support SamplingProfiler etc.
Comment 5 Yusuke Suzuki 2019-04-28 04:29:12 PDT
Created attachment 368428 [details]
Patch

WIP
Comment 6 jsc-armv7 EWS 2019-04-28 06:50:42 PDT
Comment on attachment 368428 [details]
Patch

Attachment 368428 [details] did not pass jsc-armv7-ews (jsc-only):
Output: https://webkit-queues.webkit.org/results/12022531

New failing tests:
stress/scope-operation-cache-global-property-bump-counter.js.default
apiTests
Comment 7 EWS Watchlist 2019-04-28 06:57:15 PDT
Comment on attachment 368428 [details]
Patch

Attachment 368428 [details] did not pass jsc-ews (mac):
Output: https://webkit-queues.webkit.org/results/12022539

New failing tests:
stress/scope-operation-cache-global-property-bump-counter.js.default
Comment 8 Yusuke Suzuki 2019-05-07 02:25:27 PDT
Created attachment 369261 [details]
Patch