Bug 118513 - Cache property access for JSC API static functions
Summary: Cache property access for JSC API static functions
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified OS X 10.8
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-09 10:17 PDT by Yi Shen
Modified: 2013-07-11 11:19 PDT (History)
1 user (show)

See Also:


Attachments
Test case (411 bytes, text/html)
2013-07-09 10:27 PDT, Yi Shen
no flags Details
proposal patch (2.49 KB, patch)
2013-07-09 10:30 PDT, Yi Shen
ggaren: review-
max.hong.shen: commit-queue?
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yi Shen 2013-07-09 10:17:21 PDT
By caching property access, the JSC API static function call could be 1/4 times faster than before.
Comment 1 Yi Shen 2013-07-09 10:27:48 PDT
Created attachment 206339 [details]
Test case
Comment 2 Yi Shen 2013-07-09 10:28:56 PDT
                 No cache        Cache
result(ms)
1.                  8000          6003
2.                  7600          5947
3.                  7987          5912
4.                  8002          5886
5.                  8155          5934
6.                  7539          5953
7.                  8562          5958
8.                  7455          5952
9.                  7936          5913
10.                7461          5910
------------------------------
avg                7869          5937
Comment 3 Yi Shen 2013-07-09 10:30:16 PDT
Created attachment 206340 [details]
proposal patch
Comment 4 Geoffrey Garen 2013-07-10 10:26:01 PDT
Comment on attachment 206340 [details]
proposal patch

I don't think this is correct.

Client functions are allowed to make arbitrary decisions, and we can't assume they'll make the same decision each time.
Comment 5 Yi Shen 2013-07-11 11:19:20 PDT
Thanks for review! Could you please explain a bit more about the 'arbitrary decisions' that you have mentioned? 

As I noticed that the JSCallbackObject<Parent>::staticFunctionGetter() always checks for cached or override property when it gets called.  So, I added a similar check before calling staticFunctionGetter() and pass the cached property to the property slot only if it exists. By doing this, we can cache the property access through tryCacheGetByID() (JITStubs.cpp). 

(In reply to comment #4)
> (From update of attachment 206340 [details])
> I don't think this is correct.
> 
> Client functions are allowed to make arbitrary decisions, and we can't assume they'll make the same decision each time.