Bug 132351

Summary: JSProxies should be cacheable
Product: WebKit Reporter: Mark Hahnenberg <mhahnenberg>
Component: JavaScriptCoreAssignee: Mark Hahnenberg <mhahnenberg>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch ggaren: review+

Description Mark Hahnenberg 2014-04-29 12:59:27 PDT
Whenever we encounter a proxy in an inline cache we should try to cache on the proxy's target instead of giving up.
Comment 1 Mark Hahnenberg 2014-04-29 13:05:25 PDT
Created attachment 230406 [details]
Patch
Comment 2 WebKit Commit Bot 2014-04-29 13:07:23 PDT
Attachment 230406 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/jit/Repatch.cpp:311:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
ERROR: Source/JavaScriptCore/jit/Repatch.cpp:322:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
ERROR: Source/JavaScriptCore/runtime/Operations.h:264:  Multi line control clauses should use braces.  [whitespace/braces] [4]
Total errors found: 3 in 11 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Filip Pizlo 2014-04-29 13:07:35 PDT
Comment on attachment 230406 [details]
Patch

Lol can has some tests?  I'd add a fako Proxy in jsc.cpp that behaves like JSGLobalObject (maybe we have one already?) and then write some tests that various try and either succeed or fail in caching on it.
Comment 4 Mark Hahnenberg 2014-04-29 14:06:11 PDT
Created attachment 230414 [details]
Patch
Comment 5 WebKit Commit Bot 2014-04-29 14:08:14 PDT
Attachment 230414 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/runtime/Operations.h:264:  Multi line control clauses should use braces.  [whitespace/braces] [4]
Total errors found: 1 in 13 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 6 Geoffrey Garen 2014-04-29 14:54:49 PDT
Comment on attachment 230414 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=230414&action=review

r=me

> Source/JavaScriptCore/ChangeLog:15
> +        This is performance neutral on the benchmarks we track, although currently we won't

I would remove "although", and just start a new sentence.

> Source/JavaScriptCore/jsc.cpp:611
> +    Structure* structure = Proxy::createStructure(exec->vm(), exec->lexicalGlobalObject(), jsTarget->prototype());

You could just instantiate JSProxy here.

> Source/JavaScriptCore/jit/Repatch.cpp:746
> +        if (!structure->propertyAccessesAreCacheable())
> +            return false;

Let's rearrange this to share the propertyAccessesAreCacheable() check. It's nice to keep the PureForwardingProxyType thingy only substituting the base, and not doing anything else.
Comment 7 Mark Hahnenberg 2014-04-29 15:22:40 PDT
Committed r167963: <http://trac.webkit.org/changeset/167963>