NEW 78876
Fine-grained JSC JIT code profiling at the function level
https://bugs.webkit.org/show_bug.cgi?id=78876
Summary Fine-grained JSC JIT code profiling at the function level
Yuqiang Xian
Reported 2012-02-16 21:52:05 PST
This tends to add fine-grained JIT code profiling support with which we can get more detailed information at the function level. A symbol table is created in CodeProfile to manipulate the symbols (consisting of function names (if available) and line numbers), and the samples on different JIT functions are reported separately. Patch forthcoming.
Attachments
proposed patch (4.35 KB, patch)
2012-02-16 22:02 PST, Yuqiang Xian
barraclough: review-
updated patch (3.30 KB, patch)
2012-02-17 07:16 PST, Yuqiang Xian
no flags
patch updated (15.06 KB, patch)
2012-02-24 00:51 PST, Yuqiang Xian
no flags
Rebase (15.06 KB, patch)
2012-06-05 20:35 PDT, Yuqiang Xian
buildbot: commit-queue-
o... the previous one is wrongly rebased.. this one please (15.09 KB, patch)
2012-06-05 23:05 PDT, Yuqiang Xian
no flags
Yuqiang Xian
Comment 1 2012-02-16 22:02:41 PST
Created attachment 127520 [details] proposed patch
Gavin Barraclough
Comment 2 2012-02-16 22:29:01 PST
Comment on attachment 127520 [details] proposed patch I think there is a problem with this in that the string concatenation may trigger a malloc, and the main thread may be suspended holding the malloc heap lock, resulting in deadlock. I do think we'll want to get more detailed information out of the profiler, but I'm not sure this is the right approach – rather, I think we may want a way to retain all code blocks while profiling, and to lazily manage mapping sampled PCs back to the byte code offset (line number, etc), from the main thread once sampling is complete.
Yuqiang Xian
Comment 3 2012-02-17 07:16:48 PST
Created attachment 127585 [details] updated patch Gavin, thanks for pointing out the problem. Yes, as you mentioned, I think we should do the JIT symbol mapping stuffs after sampling. And I think when the profiling is ended and the profile is reported the CodeBlocks _should_ be alive. As the CodeProfiling stuff will be cleaned-up when we get out of evaluate(), while the CodeBlocks are allocated in the heap which are supposed to be reclaimed later. So this new patch is based on this assumption. Example profiling output: <CodeProfiling /mnt/supplement/kraken/tests/kraken-1.1/ai-astar.js:1> Total samples: 8354 8259: [[DFGJIT]] : search (Lines: 48-118) (8259 stack top) 82: [[EngineCode]] (0 stack top) 82: <unknown> (82 stack top) 10: [[DFGJIT]] : neighbors (Lines: 125-143) (10 stack top) 1: [[DFGJIT]] : findGraphNode (Lines: 7-12) (1 stack top) 1: [[DFGJIT]] : init (Lines: 38-47) (1 stack top) 1: [[BaselineOSR]] : init (Lines: 38-47) (1 stack top) </CodeProfiling /mnt/supplement/kraken/tests/kraken-1.1/ai-astar.js:1>
Yuqiang Xian
Comment 4 2012-02-20 00:52:34 PST
Sorry but please just ignore my last comment. The Code blocks may be deleted during the script evaluation because of GC - which is reasonable in a normal run. Should we disallow code GC when profiling is enabled?
Gavin Barraclough
Comment 5 2012-02-20 12:29:50 PST
(In reply to comment #4) > Sorry but please just ignore my last comment. The Code blocks may be deleted during the script evaluation because of GC - which is reasonable in a normal run. Should we disallow code GC when profiling is enabled? I think we may want to disable recovery of the JIT code buffers, yes. I guessing we don't need to keep any JS heap GC objects alive, but we'll want to retain the code blocks of executables that are destroyed. I believe we already have a mechanism to keep code blocks alive, where they have been jettisoned from an executable, but may still be on the stack. We may be able to reuse the same mechanism, but I haven't looked into this.
Yuqiang Xian
Comment 6 2012-02-24 00:51:14 PST
Created attachment 128681 [details] patch updated Patch updated. we retain the code blocks and the executable memory in order to map the address to the JS function and line numbers correctly. Also, the children map of a ProfileTreeNode needs to be reference counted to avoid dangling pointers due to map expansion.
Yuqiang Xian
Comment 7 2012-02-29 19:41:10 PST
Hi Gavin, how do you think about the updated patch? Thanks.
Yuqiang Xian
Comment 8 2012-06-05 20:35:47 PDT
Build Bot
Comment 9 2012-06-05 21:00:35 PDT
Build Bot
Comment 10 2012-06-05 21:13:46 PDT
Gyuyoung Kim
Comment 11 2012-06-05 22:10:29 PDT
Yuqiang Xian
Comment 12 2012-06-05 23:05:12 PDT
Created attachment 145938 [details] o... the previous one is wrongly rebased.. this one please
Anders Carlsson
Comment 13 2014-02-05 10:57:03 PST
Comment on attachment 145938 [details] o... the previous one is wrongly rebased.. this one please Clearing review flag on patches from before 2014. If this patch is still relevant, please reset the r? flag.
Note You need to log in before you can comment on or make changes to this bug.