mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Avoid atomic overhead in Servo_Element_IsDisplayNone.
This reduces time spent in NoteDirtyElement by about 15% in the testcase. Even though the subsequent patch will cause us to call Servo_Element_IsDisplayNone less for this particular testcase, it could still be hot on other testcases, and so it's worth optimizing. MozReview-Commit-ID: 3F3Zfp48dDW
This commit is contained in:
parent
ac74cf7a60
commit
2b1c1d7b68
1 changed files with 7 additions and 2 deletions
|
@ -1024,8 +1024,13 @@ pub extern "C" fn Servo_Element_GetPseudoComputedValues(element: RawGeckoElement
|
|||
#[no_mangle]
|
||||
pub extern "C" fn Servo_Element_IsDisplayNone(element: RawGeckoElementBorrowed) -> bool {
|
||||
let element = GeckoElement(element);
|
||||
let data = element.borrow_data().expect("Invoking Servo_Element_IsDisplayNone on unstyled element");
|
||||
data.styles.is_display_none()
|
||||
let data = element.get_data().expect("Invoking Servo_Element_IsDisplayNone on unstyled element");
|
||||
|
||||
// This function is hot, so we bypass the AtomicRefCell. It would be nice to also assert that
|
||||
// we're not in the servo traversal, but this function is called at various intermediate
|
||||
// checkpoints when managing the traversal on the Gecko side.
|
||||
debug_assert!(is_main_thread());
|
||||
unsafe { &*data.as_ptr() }.styles.is_display_none()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue