Changeset 42478 in webkit
- Timestamp:
- Apr 13, 2009 11:24:43 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r42466 r42478 1 2009-04-13 Francisco Tolmasky <francisco@280north.com> 2 3 Reviewed by Oliver Hunt. 4 5 BUG 25171: It should be possible to manually set the name of an anonymous function 6 <https://bugs.webkit.org/show_bug.cgi?id=25171> 7 8 This change adds the displayName property to functions, which when set overrides the 9 normal name when appearing in the console. 10 11 * profiler/Profiler.cpp: 12 (JSC::createCallIdentifierFromFunctionImp): Changed call to InternalFunction::name to InternalFunction::calculatedDisplayName 13 * runtime/CommonIdentifiers.h: Added displayName common identifier. 14 * runtime/InternalFunction.cpp: 15 (JSC::InternalFunction::displayName): Access to user settable displayName property 16 (JSC::InternalFunction::calculatedDisplayName): Returns displayName if it exists, if not then the natural name 17 1 18 2009-04-13 Geoffrey Garen <ggaren@apple.com> 2 19 -
trunk/JavaScriptCore/profiler/Profiler.cpp
r41407 r42478 149 149 CallIdentifier createCallIdentifierFromFunctionImp(JSGlobalData* globalData, JSFunction* function) 150 150 { 151 const UString& name = function-> name(globalData);151 const UString& name = function->calculatedDisplayName(globalData); 152 152 return CallIdentifier(name.isEmpty() ? AnonymousFunction : name, function->body()->sourceURL(), function->body()->lineNo()); 153 153 } -
trunk/JavaScriptCore/runtime/CommonIdentifiers.h
r38138 r42478 64 64 macro(toString) \ 65 65 macro(UTC) \ 66 macro(valueOf) 66 macro(valueOf) \ 67 macro(displayName) 67 68 68 69 namespace JSC { -
trunk/JavaScriptCore/runtime/InternalFunction.cpp
r38440 r42478 49 49 } 50 50 51 const UString& InternalFunction::displayName(JSGlobalData* globalData) 52 { 53 JSValuePtr displayName = getDirect(globalData->propertyNames->displayName); 54 55 if (displayName) 56 return asString(displayName)->value(); 57 58 return UString::null(); 59 } 60 61 const UString& InternalFunction::calculatedDisplayName(JSGlobalData* globalData) 62 { 63 const UString& explicitName = displayName(globalData); 64 65 if (!explicitName.isEmpty()) 66 return explicitName; 67 68 return name(globalData); 69 } 70 51 71 } // namespace JSC -
trunk/JavaScriptCore/runtime/InternalFunction.h
r39670 r42478 38 38 39 39 const UString& name(JSGlobalData*); 40 const UString& displayName(JSGlobalData*); 41 const UString& calculatedDisplayName(JSGlobalData*); 40 42 41 43 static PassRefPtr<Structure> createStructure(JSValuePtr proto) -
trunk/LayoutTests/ChangeLog
r42467 r42478 1 2009-04-13 Francisco Tolmasky <francisco@280north.com> 2 3 Reviewed by Oliver Hunt. 4 5 BUG 25171: It should be possible to manually set the name of an anonymous function 6 <https://bugs.webkit.org/show_bug.cgi?id=25171> 7 8 Added test cases for using displayName property on anonymous and named functions. 9 10 * fast/profiler/anonymous-functions-with-display-names-expected.txt: Added. 11 * fast/profiler/anonymous-functions-with-display-names.html: Added. 12 * fast/profiler/named-functions-with-display-names-expected.txt: Added. 13 * fast/profiler/named-functions-with-display-names.html: Added. 14 1 15 2009-04-13 Darin Adler <darin@apple.com> 2 16
Note: See TracChangeset
for help on using the changeset viewer.