Browse Source

LibJS: Mark forward shape transition keys

These should really be weakly held by the Shape, but we don't have a
mechanism for weak hashmap keys at the moment, so let's just mark
these for now so they don't go stale.
Andreas Kling 1 year ago
parent
commit
ef86cf4646
1 changed files with 6 additions and 0 deletions
  1. 6 0
      Userland/Libraries/LibJS/Runtime/Shape.cpp

+ 6 - 0
Userland/Libraries/LibJS/Runtime/Shape.cpp

@@ -126,6 +126,12 @@ void Shape::visit_edges(Cell::Visitor& visitor)
             it.key.visit_edges(visitor);
             it.key.visit_edges(visitor);
     }
     }
     visitor.ignore(m_prototype_transitions);
     visitor.ignore(m_prototype_transitions);
+
+    // FIXME: The forward transition keys should be weak, but we have to mark them for now in case they go stale.
+    if (m_forward_transitions) {
+        for (auto& it : *m_forward_transitions)
+            it.key.property_key.visit_edges(visitor);
+    }
 }
 }
 
 
 Optional<PropertyMetadata> Shape::lookup(StringOrSymbol const& property_key) const
 Optional<PropertyMetadata> Shape::lookup(StringOrSymbol const& property_key) const