Status: Accepted
Owner: ----
CC: [email protected]
Labels: Type-FeatureRequest Priority-Low

New issue 1581 by [email protected]: [Optimization] New makes an unnecessary copy of the constructor's arguments.
http://code.google.com/p/v8/issues/detail?id=1581

JSConstructStubXXX always constructs a new frame, with a new copy of all the arguments, before calling the constructor. This is needed because the constructor cannot be a tail call, because if the constructor returns an object, that is the result of "new", otherwise the allocated object is.

We can make a tail call to the constructor, if we do this final check in the generated code for "new". "new" should allocate an output slot for the allocated object, then push the (dummy) receiver and the arguments. The stub will store the object in the slot, and as the receiver, and tail call the function. Then the generated code will check the result, and use it or the new object as the value of new. This could also be a stub to do the check.

I'll leave this bug available, if anyone wants to tackle it before me.


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to