Closed
Bug 560412
Opened 14 years ago
Closed 14 years ago
Publicly expose the value of LazilyConstructed<T> objects
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
People
(Reporter: mozilla+ben, Assigned: mozilla+ben)
References
Details
Attachments
(2 files, 1 obsolete file)
1.21 KB,
patch
|
luke
:
review+
|
Details | Diff | Splinter Review |
692 bytes,
patch
|
luke
:
review+
|
Details | Diff | Splinter Review |
Currently LazilyConstructed<T> values can be constructed, but the constructed values can't be accessed outside the class. I propose adding T *address(); const T *address() const; Also, it seems that the const empty() function has trouble calling the non-const constructed() method, which has presumably been ok until now because empty() was never called. I can fix that too while I'm at it.
Assignee | ||
Comment 1•14 years ago
|
||
(In reply to comment #0) > const T *address() const; This isn't really necessary, on second thought, because LazilyConstructed<T> objects will never be immutable.
Comment 2•14 years ago
|
||
Sounds good. Incidentally, TM tip has a newer version of LazilyConstructed (silencing bloody GCC strict-aliasing warnings) which you probably want to work against. Also, is there any chance we could get a return-by-reference member instead of or in addition to address()? Also, the ever-popular AutoValueRooter calls their return-by-pointer addr(), so perhaps that abbreviation could be used for consistency?
Assignee | ||
Comment 3•14 years ago
|
||
I was torn between implementing empty() as return !static_cast<LazilyConstructed*>(this)->constructed(); or simply return !bytes[sizeof(T)]; I went with the latter for brevity, although it duplicates the converted() code.
Attachment #440101 -
Flags: review?(lw)
Assignee | ||
Comment 4•14 years ago
|
||
These comments passed (without collision??) in mid-air. I like your suggestions and will update momentarily.
Assignee | ||
Comment 5•14 years ago
|
||
This applies to mozilla-central. I'll post a TM patch next.
Attachment #440101 -
Attachment is obsolete: true
Attachment #440104 -
Flags: review?(lw)
Attachment #440101 -
Flags: review?(lw)
Updated•14 years ago
|
Attachment #440104 -
Flags: review?(lw) → review+
Comment 7•14 years ago
|
||
Comment on attachment 440106 [details] [diff] [review] TM-relative patch. Thank you, sir
Attachment #440106 -
Flags: review?(lw) → review+
Assignee | ||
Comment 8•14 years ago
|
||
Does this need any more review before landing (either on TM or mozilla-central, or both)?
Comment 9•14 years ago
|
||
Nope, Luke's review is sufficient.
Assignee | ||
Comment 10•14 years ago
|
||
Pushed to tracemonkey: http://hg.mozilla.org/tracemonkey/rev/b22a8aee5311
Comment 11•14 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/b22a8aee5311
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•