Closed
Bug 808181
Opened 12 years ago
Closed 12 years ago
GC: don't allow implicit conversion of Return<T> to T
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla19
People
(Reporter: terrence, Assigned: terrence)
References
Details
Attachments
(1 file)
42.50 KB,
patch
|
jorendorff
:
review+
|
Details | Diff | Splinter Review |
Jason thought of a brilliant way for us to get type safety for Return<T> without having to re-root in NoGC scopes: make the getter take an unused ref to the AutoAssertNoGC guard. Between this and the SafeBool idiom that Jeff showed me this week, Return<T> should be much safer and easier to use, to the point where I don't think we need Unrooted<T> anymore. The attached patch implements this and fixes the ~60 places /that the compiler found/ that needed to be updated.
Attachment #677880 -
Flags: review?(jorendorff)
Comment 1•12 years ago
|
||
Comment on attachment 677880 [details] [diff] [review] v0 Review of attachment 677880 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/gc/Root.h @@ +490,5 @@ > + * This is the SafeBool idiom for allowing use of Return<T> as a boolean > + * without allowing implicit conversions to any arbitrary integer. > + */ > + operator ConvertibleToBool() const { > + return ptr_ ? 1 : NULL; Might as well do ? 1 : 0;
Comment 2•12 years ago
|
||
Comment on attachment 677880 [details] [diff] [review] v0 Review of attachment 677880 [details] [diff] [review]: ----------------------------------------------------------------- Looks good.
Attachment #677880 -
Flags: review?(jorendorff) → review+
Assignee | ||
Comment 3•12 years ago
|
||
jit-test pass locally: https://hg.mozilla.org/integration/mozilla-inbound/rev/f0d7c7806a90
Assignee | ||
Comment 4•12 years ago
|
||
And backed out in: https://hg.mozilla.org/integration/mozilla-inbound/rev/f55a7f84de7a So... success! :-(
Assignee | ||
Comment 5•12 years ago
|
||
Green try run at: https://tbpl.mozilla.org/?tree=Try&rev=ecf803ac85cb Re-pushed at: https://hg.mozilla.org/integration/mozilla-inbound/rev/4cee05d5b1ce
Comment 6•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/4cee05d5b1ce
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
You need to log in
before you can comment on or make changes to this bug.
Description
•