Closed
Bug 598832
Opened 13 years ago
Closed 13 years ago
Consider eliminating RuleProcessorData
Categories
(Core :: CSS Parsing and Computation, defect, P2)
Core
CSS Parsing and Computation
Tracking
()
RESOLVED
FIXED
mozilla5
People
(Reporter: bzbarsky, Assigned: bzbarsky)
References
(Depends on 1 open bug, Blocks 1 open bug)
Details
Attachments
(16 files, 18 obsolete files)
Except for the nth-* stuff, everything else can be gotten off the node quickly enough nowadays to not regress matching on "real" pages, and some things speed up due to not having to create and destroy these structs.
![]() |
Assignee | |
Comment 1•13 years ago
|
||
I have patches to do this, but they've likely bitrotted. I'll try to dust them off once the fx4 dust settles.
![]() |
Assignee | |
Comment 2•13 years ago
|
||
I'm going to post my wip queue here, merged to tip. Not asking for review yet, because there are unresolved issues with the nth-child cache stuff and intrinsic state.
![]() |
Assignee | |
Comment 3•13 years ago
|
||
![]() |
Assignee | |
Comment 4•13 years ago
|
||
![]() |
Assignee | |
Comment 5•13 years ago
|
||
![]() |
Assignee | |
Comment 6•13 years ago
|
||
![]() |
Assignee | |
Comment 7•13 years ago
|
||
![]() |
Assignee | |
Comment 8•13 years ago
|
||
![]() |
Assignee | |
Comment 9•13 years ago
|
||
![]() |
Assignee | |
Comment 10•13 years ago
|
||
![]() |
Assignee | |
Comment 11•13 years ago
|
||
![]() |
Assignee | |
Comment 12•13 years ago
|
||
![]() |
Assignee | |
Comment 13•13 years ago
|
||
![]() |
Assignee | |
Comment 14•13 years ago
|
||
![]() |
Assignee | |
Comment 15•13 years ago
|
||
![]() |
Assignee | |
Comment 16•13 years ago
|
||
![]() |
Assignee | |
Comment 17•13 years ago
|
||
Comment 18•13 years ago
|
||
Comment on attachment 497475 [details] [diff] [review] Remove mNthIndices >+ * The Initial Developer of the Original Code is >+ * Mozilla Corporation. MoFo
![]() |
Assignee | |
Comment 19•13 years ago
|
||
Yes. And that patch is getting rewritten anyway to deal with bug 631529.
![]() |
Assignee | |
Updated•13 years ago
|
![]() |
Assignee | |
Comment 20•13 years ago
|
||
Attachment #510864 -
Flags: review?(dbaron)
![]() |
Assignee | |
Updated•13 years ago
|
Attachment #497471 -
Attachment is obsolete: true
![]() |
Assignee | |
Comment 21•13 years ago
|
||
Attachment #510866 -
Flags: review?(dbaron)
![]() |
Assignee | |
Updated•13 years ago
|
Attachment #497472 -
Attachment is obsolete: true
![]() |
Assignee | |
Comment 22•13 years ago
|
||
Attachment #510867 -
Flags: review?(dbaron)
![]() |
Assignee | |
Updated•13 years ago
|
Attachment #497473 -
Attachment is obsolete: true
![]() |
Assignee | |
Updated•13 years ago
|
Attachment #497470 -
Attachment is obsolete: true
![]() |
Assignee | |
Comment 23•13 years ago
|
||
Attachment #510868 -
Flags: review?(dbaron)
![]() |
Assignee | |
Updated•13 years ago
|
Attachment #497474 -
Attachment is obsolete: true
![]() |
Assignee | |
Comment 24•13 years ago
|
||
Attachment #510869 -
Flags: review?(dbaron)
![]() |
Assignee | |
Updated•13 years ago
|
Attachment #497475 -
Attachment is obsolete: true
![]() |
Assignee | |
Comment 25•13 years ago
|
||
Attachment #510870 -
Flags: review?(dbaron)
![]() |
Assignee | |
Updated•13 years ago
|
Attachment #497476 -
Attachment is obsolete: true
![]() |
Assignee | |
Comment 26•13 years ago
|
||
Attachment #510874 -
Flags: review?(dbaron)
![]() |
Assignee | |
Updated•13 years ago
|
Attachment #497477 -
Attachment is obsolete: true
![]() |
Assignee | |
Comment 27•13 years ago
|
||
Attachment #510890 -
Flags: review?(dbaron)
![]() |
Assignee | |
Updated•13 years ago
|
Attachment #497478 -
Attachment is obsolete: true
![]() |
Assignee | |
Comment 28•13 years ago
|
||
Attachment #510891 -
Flags: review?(dbaron)
![]() |
Assignee | |
Updated•13 years ago
|
Attachment #497479 -
Attachment is obsolete: true
![]() |
Assignee | |
Comment 29•13 years ago
|
||
Attachment #510892 -
Flags: review?(dbaron)
![]() |
Assignee | |
Updated•13 years ago
|
Attachment #497480 -
Attachment is obsolete: true
![]() |
Assignee | |
Comment 30•13 years ago
|
||
Attachment #510893 -
Flags: review?(dbaron)
![]() |
Assignee | |
Updated•13 years ago
|
Attachment #497481 -
Attachment is obsolete: true
![]() |
Assignee | |
Comment 31•13 years ago
|
||
Attachment #510894 -
Flags: review?(dbaron)
![]() |
Assignee | |
Updated•13 years ago
|
Attachment #497482 -
Attachment is obsolete: true
![]() |
Assignee | |
Comment 32•13 years ago
|
||
Attachment #510895 -
Flags: review?(dbaron)
![]() |
Assignee | |
Updated•13 years ago
|
Attachment #497483 -
Attachment is obsolete: true
![]() |
Assignee | |
Comment 33•13 years ago
|
||
Attachment #510896 -
Flags: review?(dbaron)
![]() |
Assignee | |
Updated•13 years ago
|
Attachment #497484 -
Attachment is obsolete: true
![]() |
Assignee | |
Comment 34•13 years ago
|
||
Attachment #510897 -
Flags: review?(dbaron)
![]() |
Assignee | |
Comment 35•13 years ago
|
||
Attachment #510898 -
Flags: review?(dbaron)
![]() |
Assignee | |
Updated•13 years ago
|
Whiteboard: [need review]
![]() |
Assignee | |
Comment 36•13 years ago
|
||
Attachment #511645 -
Flags: review?(dbaron)
![]() |
Assignee | |
Updated•13 years ago
|
Attachment #510897 -
Attachment is obsolete: true
Attachment #510897 -
Flags: review?(dbaron)
![]() |
Assignee | |
Comment 37•13 years ago
|
||
Attachment #511647 -
Flags: review?(dbaron)
![]() |
Assignee | |
Updated•13 years ago
|
Attachment #510898 -
Attachment is obsolete: true
Attachment #510898 -
Flags: review?(dbaron)
![]() |
Assignee | |
Comment 38•13 years ago
|
||
Attachment #511754 -
Flags: review?(dbaron)
![]() |
Assignee | |
Updated•13 years ago
|
Attachment #511647 -
Attachment is obsolete: true
Attachment #511647 -
Flags: review?(dbaron)
Comment 39•13 years ago
|
||
Comment on attachment 510864 [details] [diff] [review] part 1. Move TreeMatchContext out to where things other than the rule processor can get at it. >+ * A |TreeMatchContext| has data about a matching operation. This >+ * data is not node-specific but is an invariant of the DOM tree the s/This data is/The data are/ >+ // Reset this data for :visited matching. This should only be s/for :visited matching/for matching for the style-if-:visited/, perhaps? Also, I don't see why ResetForVisitedMatching sets mHaveRelevantLink to false. It's only called *after* mHaveRelevantLink is tested, as far as I can tell. I'm a little uncomfortable with the way the RuleProcessorData constructor initializes mVisitedHandling in the case where there isn't a rule walker -- it's assuming a default -- but I'm hoping that goes away in a later patch. r=dbaron with that
Attachment #510864 -
Flags: review?(dbaron) → review+
Comment 40•13 years ago
|
||
Comment on attachment 510866 [details] [diff] [review] part 2. Move tracking of the scope root to the TreeMatchContext. r=dbaron
Attachment #510866 -
Flags: review?(dbaron) → review+
Comment 41•13 years ago
|
||
Comment on attachment 510867 [details] [diff] [review] part 3. Stop keeping track of whether the node or document is HTML in the RuleProcessorData. r=dbaron
Attachment #510867 -
Flags: review?(dbaron) → review+
Comment 42•13 years ago
|
||
Comment on attachment 510868 [details] [diff] [review] part 4. Move tracking of whether we're in quirks mode to the TreeMatchContext. r=dbaron
Attachment #510868 -
Flags: review?(dbaron) → review+
![]() |
Assignee | |
Comment 43•13 years ago
|
||
> s/This data is/The data are/ > s/for :visited matching/for matching for the style-if-:visited/, perhaps? Done. > Also, I don't see why ResetForVisitedMatching sets mHaveRelevantLink > to false. It's only called *after* mHaveRelevantLink is tested. Not quite: we test mHaveRelevantLink in selector matching too. But more importantly, once all is said and done we'll be reusing these objects for multiple matching operations, so I wanted to reset them "fully". > but I'm hoping that goes away in a later patch. Yeah, it basically does.
Comment 44•13 years ago
|
||
Comment on attachment 510869 [details] [diff] [review] part 5. Move caching of nth-index stuff to the TreeMatchContext. I think I should probably be on the Contributors line in the new files too, since it is based on the existing code from bug 75375. We do have a whole bunch of tests for this code, so I didn't feel like I needed to be *really* careful reviewing it. r=dbaron
Attachment #510869 -
Flags: review?(dbaron) → review+
Comment 45•13 years ago
|
||
Comment on attachment 510870 [details] [diff] [review] part 6. Stop caching the language of elements; just reget it from the DOM as needed. r=dbaron (I hope you're indentation's right. I turned this into a diff -w.)
Attachment #510870 -
Flags: review?(dbaron) → review+
Comment 46•13 years ago
|
||
Comment on attachment 510874 [details] [diff] [review] part 7. Stop caching the content state of elements; just reget it from the DOM as needed. r=dbaron
Attachment #510874 -
Flags: review?(dbaron) → review+
Comment 47•13 years ago
|
||
Comment on attachment 510890 [details] [diff] [review] part 8. Move NodeMatchContext higher up the callstack, so that we don't have to call IsLink as much. r=dbaron (I found the Pseudo and XULTree cases a little confusing, but I think that's largely due to my memory of how the code used to work. I guess it's relatively straightforward that we'd be constructing a node match context for the actual node; I'm just not used to it.)
Attachment #510890 -
Flags: review?(dbaron) → review+
Comment 48•13 years ago
|
||
Comment on attachment 510891 [details] [diff] [review] part 9. Stop caching the element's local name; just get it from the DOM as needed. >+ if (mTagTable.entryCount) { > RuleHashTableEntry *entry = static_cast<RuleHashTableEntry*> >- (PL_DHashTableOperate(&mTagTable, aTag, PL_DHASH_LOOKUP)); >+ (PL_DHashTableOperate(&mTagTable, tag, PL_DHASH_LOOKUP)); Assert that |tag| is non-null? > /* virtual */ nsRestyleHint > nsHTMLStyleSheet::HasStateDependentStyle(StateRuleProcessorData* aData) > { > if (aData->mElement->IsHTML() && >- aData->mContentTag == nsGkAtoms::a && >+ aData->mElement->Tag() == nsGkAtoms::a && >@@ nsHTMLStyleSheet::HasAttributeDependentS > element->IsHTML() && >- aData->mContentTag == nsGkAtoms::a) { >+ aData->mElement->Tag() == nsGkAtoms::a) { ... > element->IsHTML() && >- aData->mContentTag == nsGkAtoms::table) { >+ element->Tag() == nsGkAtoms::table) { In all three of these, use nsIContent::IsHTML(nsIAtom*) to combine the IsHTML and Tag() == checks. r=dbaron with that
Attachment #510891 -
Flags: review?(dbaron) → review+
Comment 49•13 years ago
|
||
Comment on attachment 510892 [details] [diff] [review] part 10. Stop caching information about the element's attributes; just get it from the DOM as needed. r=dbaron
Attachment #510892 -
Flags: review?(dbaron) → review+
Comment 50•13 years ago
|
||
Comment on attachment 510893 [details] [diff] [review] part 11. Stop caching the parent content pointer and the element pointer; just use the passed-in aElement. r=dbaron
Attachment #510893 -
Flags: review?(dbaron) → review+
Comment 51•13 years ago
|
||
Comment on attachment 510894 [details] [diff] [review] part 12. Stop using RuleProcessorData in SelectorMatchesTree. >- if (! data) { >+ if (! element) { Fix the out-of-style space while you're here. r=dbaron
Attachment #510894 -
Flags: review?(dbaron) → review+
Comment 52•13 years ago
|
||
Comment on attachment 510895 [details] [diff] [review] part 13. Stop using RuleProcessorData in the DOM-exposed selector-matching methods. Can and should we assert that the document parameter to TreeMatchContext's constructor is non-null? r=dbaron
Attachment #510895 -
Flags: review?(dbaron) → review+
Comment 53•13 years ago
|
||
Comment on attachment 510896 [details] [diff] [review] part 14. Make RuleProcessorData a stack-only class. r=dbaron
Attachment #510896 -
Flags: review?(dbaron) → review+
Comment 54•13 years ago
|
||
Comment on attachment 511645 [details] [diff] [review] part 15. Make RuleProcessorData not inherit from TreeMatchContext anymore, so we can decouple the lifetimes. Avoid the extra blank line at the start of nsStyleSet::HasAttributeDependentStyle Also, I tend to wrap comments at tw=72... which explains some of the extra blame you're taking for parts of comments you're not modifying. Rewrapping back to 72 might be nice.
Attachment #511645 -
Flags: review?(dbaron) → review+
Comment 55•13 years ago
|
||
Comment on attachment 511754 [details] [diff] [review] part 16. Use a single TreeMatchContext for all the style resolution that the frame constructor does as part of a single frame construction batch. r=dbaron
Attachment #511754 -
Flags: review?(dbaron) → review+
![]() |
Assignee | |
Comment 56•13 years ago
|
||
> I think I should probably be on the Contributors line in the new files Good point. Done. > Assert that |tag| is non-null? Added an NS_ABORT_IF_FALSE to that effect after getting all the stuff up front in ContentEnumFunc. > In all three of these, use nsIContent::IsHTML(nsIAtom*) Done. > Fix the out-of-style space while you're here. Done. > Can and should we assert that the document parameter to TreeMatchContext's > constructor is non-null? The constructor will crash if it's not, since it calls aDocument->IsHTML(). Not much point asserting it, I think, given that. > Avoid the extra blank line at the start of > nsStyleSet::HasAttributeDependentStyle Done. > Rewrapping back to 72 might be nice. Done.
![]() |
Assignee | |
Updated•13 years ago
|
Whiteboard: [need review] → [need bug 598833 fixed?]
![]() |
Assignee | |
Comment 57•13 years ago
|
||
Pushed: http://hg.mozilla.org/mozilla-central/rev/111f5d2ac1d4 http://hg.mozilla.org/mozilla-central/rev/062e9c1f0f12 http://hg.mozilla.org/mozilla-central/rev/9e8a8d33d832 http://hg.mozilla.org/mozilla-central/rev/cc247d27fd26 http://hg.mozilla.org/mozilla-central/rev/578244f76827 http://hg.mozilla.org/mozilla-central/rev/b97449d87066 http://hg.mozilla.org/mozilla-central/rev/9620fda1e190 http://hg.mozilla.org/mozilla-central/rev/d5e60cc85ae6 http://hg.mozilla.org/mozilla-central/rev/507584f316f5 http://hg.mozilla.org/mozilla-central/rev/0ac105c41106 http://hg.mozilla.org/mozilla-central/rev/b6e6b9207590 http://hg.mozilla.org/mozilla-central/rev/d0198ec8be5c http://hg.mozilla.org/mozilla-central/rev/3efc95473d4b http://hg.mozilla.org/mozilla-central/rev/49fa60035338 http://hg.mozilla.org/mozilla-central/rev/5a3e00beb461 http://hg.mozilla.org/mozilla-central/rev/c52e41b73b97 dromaeo_css, which uses querySelectorAll, apparently, got 20-25% faster.
Status: NEW → RESOLVED
Closed: 13 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Whiteboard: [need bug 598833 fixed?]
Target Milestone: --- → mozilla2.2
![]() |
Assignee | |
Comment 58•13 years ago
|
||
Though that might have been from bug 631837, which had this bug as a prerequisite.
You need to log in
before you can comment on or make changes to this bug.
Description
•