Closed Bug 742841 Opened 13 years ago Closed 12 years ago

Store Debugger.X objects in the cross-compartment map

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla16

People

(Reporter: billm, Assigned: billm)

References

Details

Attachments

(1 file, 1 obsolete file)

Attached patch patch (obsolete) (deleted) — Splinter Review
This patch adds Debugger objects to the cross-compartment map. I have a later patch where I want to be able to easily iterate over all cross-compartment references.
Attachment #612642 - Flags: review?(jorendorff)
Comment on attachment 612642 [details] [diff] [review] patch Review of attachment 612642 [details] [diff] [review]: ----------------------------------------------------------------- This looks great. r=me. ::: js/src/jscompartment.cpp @@ +504,5 @@ > + JS_ASSERT(static_cast<Cell *>(value.toGCThing())->compartment() == this); > + > + if (IsAboutToBeFinalized(key.wrapped) || > + IsAboutToBeFinalized(value) || > + (key.debugger && IsAboutToBeFinalized(key.debugger))) OK. This is the only tricky bit, and I think this is correct. IsAboutToBeFinalized(value) will never be true if key.debugger and key.wrapped are both still live, thanks to all that complex markAllIteratively code in Debugger.cpp that you left as-is. Right? ::: js/src/jscompartment.h @@ +179,5 @@ > + Kind kind; > + JSObject *debugger; > + js::gc::Cell *wrapped; > + > + CrossCompartmentKey() {} Maybe initialize to NULL. (HashMap::remove requires this default constructor; the value is never used, so an empty constructor is correct--but deterministic behavior is correct too and only costs a few insns. Your call.)
Attachment #612642 - Flags: review?(jorendorff) → review+
(In reply to Jason Orendorff [:jorendorff] from comment #1) > IsAboutToBeFinalized(value) will never be true if key.debugger and > key.wrapped are both still live, thanks to all that complex > markAllIteratively code in Debugger.cpp that you left as-is. Right? This is true, but I think it's because of the weakmap that the debugger keeps from Objects to Debugger.Objects. If the debugger is alive, its weakmap is traced. The weakmap key is key.wrapped, and if that's alive then the weakmap keeps value alive.
Agreed.
Blocks: 754495
Attached patch rebased patch (deleted) — Splinter Review
I've got this running on tryserver now.
Attachment #612642 - Attachment is obsolete: true
Attachment #628135 - Flags: review+
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: