Bug 21814

Summary: The name property of JSFunctions should not be put directly
Product: WebKit Reporter: Cameron Zwarich (cpst) <zwarich>
Component: JavaScriptCoreAssignee: Cameron Zwarich (cpst) <zwarich>
Status: RESOLVED INVALID    
Severity: Normal CC: barraclough, ggaren, oliver
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 20813    
Attachments:
Description Flags
Preallocated StructureIDs
none
Patch in progress none

Description Cameron Zwarich (cpst) 2008-10-22 16:01:38 PDT
According to the opcode sampler, the creation of new function objects is 8% of total time on the V8 Earley-Boyer benchmark. One of the things that stands out here is that three properties are added to every new JSFunction using putDirect(). We should make the addition of these properties more efficient in a similar fashion to the way the creation of singleton objects uses fewer StructureIDs.
Comment 1 Sam Weinig 2008-10-22 16:39:10 PDT
Created attachment 24581 [details]
Preallocated StructureIDs
Comment 2 Cameron Zwarich (cpst) 2008-10-27 11:20:21 PDT
This patch is not so relevant after r37859, because the prototype property is now created lazily. The only property that is still put on a JSFunction is the name property, which could be stored on the FunctionBodyNode and not actually created. I'll rename this bug to reflect this change.
Comment 3 Cameron Zwarich (cpst) 2008-10-28 22:19:53 PDT
Created attachment 24739 [details]
Patch in progress

This is strangely a slowdown on the V8 benchmark suite, and I am not sure why. It still needs to make JSFunction::getOwnPropertySlot() work correctly for 'name'.
Comment 4 Alexey Proskuryakov 2010-06-11 11:27:31 PDT
Does this bug still track an actionable issue?
Comment 5 Gavin Barraclough 2011-10-03 13:52:20 PDT
We now have a solution for this in ToT, we cache a transitioned structure for functions that have assigned space for the name.