Closed Bug 461563 Opened 16 years ago Closed 16 years ago

Allow WrapNative to return a jsval without the wrapper

Categories

(Core :: XPConnect, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla1.9.1b3

People

(Reporter: peterv, Assigned: peterv)

References

Details

(Keywords: fixed1.9.1)

Attachments

(1 file, 2 obsolete files)

Attached patch v1 (obsolete) — Splinter Review
A lot of callers just want a jsval, and have a rooted jsval*. Currently they get the XPCWrappedNative and get the jsval from that, if we can return the jsval without the wrapper we can avoid an AddRef/Release of the cached wrappers.
Attached patch v1.1 (obsolete) — Splinter Review
Attachment #344655 - Attachment is obsolete: true
Attachment #349021 - Flags: superreview?(jst)
Attachment #349021 - Flags: review?(jst)
Priority: -- → P2
Target Milestone: --- → mozilla1.9.1
Attachment #349021 - Flags: superreview?(jst)
Attachment #349021 - Flags: superreview+
Attachment #349021 - Flags: review?(jst)
Attachment #349021 - Flags: review+
Comment on attachment 349021 [details] [diff] [review]
v1.1

- In nsDOMClassInfo::WrapNative():

-  *aHolder = nsnull;
-  
   if (!native) {
     *vp = JSVAL_NULL;
+    if (aHolder) {
+      *aHolder = nsnull;
+    }

I say we just remove this code, all callers of this pass in nsCOMPtr's which are null to begin with.

- In XPCConvert::NativeInterface2JSObject():

+    *d = JSVAL_NULL;
+    if(dest)
+        *dest = nsnull;
     if(!src)
+    {
         return JS_TRUE;
+    }

Surrounding code seems to suggest no brackets in this single line if.

The rest looks good! r+sr=jst
We really want these performance improvements in 1.9.1.
Flags: blocking1.9.1?
Yup, blocking.
Flags: blocking1.9.1? → blocking1.9.1+
Priority: P2 → P1
Attached patch v1.1Splinter Review
Attachment #349021 - Attachment is obsolete: true
Attachment #350363 - Flags: superreview+
Attachment #350363 - Flags: review+
http://hg.mozilla.org/mozilla-central/rev/a4495a0cf2ff
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Target Milestone: mozilla1.9.1 → mozilla1.9.1b3
backed this out while trying to identify a perf regression (bug 467102):
http://hg.mozilla.org/mozilla-central/rev/6dc4b85cd8a7
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
See bug 467102 comment 6 for an explanation about the perf regression.
I just tried to reproduce the regression on the try server, but it doesn't show any difference on Twinopen for Windows XP (trunk: 251.44, trunk with patch: 251.11).
It's likely going to be worthwhile to try and land again when the tree is quiet.
I checked this back in, the Txul numbers look a little bit higher and more unstable on WinXP (not on Vista?). It's hard to tell if it's a real regression or just noise :-/. Maybe I should try to back out the patch in pieces, to see if any particular part makes the numbers more unstable.
Status: REOPENED → RESOLVED
Closed: 16 years ago16 years ago
Keywords: fixed1.9.1
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: