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)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla16
People
(Reporter: billm, Assigned: billm)
References
Details
Attachments
(1 file, 1 obsolete file)
(deleted),
patch
|
billm
:
review+
|
Details | Diff | 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 1•13 years ago
|
||
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+
Assignee | ||
Comment 2•13 years ago
|
||
(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.
Comment 3•13 years ago
|
||
Agreed.
Assignee | ||
Comment 4•13 years ago
|
||
I've got this running on tryserver now.
Attachment #612642 -
Attachment is obsolete: true
Attachment #628135 -
Flags: review+
Assignee | ||
Comment 5•12 years ago
|
||
Target Milestone: --- → mozilla16
Comment 6•12 years ago
|
||
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.
Description
•