Closed
Bug 860572
Opened 11 years ago
Closed 11 years ago
Add specializations of Handle and MutableHandle for JSPropertyDescriptor
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
mozilla23
People
(Reporter: bzbarsky, Assigned: terrence)
References
Details
Attachments
(2 files, 3 obsolete files)
9.58 KB,
patch
|
jonco
:
review+
|
Details | Diff | Splinter Review |
2.05 KB,
patch
|
bholley
:
review+
|
Details | Diff | Splinter Review |
The idea is that: 1) Callees should be able to tell when their desc is rooted. 2) They should be able to easily get a MutableHandle<Value> for the .value of a MutableHandle<JSPropertyDescriptor>. And perhaps similar for the .obj. What to do with the getter and setter.... <sigh>. I have no idea for those.
Assignee | ||
Comment 1•11 years ago
|
||
This should be all that's needed. https://tbpl.mozilla.org/?tree=Try&rev=b42ebc59fbcc
Assignee: general → terrence
Status: NEW → ASSIGNED
Reporter | ||
Comment 2•11 years ago
|
||
I guess we'll need a followup to actually use this, right?
Assignee | ||
Comment 3•11 years ago
|
||
(In reply to Boris Zbarsky (:bz) from comment #2) > I guess we'll need a followup to actually use this, right? Yes, and some fixes to this patch as well. It seems there is a good reason I don't normally code when tired.
Assignee | ||
Comment 4•11 years ago
|
||
Build succeeded locally, so off to try again: https://tbpl.mozilla.org/?tree=Try&rev=83688476493f
Attachment #736108 -
Attachment is obsolete: true
Assignee | ||
Comment 5•11 years ago
|
||
Fixed clang errors: https://tbpl.mozilla.org/?tree=Try&rev=3a4dc299d3f1
Assignee | ||
Updated•11 years ago
|
Blocks: ExactRootingBrowser
Assignee | ||
Comment 6•11 years ago
|
||
And fix a namespace error. I hope this is the last try run we'll need: https://tbpl.mozilla.org/?tree=Try&rev=63905e8538cb
Attachment #736554 -
Attachment is obsolete: true
Attachment #737032 -
Flags: review?(jcoppeard)
Assignee | ||
Comment 7•11 years ago
|
||
Comment on attachment 737032 [details] [diff] [review] v2 Actually, lets add the helper methods to Handle and MutableHandle too.
Attachment #737032 -
Flags: review?(jcoppeard)
Assignee | ||
Comment 8•11 years ago
|
||
Implements HandleBase and MutableHandleBase as well.
Attachment #737032 -
Attachment is obsolete: true
Attachment #737058 -
Flags: review?(jcoppeard)
Assignee | ||
Comment 9•11 years ago
|
||
Rooted adds helper methods to JSPropertyDescriptor to make using it less error-prone. This is an example of such usage.
Attachment #737060 -
Flags: review?(bobbyholley+bmo)
Updated•11 years ago
|
Attachment #737060 -
Flags: review?(bobbyholley+bmo) → review+
Comment 10•11 years ago
|
||
Comment on attachment 737058 [details] [diff] [review] 1 of 2: v3 Review of attachment 737058 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/gc/RootMarking.cpp @@ +67,5 @@ > case THING_ROOT_VALUE: MarkValueRoot(trc, (Value *)addr, "exact-value"); break; > case THING_ROOT_ID: MarkIdRoot(trc, (jsid *)addr, "exact-id"); break; > case THING_ROOT_PROPERTY_ID: MarkIdRoot(trc, &((js::PropertyId *)addr)->asId(), "exact-propertyid"); break; > case THING_ROOT_BINDINGS: ((Bindings *)addr)->trace(trc); break; > + case THING_ROOT_BINDINGS: ((JSPropertyDescriptor *)addr)->trace(trc); break; I think you mean THING_ROOT_PROPERTY_DESCRIPTOR here. ::: js/src/gc/Verifier.cpp @@ +37,3 @@ > return address == static_cast<void*>(w); > > Bindings *bp = static_cast<Bindings*>(address); This assumes address is always a Binding which is now not the case any more. ::: js/src/jsapi.h @@ +3328,5 @@ > + JS::MutableHandleObject obj() { return JS::MutableHandleObject::fromMarkedLocation(&desc()->obj); } > + JS::MutableHandleValue value() { return JS::MutableHandleValue::fromMarkedLocation(&desc()->value); } > + bool hasGetterObject() const { return desc()->attrs & JSPROP_GETTER; } > + bool hasSetterObject() const { return desc()->attrs & JSPROP_SETTER; } > + JSPropertyOp getter() const { MOZ_ASSERT(!hasGetterObject()); return desc()->getter; } The assertion condition looks like it's the wrong way round to me (same on next line).
Attachment #737058 -
Flags: review?(jcoppeard) → review+
Comment 11•11 years ago
|
||
(In reply to Jon Coppeard (:jonco) from comment #10) > > + JSPropertyOp getter() const { MOZ_ASSERT(!hasGetterObject()); return desc()->getter; } > > The assertion condition looks like it's the wrong way round to me (same on > next line). Disregard this one, I realised that getter/setter are used for different types depending on the flags in attrs. One more thing though, in the XrayWrapper code it would be useful to have a way to get attrs, as well as to set getter and setter.
Assignee | ||
Comment 12•11 years ago
|
||
(In reply to Jon Coppeard (:jonco) from comment #10) > ::: js/src/gc/RootMarking.cpp > @@ +67,5 @@ > > case THING_ROOT_VALUE: MarkValueRoot(trc, (Value *)addr, "exact-value"); break; > > case THING_ROOT_ID: MarkIdRoot(trc, (jsid *)addr, "exact-id"); break; > > case THING_ROOT_PROPERTY_ID: MarkIdRoot(trc, &((js::PropertyId *)addr)->asId(), "exact-propertyid"); break; > > case THING_ROOT_BINDINGS: ((Bindings *)addr)->trace(trc); break; > > + case THING_ROOT_BINDINGS: ((JSPropertyDescriptor *)addr)->trace(trc); break; > > I think you mean THING_ROOT_PROPERTY_DESCRIPTOR here. D'oh! (In reply to Jon Coppeard (:jonco) from comment #11) > (In reply to Jon Coppeard (:jonco) from comment #10) > Disregard this one, I realised that getter/setter are used for different > types depending on the flags in attrs. Yeah, this is, in my opinion, the worst GC issue in SpiderMonkey: for example, for Shapes we also have to special-case the post barrier because of this. A quick survey of PropertyDescriptor seems to show that all of the SpiderMonkey uses are on the stack as well. I'll file a new bug to remove the AutoRooter. > One more thing though, in the XrayWrapper code it would be useful to have a > way to get attrs, as well as to set getter and setter. Good point! In the long run we'd like JSPropertyDescriptor to match the spec's concept of a PropertyDescriptor. However, after talking this over with Waldo, we concluded that this is long enough off that a suite of dumb wrappers of the existing functionality would be beneficial.
Assignee | ||
Comment 13•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/c849d14e7f59 https://hg.mozilla.org/integration/mozilla-inbound/rev/d02e437f5b48 Green try run at: https://tbpl.mozilla.org/?tree=Try&rev=63905e8538cb
Comment 14•11 years ago
|
||
http://hg.mozilla.org/integration/mozilla-inbound/rev/732e0bc6aff2 - backed out 2 patches for OSX build breakage
Assignee | ||
Comment 15•11 years ago
|
||
https://tbpl.mozilla.org/?tree=Try&rev=d3572d84f825
Assignee | ||
Comment 16•11 years ago
|
||
Okay, not really sure why the compiler only reported one of the two name-masking errors here. Lets spin the warning-as-errors wheel again: https://tbpl.mozilla.org/?tree=Try&rev=de71aa1c35c9
Assignee | ||
Comment 17•11 years ago
|
||
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/49dbf1510125 remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/e1939f325abb The full Try run appears to be green: https://tbpl.mozilla.org/?tree=Try&rev=de71aa1c35c9
Comment 18•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/49dbf1510125 https://hg.mozilla.org/mozilla-central/rev/e1939f325abb
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla23
You need to log in
before you can comment on or make changes to this bug.
Description
•