WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
20155
Web Inspector: profiler lumps together anonymous functions created by "new Function" and unnamed evals
https://bugs.webkit.org/show_bug.cgi?id=20155
Summary
Web Inspector: profiler lumps together anonymous functions created by "new Fu...
Oliver Hunt
Reported
2008-07-24 04:39:51 PDT
Create multiple functions with the same name, say f1 = new Function("return 1;") f2 = new Function("return 2;") And call them lots of times. Both functions will be called anonymous, and will get the same entry in the profiler.
Attachments
sample named/unnamed and source/eval functions for debugging/profiling
(3.24 KB, text/html)
2010-03-17 12:38 PDT
,
Patrick Mueller
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Kevin McCullough
Comment 1
2008-07-24 10:57:23 PDT
The title is wrong, if you have two functions with the same name they will not get the same entry in the profiler. Two anonymous function functions will, because they don't have any line number information or other data to distinguish them. This would be fixed if we fix
https://bugs.webkit.org/show_bug.cgi?id=19229
Timothy Hatcher
Comment 2
2008-07-24 11:01:22 PDT
Why don't we have line numbers? I guess the reason is more specific. If the anonymous function is made with new Function() it seems. Because we do the right things for: f1 = function() { return 1; } f2 = function() { return 2; }
Oliver Hunt
Comment 3
2008-07-24 12:02:57 PDT
I suspect that the profiler should be comparing sourceId (or whatever that property is) because eval("function(){1}") and eval("function(){2}") will both have the same line number, and url (eg. no url) --Oliver
Kevin McCullough
Comment 4
2008-07-24 14:45:00 PDT
It's dependent on what information is available at the time of execution. Previously filename and line number were not known. Can we know the sourceId at execution time?
Oliver Hunt
Comment 5
2008-07-24 14:51:26 PDT
Do we not provide such info? we do for exceptions and the debugger, so the info is actually available to us.
Timothy Hatcher
Comment 6
2010-02-03 09:19:45 PST
***
Bug 25175
has been marked as a duplicate of this bug. ***
Patrick Mueller
Comment 7
2010-03-17 12:38:23 PDT
Created
attachment 50934
[details]
sample named/unnamed and source/eval functions for debugging/profiling I had put this sample together to submit a new bug regarding lack of source information provided to the profiler, but then found this bug, so thought I'd just paste it on here, since it seems relevant enough. What it basically shows is that using the latest bits available (including displayName property on Functions to name them, and //@sourceURL= to name eval()'d chunks), the profiler still doesn't provide the source information for eval()'d functions. But the debugger does. One of my users has requested that the //@sourceURL bit be supported for profiling as well as debugging.
Radar WebKit Bug Importer
Comment 8
2014-12-17 11:21:40 PST
<
rdar://problem/19281484
>
Timothy Hatcher
Comment 9
2016-02-04 20:24:23 PST
Is this an issue with the new sampling profiler?
Saam Barati
Comment 10
2016-02-25 11:51:22 PST
(In reply to
comment #9
)
> Is this an issue with the new sampling profiler?
I'm not sure. I will look into it.
Timothy Hatcher
Comment 11
2016-04-20 17:13:01 PDT
This works as expected in WebKit now with the attached test case.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug