/* * Copyright (c) 2021, Idan Horowitz * * SPDX-License-Identifier: BSD-2-Clause */ #include namespace JS { NonnullGCPtr WeakSet::create(Realm& realm) { return realm.heap().allocate(realm, realm.intrinsics().weak_set_prototype()).release_allocated_value_but_fixme_should_propagate_errors(); } WeakSet::WeakSet(Object& prototype) : Object(ConstructWithPrototypeTag::Tag, prototype) , WeakContainer(heap()) { } void WeakSet::remove_dead_cells(Badge) { m_values.remove_all_matching([](Cell* cell) { return cell->state() != Cell::State::Live; }); } }