Closed Bug 379220 Opened 18 years ago Closed 17 years ago

Replacing JS AddRoots calls by custom xpconnect structures

Categories

(Core :: XPConnect, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: igor, Assigned: igor)

References

Details

Attachments

(1 file, 3 obsolete files)

With the proposed API from bug 379146 it should be possible to replace JS_AddNamedRoots/JS_LockGCThing calls for various XPC classes via a custom data structure to get better efficiency compared with hashtables behind JS rooting API. For example, a straightforward alternative for the JS rooting calls is to put objects holding jsval or JSObject* into a doubly-linked list. More complex possibility is to use a singly-linked list with unlinking postponed until the next trace/GC mark invocation when the list has to be traced in any case. This can even be made lock-free since the lists can be put on thread private data with tracing code transferring the thread lists to the global one.
Attached patch Implementation v0.1 (obsolete) (deleted) — Splinter Review
Untested prototype that requires the patches from directly dependant bugs to apply.
We should also consider converting some of the JS_AddNamedRoot calls in mozilla/dom.
Attached patch implementation v0.2 (obsolete) (deleted) — Splinter Review
Here is updated quilt-generated patch that depends on the patch from bug 340212. Now I can use the browser with the patch applied.
Attachment #263220 - Attachment is obsolete: true
Attached patch Implementation v1 (deleted) — Splinter Review
The patch replaces AddRoot/LockGCThings calls via using doubly linked list for xpconnect objects that hold JS things. The patch uses GC lock when accessing the list to avoid the need for locking during tracing/marking.
Attachment #263928 - Attachment is obsolete: true
Attachment #264855 - Flags: superreview?(brendan)
Attachment #264855 - Flags: review?(jst)
Comment on attachment 264855 [details] [diff] [review] Implementation v1 r=jst
Attachment #264855 - Flags: review?(jst) → review+
Comment on attachment 264855 [details] [diff] [review] Implementation v1 Looks good, skimming a bit. Any mem or perf numbers yet? /be
Attachment #264855 - Flags: superreview?(brendan) → superreview+
I committed the patch from comments 4 to the trunk: Checking in js/src/xpconnect/src/nsXPConnect.cpp; /cvsroot/mozilla/js/src/xpconnect/src/nsXPConnect.cpp,v <-- nsXPConnect.cpp new revision: 1.111; previous revision: 1.110 done Checking in js/src/xpconnect/src/xpcforwards.h; /cvsroot/mozilla/js/src/xpconnect/src/xpcforwards.h,v <-- xpcforwards.h new revision: 1.21; previous revision: 1.20 done Checking in js/src/xpconnect/src/xpcinlines.h; /cvsroot/mozilla/js/src/xpconnect/src/xpcinlines.h,v <-- xpcinlines.h new revision: 1.17; previous revision: 1.16 done Checking in js/src/xpconnect/src/xpcjsruntime.cpp; /cvsroot/mozilla/js/src/xpconnect/src/xpcjsruntime.cpp,v <-- xpcjsruntime.cpp new revision: 1.52; previous revision: 1.51 done Checking in js/src/xpconnect/src/xpcprivate.h; /cvsroot/mozilla/js/src/xpconnect/src/xpcprivate.h,v <-- xpcprivate.h new revision: 1.215; previous revision: 1.214 done Checking in js/src/xpconnect/src/xpcvariant.cpp; /cvsroot/mozilla/js/src/xpconnect/src/xpcvariant.cpp,v <-- xpcvariant.cpp new revision: 1.18; previous revision: 1.17 done Checking in js/src/xpconnect/src/xpcwrappedjs.cpp; /cvsroot/mozilla/js/src/xpconnect/src/xpcwrappedjs.cpp,v <-- xpcwrappedjs.cpp new revision: 1.55; previous revision: 1.54 done Checking in js/src/xpconnect/src/xpcwrappednative.cpp; /cvsroot/mozilla/js/src/xpconnect/src/xpcwrappednative.cpp,v <-- xpcwrappednative.cpp new revision: 1.140; previous revision: 1.139 done
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Attachment #485563 - Attachment is obsolete: true
Attachment #485563 - Flags: review?(osss)
The content of attachment 485563 [details] has been deleted by Dave Miller [:justdave] <justdave@mozilla.com> who provided the following reason: spam The token used to delete this attachment was generated at 2010-10-23 22:38:46 PDT.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: