Closed
Bug 771018
Opened 12 years ago
Closed 12 years ago
Stop using "const Shape" all over the place
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla16
People
(Reporter: billm, Assigned: billm)
Details
Attachments
(1 file)
95.87 KB,
patch
|
luke
:
review+
|
Details | Diff | Splinter Review |
There are a lot of places where we annotate Shapes as being const, and a lot of other places where Shapes are not const. These annotations impose a cost: whenever we use Shape, we have to decide whether each particular instance should be const or non-const. Then sometimes we have to propagate the const annotation to other places, or add ugly casts that don't always make sense. None of these annotations are really correct. Anytime we give an object a shape, we call setLastProperty and cast away the constness. This is necessary because objects make all sorts of changes to shapes, even the ones that are shared. As a final argument, it seems unlikely to me that anyone has ever caught a real bug because we had a const annotation on a Shape. So I propose we remove all the "const Shape"s at once so that we never have to think about them again.
Attachment #639192 -
Flags: review?(luke)
Comment 1•12 years ago
|
||
Yay! Agreed about the fundamental meaninglessness of 'const Shape'.
Comment 2•12 years ago
|
||
Comment on attachment 639192 [details] [diff] [review] patch Rock on. I've almost been annoyed enough to do this on a few occasions but I was too lazy.
Attachment #639192 -
Flags: review?(luke) → review+
Comment 3•12 years ago
|
||
Actually, to highlight the point you made in comment 0, second para, why don't we annotate all Shape* with 'volatile'?
Comment 4•12 years ago
|
||
I think using 'volatile' would just sow more confusion. Isn't volatile intended for things that can be modified by the OS/hardware? In this case all the writes will happen on the same thread, so Shape* rather than const Shape* or volatile Shape* seems correct.
Comment 5•12 years ago
|
||
Hehe, it looks like I wasn't ridiculous enough. I should have used <sarcasm> tags ;)
Comment 6•12 years ago
|
||
No, you should have suggested waiting for Terrence's atomics work so that we could use AtomicPtr<Shape> for doubleplussafety. (Had I been faster on the gun I would have suggested this before Brian could misinterpret it.)
Comment 7•12 years ago
|
||
Oh boy, another bug 752223.
Assignee | ||
Comment 8•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/fbd96a0bcc00
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla16
You need to log in
before you can comment on or make changes to this bug.
Description
•