diff options
author | Andreas Kling <kling@serenityos.org> | 2020-09-20 19:11:49 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-09-20 19:11:49 +0200 |
commit | 893df28e803e17e57444f3933adf55a03e746ebf (patch) | |
tree | deb1bbb4a439ec06f3ee98dfc324b6312e105c8d /Libraries/LibJS | |
parent | 4036ff9d9185abe06c57ebfb8b1380b09eee7909 (diff) | |
download | serenity-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.cpp | 7 |
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 |