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.
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.
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.
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.
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)"
Created attachment 29455 [details] Removed static UString pointer for AnonymousFunction. Removed static UString pointer for AnonymousFunction.
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
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
Should just be "UString", not "const UString".