Closed Bug 1323190 Opened 8 years ago Closed 8 years ago

Attach Proxy GetElem IC

Categories

(Core :: JavaScript Engine: JIT, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla53
Tracking Status
firefox53 --- fixed

People

(Reporter: evilpie, Assigned: evilpie)

References

(Blocks 3 open bugs)

Details

Attachments

(3 files)

It's not uncommon to see a Proxy with GetElem and some integer index. It almost looks like tryAttachProxy could already work with indexes.
Good idea. I agree we could probably fix this with only CacheIR.cpp/h changes.
Priority: -- → P3
Attached patch Attach Proxy GetElem IC (deleted) — Splinter Review
This is so simple there is no good reason not to do. I see a performance win locally with ES6 Proxy, but the testcase in bug 917509 doesn't improve at all.
Assignee: nobody → evilpies
Status: NEW → ASSIGNED
Attachment #8822746 - Flags: review?(jdemooij)
The performance of this is much improved by inlining the Proxy::get call into ProxyGetPropertyByValue. I just have to find a way of doing this that isn't totally ugly.
Blocks: 1245974
Comment on attachment 8822746 [details] [diff] [review]
Attach Proxy GetElem IC

Review of attachment 8822746 [details] [diff] [review]:
-----------------------------------------------------------------

Nice, r=me with comment below addressed.

::: js/src/jit/CacheIR.cpp
@@ +143,5 @@
>                  return true;
>          }
>  
> +        if (tryAttachProxyElement(obj, objId))
> +            return true;

When we get here, maybeGuardInt32Index may have inserted guards for the index (but not if the index is a non-integer). Shouldn't we move this call before maybeGuardInt32Index, so we don't emit these unnecessary guards?

(I should have added a "return false;" at the end of the "if (maybeGuardInt32Index(" block to make this more obvious..)
Attachment #8822746 - Flags: review?(jdemooij) → review+
Good catch, this actually was causing issues on try, because on x86 we were running out of registers.
(In reply to Tom Schuster [:evilpie] from comment #5)
> Good catch, this actually was causing issues on try, because on x86 we were
> running out of registers.

Hm we shouldn't be running out of registers because of this - the number of registers we can use for an instruction is always the same because we can spill registers the instruction doesn't use. I'll investigate.
Flags: needinfo?(jdemooij)
(In reply to Jan de Mooij [:jandem] from comment #6)
> Hm we shouldn't be running out of registers because of this - the number of
> registers we can use for an instruction is always the same because we can
> spill registers the instruction doesn't use. I'll investigate.

Filed bug 1328227.
Flags: needinfo?(jdemooij)
Keywords: leave-open
I still want to optimize the C++ side a bit more in this bug. Note: This doesn't handle just int32, but every kind of value type. (We already supported string/symbol before)
Attached patch Remove Proxy friendapi (deleted) — Splinter Review
Because we moved ObjectOps to a different struct we now define that in the same file and can stop exporting those in the friendapi. Only WeakmapKeyDelegate is still used directly in the header. proxy_Call and proxy_Construct need to accessible in some other files. I also left stuff like proxy_DeleteProperty, where we don't directly call the Proxy:: implementation.
Attachment #8823347 - Flags: review?(arai.unmht)
Comment on attachment 8823347 [details] [diff] [review]
Remove Proxy friendapi

Review of attachment 8823347 [details] [diff] [review]:
-----------------------------------------------------------------

Nice simplification :)
Attachment #8823347 - Flags: review?(arai.unmht) → review+
Blocks: 875815
Is there a followup bug for the C++ changes mentioned above?
Flags: needinfo?(evilpies)
Attached patch Inline Proxy::get (deleted) — Splinter Review
Inlining Proxy::get into the caller functions gives measurable performance improvements. For example I extracted the "mootools - *" tests from bug 875815 and we go from ~2100ms to ~1900ms.
Flags: needinfo?(evilpies)
Attachment #8824039 - Flags: review?(jdemooij)
Keywords: leave-open
Comment on attachment 8824039 [details] [diff] [review]
Inline Proxy::get

Review of attachment 8824039 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good.

::: js/src/proxy/Proxy.cpp
@@ +6,4 @@
>  
>  #include "js/Proxy.h"
>  
> +#include "mozilla/Attributes.h"

This should go before the js/Proxy.h #include I think.
Attachment #8824039 - Flags: review?(jdemooij) → review+
Changing the include order makes it check-spidermonkey style complain. I think the first include should be proxy/Proxy.h anyway?
Pushed by evilpies@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/96534237bb1e
Inline Proxy::get into JIT VM functions. r=jandem
https://hg.mozilla.org/mozilla-central/rev/96534237bb1e
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: