summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Heap/Heap.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-07-21 19:45:21 +0200
committerAndreas Kling <kling@serenityos.org>2021-07-21 19:45:21 +0200
commit746b310061e8ba90aa0de40070c38fc97adde4cd (patch)
treeced3c6cfb578d54e5e7c3d1b2e881b4735142c6b /Userland/Libraries/LibJS/Heap/Heap.cpp
parent8ea029405f9f75c6f80217abfa591ccbd322a339 (diff)
downloadserenity-746b310061e8ba90aa0de40070c38fc97adde4cd.zip
LibJS: Use IntrusiveList for keeping track of HandleImpls
This allows us to remove a HashTable from heap and cuts down on some of the malloc traffic when creating handles.
Diffstat (limited to 'Userland/Libraries/LibJS/Heap/Heap.cpp')
-rw-r--r--Userland/Libraries/LibJS/Heap/Heap.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/Userland/Libraries/LibJS/Heap/Heap.cpp b/Userland/Libraries/LibJS/Heap/Heap.cpp
index c1ee023ecb..16555b0a2d 100644
--- a/Userland/Libraries/LibJS/Heap/Heap.cpp
+++ b/Userland/Libraries/LibJS/Heap/Heap.cpp
@@ -91,8 +91,8 @@ void Heap::gather_roots(HashTable<Cell*>& roots)
vm().gather_roots(roots);
gather_conservative_roots(roots);
- for (auto* handle : m_handles)
- roots.set(handle->cell());
+ for (auto& handle : m_handles)
+ roots.set(handle.cell());
for (auto* list : m_marked_value_lists) {
for (auto& value : list->values()) {
@@ -258,14 +258,14 @@ void Heap::sweep_dead_cells(bool print_report, const Core::ElapsedTimer& measure
void Heap::did_create_handle(Badge<HandleImpl>, HandleImpl& impl)
{
- VERIFY(!m_handles.contains(&impl));
- m_handles.set(&impl);
+ VERIFY(!m_handles.contains(impl));
+ m_handles.append(impl);
}
void Heap::did_destroy_handle(Badge<HandleImpl>, HandleImpl& impl)
{
- VERIFY(m_handles.contains(&impl));
- m_handles.remove(&impl);
+ VERIFY(m_handles.contains(impl));
+ m_handles.remove(impl);
}
void Heap::did_create_marked_value_list(Badge<MarkedValueList>, MarkedValueList& list)