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.
Created attachment 24581 [details] Preallocated StructureIDs
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.
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'.
Does this bug still track an actionable issue?
We now have a solution for this in ToT, we cache a transitioned structure for functions that have assigned space for the name.