Closed
Bug 395444
Opened 18 years ago
Closed 18 years ago
Fast-path QueryInterface in XPCWrappedNative::CallMethod
Categories
(Core :: XPConnect, defect)
Tracking
()
RESOLVED
FIXED
mozilla1.9alpha8
People
(Reporter: benjamin, Assigned: benjamin)
References
Details
Attachments
(1 file, 1 obsolete file)
|
5.51 KB,
patch
|
damons
:
approval1.9+
|
Details | Diff | Splinter Review |
Right now calls to QueryInterface from script go through the ordinary path where we use typeinfo to convert params and then call NS_InvokeByIndex. Because we know the signature at compile-time we can optimize this (common) path pretty significantly.
Attachment #280118 -
Flags: superreview?(jst)
Attachment #280118 -
Flags: review?(mrbkap)
Comment 1•18 years ago
|
||
Comment on attachment 280118 [details] [diff] [review]
Special-case QI, rev. 1
sr=jst
Attachment #280118 -
Flags: superreview?(jst) → superreview+
Comment 2•18 years ago
|
||
Comment on attachment 280118 [details] [diff] [review]
Special-case QI, rev. 1
>Index: js/src/xpconnect/src/xpcwrappednative.cpp
>+ // fast-path QueryInterface: we already know the signature and can avoid a lot of work
>+ if (vtblIndex == 0)
Should we also check that the interface is nsISupports?
>+ {
>+ if (argc < 1)
Nit: No space after |if|. (this applies to all added if statements).
>+ {
>+ Throw(NS_ERROR_XPC_NOT_ENOUGH_ARGS, ccx);
>+ return JS_FALSE;
>+ }
>+ nsID *iid;
>+ JSObject *obj;
Nit: * cuddles with the type in surrounding code.
>+ if (NS_FAILED(invokeResult)) {
Nit: { on its own line (and no space...).
Another general comment, perhaps we should be setting retval and using |goto done;|. It appears that the only code that we care about there at this point is the timing code, if we don't care about that, then there's some additional cleanup possible to do around here.
Other than that, this looks good!
Attachment #280118 -
Flags: review?(mrbkap) → review+
| Assignee | ||
Comment 3•18 years ago
|
||
> Should we also check that the interface is nsISupports?
Not necessary, because there is already xpconnect code that prevents reflecting interfaces that don't inherit from nsISupports, and xpidl prevents such interfaces anyway.
> Another general comment, perhaps we should be setting retval and using |goto
> done;|. It appears that the only code that we care about there at this point is
> the timing code, if we don't care about that, then there's some additional
> cleanup possible to do around here.
I don't think that that #ifdef off_jband code is useful... we don't have enough resolution in most cases for it to be useful, unless we start instrumenting this stuff with dtrace and then we'll need some different stuff anyway. I like skipping the extra cleanup code if we don't need it, so a second patch coming up.
>
> Other than that, this looks good!
>
| Assignee | ||
Comment 4•18 years ago
|
||
Attachment #280118 -
Attachment is obsolete: true
Attachment #280132 -
Flags: approval1.9?
Updated•18 years ago
|
Attachment #280132 -
Flags: approval1.9? → approval1.9+
| Assignee | ||
Comment 5•18 years ago
|
||
Fixed on trunk. Didn't appear to have any appreciable perf impact, but this is necessary for the automated QI rewrite (bug 391275) so I'll leave it in unless there are reported regressions.
Updated•18 years ago
|
Target Milestone: --- → mozilla1.9 M8
You need to log in
before you can comment on or make changes to this bug.
Description
•