mirror of
https://github.com/servo/servo.git
synced 2025-09-30 00:29:14 +01:00
script_bindings: Remove Cell wrapper from thread-local RootCollection. (#39043)
This doesn't appear to make a big difference in speedometer results, but this removes some code from the hot path of creating DomRoot values. Before: `Score: 30.381097406624708 ± 2.0393225244958018` After: `Score: 30.344639420871395 ± 1.9359337921154696` Testing: Existing WPT coverage Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
d3c5a8ec15
commit
0481477f35
6 changed files with 9 additions and 37 deletions
|
@ -27,7 +27,6 @@
|
|||
use std::cell::{OnceCell, UnsafeCell};
|
||||
use std::default::Default;
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::marker::PhantomData;
|
||||
use std::{mem, ptr};
|
||||
|
||||
use js::jsapi::{Heap, JSObject, JSTracer, Value};
|
||||
|
@ -43,21 +42,6 @@ use crate::dom::bindings::reflector::DomObject;
|
|||
use crate::dom::bindings::trace::JSTraceable;
|
||||
use crate::dom::node::Node;
|
||||
|
||||
pub(crate) struct ThreadLocalStackRoots<'a>(PhantomData<&'a u32>);
|
||||
|
||||
impl<'a> ThreadLocalStackRoots<'a> {
|
||||
pub(crate) fn new(roots: &'a RootCollection) -> Self {
|
||||
STACK_ROOTS.with(|r| r.set(Some(roots)));
|
||||
ThreadLocalStackRoots(PhantomData)
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for ThreadLocalStackRoots<'_> {
|
||||
fn drop(&mut self) {
|
||||
STACK_ROOTS.with(|r| r.set(None));
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) trait ToLayout<T> {
|
||||
/// Returns `LayoutDom<T>` containing the same pointer.
|
||||
///
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue