Closed
Bug 835417
Opened 11 years ago
Closed 11 years ago
Mark DOM getters as pure when they are
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla21
People
(Reporter: bzbarsky, Assigned: bzbarsky)
References
(Blocks 1 open bug)
Details
(Keywords: dev-doc-complete)
Attachments
(4 files, 1 obsolete file)
10.01 KB,
patch
|
peterv
:
review+
|
Details | Diff | Splinter Review |
3.20 KB,
patch
|
jandem
:
review+
|
Details | Diff | Splinter Review |
6.68 KB,
patch
|
peterv
:
review+
|
Details | Diff | Splinter Review |
6.36 KB,
patch
|
peterv
:
review+
|
Details | Diff | Splinter Review |
This is similar to bug 747289 but promises less. A pure getter promises that calling it has no side-effects (e.g. it doesn't flush and will never run script), but does not promise that the value returned is the same no matter what. So it can be reordered wrt slot sets, but not wrt DOM methods or setters. A preliminary attempt at this for Element.id gives me http://dromaeo.com/?id=189130,189131 because it makes Dromaeo's .id test completely useless.... But I expect this to help in real-life code that touches things like .className too. Now one issue is that _most_ DOM getters are pure, but to be safe-by-default we should probably explicitly mark them so. That means an unfortunate lot of annotation. :(
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → bzbarsky
Whiteboard: [need review]
Assignee | ||
Comment 1•11 years ago
|
||
Attachment #707154 -
Flags: review?(peterv)
Assignee | ||
Comment 2•11 years ago
|
||
Attachment #707167 -
Flags: review?(peterv)
Assignee | ||
Comment 3•11 years ago
|
||
Attachment #707171 -
Flags: review?(jdemooij)
Assignee | ||
Comment 4•11 years ago
|
||
Attachment #707172 -
Flags: review?(peterv)
Assignee | ||
Comment 5•11 years ago
|
||
Oh, and I'm not doing methods yet because jandem tells me there are complications with trying to move around MCalls. But I really want to sort those out, and then we can do this for a bunch of methods too.
Assignee | ||
Updated•11 years ago
|
Keywords: dev-doc-needed
Comment 6•11 years ago
|
||
Comment on attachment 707171 [details] [diff] [review] part 3. Add the notion of aliasing DOM stuff to MIR and flag MGetDOMProperty with the right alias set if it's pure. Review of attachment 707171 [details] [diff] [review]: ----------------------------------------------------------------- Nice!
Attachment #707171 -
Flags: review?(jdemooij) → review+
Assignee | ||
Comment 7•11 years ago
|
||
Attachment #707342 -
Flags: review?(peterv)
Assignee | ||
Updated•11 years ago
|
Attachment #707154 -
Attachment is obsolete: true
Attachment #707154 -
Flags: review?(peterv)
Updated•11 years ago
|
Attachment #707342 -
Flags: review?(peterv) → review+
Comment 8•11 years ago
|
||
Comment on attachment 707167 [details] [diff] [review] part 2. Implement WebIDL parser and codegen support for marking things pure. Review of attachment 707167 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/bindings/Codegen.py @@ +4682,5 @@ > sig = sigs[0] > + if (len(sig[1]) != 0 or > + not infallibleForMember(self.member, sig[0], self.descriptor)): > + # We have arguments or our return-value boxing can fail > + methodInfal = False I think you should just do the |methodInfal = "infallible" in self.descriptor.getExtendedAttributes(self.member)| bit here in an else block.
Attachment #707167 -
Flags: review?(peterv) → review+
Updated•11 years ago
|
Attachment #707172 -
Flags: review?(peterv) → review+
Assignee | ||
Comment 9•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/fce9b4a08399 https://hg.mozilla.org/integration/mozilla-inbound/rev/f0bd3d538233 https://hg.mozilla.org/integration/mozilla-inbound/rev/0a21a1eeda35 https://hg.mozilla.org/integration/mozilla-inbound/rev/d8a95f5b67d7
Flags: in-testsuite+
Whiteboard: [need review]
Target Milestone: --- → mozilla21
Assignee | ||
Comment 10•11 years ago
|
||
Documented at https://developer.mozilla.org/en-US/docs/Mozilla/WebIDL_bindings#.5BPure.5D
Keywords: dev-doc-needed → dev-doc-complete
Comment 11•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/fce9b4a08399 https://hg.mozilla.org/mozilla-central/rev/f0bd3d538233 https://hg.mozilla.org/mozilla-central/rev/0a21a1eeda35 https://hg.mozilla.org/mozilla-central/rev/d8a95f5b67d7
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•