@@ -75,33 +75,31 @@ impl CachedSet {
75 // node has.
75 // node has.
76 fn trace(&self, node: &Node) -> FxHashSet<CacheId> {
76 fn trace(&self, node: &Node) -> FxHashSet<CacheId> {
77 let mut edges = FxHashSet::default();
77 let mut edges = FxHashSet::default();
78+ self.trace_recursive(&mut edges, node);
79− let bump = Bump::new();
82+ fn trace_recursive(&self, edges: &mut FxHashSet<CacheId>, node: &Node) {
80− let mut stack = bumpalo::collections::Vec::with_capacity_in(64, &bump);
83− while let Some(node) = stack.pop() {
84− match &node.kind {
83+ match &node.kind {
85− NodeKind::Text(_) => continue,
84+ NodeKind::Text(_) => return,
86− NodeKind::Cached(c) => {
85+ NodeKind::Cached(c) => {
87− debug_assert!(self.items.contains_key(&c.id));
86+ debug_assert!(self.items.contains_key(&c.id));
88− edges.insert(c.id);
87+ edges.insert(c.id);
89− edges.extend(
88+ edges.extend(
90− self.items
89+ self.items
91− .get(&c.id)
90+ .get(&c.id)
92− .expect_throw("CachedSet::trace: should have c.id in cached set")
91+ .expect_throw("CachedSet::trace: should have c.id in cached set")
95− .cloned(),
94+ .cloned(),
98− NodeKind::Element(el) => {
97+ NodeKind::Element(el) => {
99− stack.extend(el.children);
98+ for child in el.children {
99+ self.trace_recursive(edges, child);
107 fn next_id(&mut self) -> CacheId {
105 fn next_id(&mut self) -> CacheId {