WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
25171
It should be possible to manually set the name of an anonymous function
https://bugs.webkit.org/show_bug.cgi?id=25171
Summary
It should be possible to manually set the name of an anonymous function
Francisco Tolmasky
Reported
2009-04-13 18:11:08 PDT
Currently anonymous functions show up as "(anonymous function)" in the profiler, which isn't too useful when they're all anonymous (generated). Aside from making WebKit smarter about auto-generating names, there should be a way to just set it yourself.
Attachments
Patch to add displayName property to functions
(8.46 KB, patch)
2009-04-13 18:20 PDT
,
Francisco Tolmasky
oliver
: review-
Details
Formatted Diff
Diff
Moved new code out of name and into calculatedDisplayName
(10.88 KB, patch)
2009-04-13 20:22 PDT
,
Francisco Tolmasky
oliver
: review-
Details
Formatted Diff
Diff
Removed static UString pointer for AnonymousFunction.
(10.25 KB, patch)
2009-04-13 21:10 PDT
,
Francisco Tolmasky
oliver
: review+
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Francisco Tolmasky
Comment 1
2009-04-13 18:20:08 PDT
Created
attachment 29451
[details]
Patch to add displayName property to functions I went ahead with the displayName approach, since it may still be valuable to have access to the actual name of the function as well.
Oliver Hunt
Comment 2
2009-04-13 18:59:05 PDT
Comment on
attachment 29451
[details]
Patch to add displayName property to functions You shouldn't change the behaviour of Function.name you should make the profiler do the work of checking for name vs displayName, or alternatively add a displayName function to InternalFunction and call that.
Francisco Tolmasky
Comment 3
2009-04-13 20:22:27 PDT
Created
attachment 29454
[details]
Moved new code out of name and into calculatedDisplayName I added displayName and calculatedDisplayName (matching the CSS pattern for these things). I moved AnonymousFunction string into calculatedDisplayName since this returns the final result.
Oliver Hunt
Comment 4
2009-04-13 20:26:51 PDT
Comment on
attachment 29454
[details]
Moved new code out of name and into calculatedDisplayName static const UString * AnonymousFunction = new UString("(anonymous function)"); This shouldn't be heap allocated otherwise it will cause leak warnings, it's also potentially not threadsafe -- I recommend putting an additional string constant on GlobalData to contain "(anonymous function)"
Francisco Tolmasky
Comment 5
2009-04-13 21:10:52 PDT
Created
attachment 29455
[details]
Removed static UString pointer for AnonymousFunction. Removed static UString pointer for AnonymousFunction.
Oliver Hunt
Comment 6
2009-04-13 22:04:41 PDT
Comment on
attachment 29455
[details]
Removed static UString pointer for AnonymousFunction. Should be const UString explicitName = displayName(globalData); (eg. not a reference) Will fix when i land
Oliver Hunt
Comment 7
2009-04-13 23:25:14 PDT
Committing to
http://svn.webkit.org/repository/webkit/trunk
... M JavaScriptCore/ChangeLog M JavaScriptCore/profiler/Profiler.cpp M JavaScriptCore/runtime/CommonIdentifiers.h M JavaScriptCore/runtime/InternalFunction.cpp M JavaScriptCore/runtime/InternalFunction.h M LayoutTests/ChangeLog A LayoutTests/fast/profiler/anonymous-functions-with-display-names-expected.txt A LayoutTests/fast/profiler/anonymous-functions-with-display-names.html A LayoutTests/fast/profiler/named-functions-with-display-names-expected.txt A LayoutTests/fast/profiler/named-functions-with-display-names.html Committed
r42478
Darin Adler
Comment 8
2009-04-14 10:27:08 PDT
Should just be "UString", not "const UString".
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