RESOLVED FIXED 20982
Speed up the apply method of functions by special-casing array and 'arguments' objects
https://bugs.webkit.org/show_bug.cgi?id=20982
Summary Speed up the apply method of functions by special-casing array and 'arguments...
Cameron Zwarich (cpst)
Reported 2008-09-21 20:49:54 PDT
Currently, functionProtoFuncApply() accesses the arguments via numerical indices using the generic path for lookup. We should really fix this. Sam has a patch to do this, so I'm assigning this to him.
Attachments
patch (10.70 KB, patch)
2008-09-21 23:18 PDT, Sam Weinig
darin: review+
Sam Weinig
Comment 1 2008-09-21 23:18:06 PDT
Sam Weinig
Comment 2 2008-09-21 23:34:38 PDT
Comment on attachment 23643 [details] patch Taking this out of the review queue. I am afraid that this might break RegExpMatchesArray.
Cameron Zwarich (cpst)
Comment 3 2008-09-21 23:35:29 PDT
Comment on attachment 23643 [details] patch As we discussed on IRC, this code seems like it would break with the RegExpMatchesArray, since that array is lazily filled when a property is retrieved.
Darin Adler
Comment 4 2008-09-22 07:49:41 PDT
Should be straightforward to fix it for RegExpMatchesArray one of two ways: 1) Make a call to fill out a RegExpMatchesArray before doing the rest. 2) Do a check for JSArray with the exec->machine()->isJSArray() function that returns false for RegExpMatchesArray and keep a slow case for JSArray derived classes around for RegExpMatchesArray (and maybe WebCore/bridge bindings arrays?)
Sam Weinig
Comment 5 2008-09-22 11:36:22 PDT
Comment on attachment 23643 [details] patch Putting this back up for review since it doesn't break RegExpMatchesArray. I have added new test cases for it however and will land them if this gets reviewed.
Darin Adler
Comment 6 2008-09-22 11:41:47 PDT
Comment on attachment 23643 [details] patch If speed really matters for Arguments, then we need to do various checks outside the loops rather than inside, so for example: - We need an entirely separate loop for the Arguments case where there are no deleted arguments. - The loop for the parameters should come first, then a separate loop to handle arguments. r=me
Sam Weinig
Comment 7 2008-09-22 14:21:28 PDT
Landed in r36779. There is still more work to be done to speed up Function.apply however.
Note You need to log in before you can comment on or make changes to this bug.