RESOLVED FIXED 226149
Use singleton thunks for virtual calls.
https://bugs.webkit.org/show_bug.cgi?id=226149
Summary Use singleton thunks for virtual calls.
Mark Lam
Reported 2021-05-22 18:02:26 PDT
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.
Attachments
proposed patch. (12.38 KB, patch)
2021-05-22 18:21 PDT, Mark Lam
ews-feeder: commit-queue-
proposed patch. (12.46 KB, patch)
2021-05-22 21:55 PDT, Mark Lam
ysuzuki: review+
ews-feeder: commit-queue-
Radar WebKit Bug Importer
Comment 1 2021-05-22 18:02:55 PDT
Mark Lam
Comment 2 2021-05-22 18:03:41 PDT
Forgot to say, the 1.012x was measured on a M1 Mac.
Mark Lam
Comment 3 2021-05-22 18:21:53 PDT
Created attachment 429445 [details] proposed patch. Let's try this on the EWS.
Mark Lam
Comment 4 2021-05-22 21:55:42 PDT
Created attachment 429457 [details] proposed patch.
Yusuke Suzuki
Comment 5 2021-05-22 22:32:15 PDT
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.
Mark Lam
Comment 6 2021-05-22 23:02:45 PDT
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.
Mark Lam
Comment 7 2021-05-22 23:24:30 PDT
Thanks for the review. Landed in r277929: <http://trac.webkit.org/r277929>.
Note You need to log in before you can comment on or make changes to this bug.