Closed Bug 717113 Opened 13 years ago Closed 13 years ago

Speed up js::IsWrapper

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla13

People

(Reporter: bholley, Assigned: bholley)

Details

Attachments

(2 files)

This caused bug 622301 to regress dromaeo. We can be a bit smarter in that patch about calling js::IsWrapper, but there's also some speedup to be gained in js-land.
Summary: Calls to js::IsWrapper from XPConnect are slow. → Calls to js::IsWrapper from XPConnect are slow
So, the issue in bug 622301 turned out to be that I was putting some stuff on the critical path that didn't need to be. So this stuff is no longer quite so critical, but I still think it's probably worth making this fast, especially given the new dom bindings. So I'm attaching the patches and flagging luke for review.
Summary: Calls to js::IsWrapper from XPConnect are slow → Speed up js::IsWrapper
Comment on attachment 597575 [details] [diff] [review] part 1 - Don't do a redundant class lookup in js::IsProxy. v1 >+ Class *clasp = GetObjectClass(obj); >+ return IsObjectProxyClass(clasp); Feel free to turn this and the next one into one-liners.
Attachment #597575 - Flags: review?(luke) → review+
Comment on attachment 597576 [details] [diff] [review] part 2 - Make js::IsWrapper fully inline-able. v1 >-static int sWrapperFamily; >+namespace js { >+int WrapperFamily; >+} I think 's' is the prefix for static data; can you keep it sWrapperFamily? >+extern JS_FRIEND_DATA(int) WrapperFamily; >+ >+inline bool >+IsWrapper(const JSObject *obj) >+{ >+ return IsProxy(obj) && GetProxyHandler(obj)->family() == &WrapperFamily; >+} Are there any measurable speedups? If so, there may be a little extra fat to trim: I believe computing &WrapperFamily requires a load or two due to PIC. We could be dirty and use a magic constant to shave off those loads. (Oooh, 'xpc' in 1337-speak is 0x9c ;-)
Attachment #597576 - Flags: review?(luke) → review+
(In reply to Luke Wagner [:luke] from comment #4) > Feel free to turn this and the next one into one-liners. Done. (In reply to Luke Wagner [:luke] from comment #5) > I think 's' is the prefix for static data; can you keep it sWrapperFamily? Oh, I see. I thought it implied static linkage, which is no longer the case. Changed it back. > Are there any measurable speedups? If so, there may be a little extra fat > to trim: I believe computing &WrapperFamily requires a load or two due to > PIC. We could be dirty and use a magic constant to shave off those loads. > (Oooh, 'xpc' in 1337-speak is 0x9c ;-) I think I'll hold off on this one for now until we see the effect of this patch. If the results are significant, this sounds like a good plan.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: