summaryrefslogtreecommitdiff
path: root/Libraries/LibJS
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-09-20 19:11:49 +0200
committerAndreas Kling <kling@serenityos.org>2020-09-20 19:11:49 +0200
commit893df28e803e17e57444f3933adf55a03e746ebf (patch)
treedeb1bbb4a439ec06f3ee98dfc324b6312e105c8d /Libraries/LibJS
parent4036ff9d9185abe06c57ebfb8b1380b09eee7909 (diff)
downloadserenity-893df28e803e17e57444f3933adf55a03e746ebf.zip
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.
Diffstat (limited to 'Libraries/LibJS')
-rw-r--r--Libraries/LibJS/Runtime/Shape.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/Libraries/LibJS/Runtime/Shape.cpp b/Libraries/LibJS/Runtime/Shape.cpp
index ecfb4b1145..bb763e225a 100644
--- a/Libraries/LibJS/Runtime/Shape.cpp
+++ b/Libraries/LibJS/Runtime/Shape.cpp
@@ -104,9 +104,10 @@ void Shape::visit_children(Cell::Visitor& visitor)
for (auto& it : m_forward_transitions)
visitor.visit(it.value);
- ensure_property_table();
- for (auto& it : *m_property_table)
- it.key.visit_children(visitor);
+ if (m_property_table) {
+ for (auto& it : *m_property_table)
+ it.key.visit_children(visitor);
+ }
}
Optional<PropertyMetadata> Shape::lookup(const StringOrSymbol& property_name) const