Open Bug 1423964 Opened 7 years ago Updated 2 years ago

stylo-chrome: Gecko_GetDocumentLWTheme and ThreadSafeGetDocumentLWTheme show up in profile

Categories

(Core :: CSS Parsing and Computation, enhancement, P3)

enhancement

Tracking

()

Tracking Status
firefox59 --- affected

People

(Reporter: xidorn, Unassigned)

References

(Blocks 1 open bug)

Details

Gecko_GetDocumentLWTheme and ThreadSafeGetDocumentLWTheme shows up in profiles for tpaint with several samples.

Looking at them, I think it makes sense to initialize XULDocument::mDocLWTheme as soon as possible, and avoid querying attribute during traversal. It can probably happen in nsXULElement::BindToTree.

It seems that we already re-evaluate mDocLWTheme every time the relevant attribute is changed, so I guess as far as we have the field initialized properly at the beginning, we don't need a separate ThreadSafeGetDocumentLWTheme method for that, and can assert when we query it, the field has been set.

With that, we can inlinize the whole Gecko_GetDocumentLWTheme into Servo side with just a document type check, a type cast, and a field access. We may need to generate bindings for XULDocument, though.

Not sure whether it's worth. It seems to only take like 0.1% of time in tpaint.
Priority: -- → P1
Priority: P1 → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.