Skip to content

Commit 893df28

Browse files
committed
LibJS: Don't allocate property table during GC marking phase
Shape was allocating property tables inside visit_children(), which could cause garbage collection to happen. It's not very good to start a new garbage collection while you are in the middle of one already.
1 parent 4036ff9 commit 893df28

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Libraries/LibJS/Runtime/Shape.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,10 @@ void Shape::visit_children(Cell::Visitor& visitor)
104104
for (auto& it : m_forward_transitions)
105105
visitor.visit(it.value);
106106

107-
ensure_property_table();
108-
for (auto& it : *m_property_table)
109-
it.key.visit_children(visitor);
107+
if (m_property_table) {
108+
for (auto& it : *m_property_table)
109+
it.key.visit_children(visitor);
110+
}
110111
}
111112

112113
Optional<PropertyMetadata> Shape::lookup(const StringOrSymbol& property_name) const

0 commit comments

Comments
 (0)