The pre-existing implementation emits a unique thunk for each virtual call site. This turns out to be very wasteful in terms of memory. For example, Speedometer2 ends up generating ~16M of virtualFor thunks. Switching to re-useable singleton thunks, saves that 16M, and also appears to improve Speedometer2 performance by 1.012x.
<rdar://problem/78357604>
Forgot to say, the 1.012x was measured on a M1 Mac.
Created attachment 429445 [details] proposed patch. Let's try this on the EWS.
Created attachment 429457 [details] proposed patch.
Comment on attachment 429457 [details] proposed patch. View in context: https://bugs.webkit.org/attachment.cgi?id=429457&action=review r=me > Source/JavaScriptCore/ChangeLog:13 > + 2. Introduce Options::useUniqueVirtualThunks() to allow unique thunks to be > + generated for testing and comparisons. Options::useUniqueVirtualThunks() is > + false by default. Maybe this flag is not necessary. > Source/JavaScriptCore/jit/ThunkGenerators.cpp:275 > + bool isTailCall = (mode == CallMode::Tail); () is not necessary.
Comment on attachment 429457 [details] proposed patch. View in context: https://bugs.webkit.org/attachment.cgi?id=429457&action=review >> Source/JavaScriptCore/ChangeLog:13 >> + false by default. > > Maybe this flag is not necessary. I suppose we can always add it later if a need arises. I'll remove it. >> Source/JavaScriptCore/jit/ThunkGenerators.cpp:275 >> + bool isTailCall = (mode == CallMode::Tail); > > () is not necessary. Will fix.
Thanks for the review. Landed in r277929: <http://trac.webkit.org/r277929>.