Skip to content

Truly independent web browser

LibGC+LibWeb: Replace the conservative hash containers with root ones

Andreas Kling733ccc5616a5
diff --git a/Libraries/LibGC/CMakeLists.txt b/Libraries/LibGC/CMakeLists.txt
index 4f821f8e022..50329c3c646 100644
--- a/Libraries/LibGC/CMakeLists.txt
+++ b/Libraries/LibGC/CMakeLists.txt
@@ -3,8 +3,6 @@ set(SOURCES
CAPI.cpp
Cell.cpp
CellAllocator.cpp
- ConservativeHashMap.cpp
- ConservativeHashTable.cpp
ConservativeVector.cpp
CrossHeapMember.cpp
Root.cpp
diff --git a/Libraries/LibGC/Forward.h b/Libraries/LibGC/Forward.h
index 8e84d96a638..6623e81ab6b 100644
--- a/Libraries/LibGC/Forward.h
+++ b/Libraries/LibGC/Forward.h
@@ -82,12 +82,6 @@ concept IsPreciselyTracedCellPointer = IsSpecializationOf<RemoveCVReference<T>,
template<class T, size_t inline_capacity = 0>
requires(!IsPreciselyTracedCellPointer<T>) class ConservativeVector;
-template<typename K, typename V, typename KeyTraits, typename ValueTraits, bool IsOrdered>
-class ConservativeHashMap;
-
-template<typename T, typename TraitsForT, bool IsOrdered>
-class ConservativeHashTable;
-
template<class T>
class HeapVector;
diff --git a/Libraries/LibGC/Heap.cpp b/Libraries/LibGC/Heap.cpp
index c1b08a4b89f..e274c50c752 100644
--- a/Libraries/LibGC/Heap.cpp
+++ b/Libraries/LibGC/Heap.cpp
@@ -752,10 +752,6 @@ AK::JsonObject Heap::build_graph(ReadonlySpan<FlatPtr> callee_saved_registers)
String Heap::describe_root(HeapRoot const& root)
{
switch (root.type) {
- case HeapRoot::Type::ConservativeHashMap:
- return "ConservativeHashMap"_string;
- case HeapRoot::Type::ConservativeHashTable:
- return "ConservativeHashTable"_string;
case HeapRoot::Type::ConservativeVector:
return "ConservativeVector"_string;
case HeapRoot::Type::CrossHeapMember:
@@ -1493,18 +1489,6 @@ NO_SANITIZE_ADDRESS void Heap::gather_conservative_roots(ConservativeScanOrigin
}
}
- for (auto& hash_map : m_conservative_hash_maps) {
- hash_map.for_each_possible_value([&](FlatPtr possible_value) {
- add_possible_value(possible_pointers, possible_value, HeapRoot { .type = HeapRoot::Type::ConservativeHashMap }, bounds);
- });
- }
-
- for (auto& hash_table : m_conservative_hash_tables) {
- hash_table.for_each_possible_value([&](FlatPtr possible_value) {
- add_possible_value(possible_pointers, possible_value, HeapRoot { .type = HeapRoot::Type::ConservativeHashTable }, bounds);
- });
- }
-
{
ScopedPhaseTimer timer { g_recording_phase_timings, g_phase_timings.conservative_cell_lookup_us };
for_each_cell_among_possible_pointers(m_live_heap_blocks, possible_pointers, [&](Cell* cell, HashMap<FlatPtr, HeapRoot>& candidates, FlatPtr possible_pointer) {
diff --git a/Libraries/LibGC/Heap.h b/Libraries/LibGC/Heap.h
index 7ab4a178338..cc1803f1f8b 100644
--- a/Libraries/LibGC/Heap.h
+++ b/Libraries/LibGC/Heap.h
@@ -21,8 +21,6 @@
#include <LibCore/Forward.h>
#include <LibGC/Cell.h>
#include <LibGC/CellAllocator.h>
-#include <LibGC/ConservativeHashMap.h>
-#include <LibGC/ConservativeHashTable.h>
#include <LibGC/ConservativeVector.h>
#include <LibGC/CrossHeapMember.h>
#include <LibGC/Forward.h>
@@ -133,10 +131,6 @@ public:
void did_create_root_hash_table(Badge<RootHashTableBase>, RootHashTableBase&);
void did_destroy_root_hash_table(Badge<RootHashTableBase>, RootHashTableBase&);
- void did_create_conservative_hash_map(Badge<ConservativeHashMapBase>, ConservativeHashMapBase&);
- void did_destroy_conservative_hash_map(Badge<ConservativeHashMapBase>, ConservativeHashMapBase&);
- void did_create_conservative_hash_table(Badge<ConservativeHashTableBase>, ConservativeHashTableBase&);
- void did_destroy_conservative_hash_table(Badge<ConservativeHashTableBase>, ConservativeHashTableBase&);
void did_create_conservative_vector(Badge<ConservativeVectorBase>, ConservativeVectorBase&);
void did_destroy_conservative_vector(Badge<ConservativeVectorBase>, ConservativeVectorBase&);
void did_create_cross_heap_member(Badge<CrossHeapMemberBase>, CrossHeapMemberBase&);
@@ -349,8 +343,6 @@ private:
RootVectorBase::List m_root_vectors;
RootHashMapBase::List m_root_hash_maps;
RootHashTableBase::List m_root_hash_tables;
- ConservativeHashMapBase::List m_conservative_hash_maps;
- ConservativeHashTableBase::List m_conservative_hash_tables;
ConservativeVectorBase::List m_conservative_vectors;
HashTable<CrossHeapMemberBase*> m_incoming_cross_heap_members;
HeapGroup* m_group { nullptr };
@@ -448,30 +440,6 @@ inline void Heap::did_destroy_root_hash_table(Badge<RootHashTableBase>, RootHash
m_root_hash_tables.remove(hash_table);
}
-inline void Heap::did_create_conservative_hash_map(Badge<ConservativeHashMapBase>, ConservativeHashMapBase& hash_map)
-{
- VERIFY(!m_conservative_hash_maps.contains(hash_map));
- m_conservative_hash_maps.append(hash_map);
-}
-
-inline void Heap::did_destroy_conservative_hash_map(Badge<ConservativeHashMapBase>, ConservativeHashMapBase& hash_map)
-{
- VERIFY(m_conservative_hash_maps.contains(hash_map));
- m_conservative_hash_maps.remove(hash_map);
-}
-
-inline void Heap::did_create_conservative_hash_table(Badge<ConservativeHashTableBase>, ConservativeHashTableBase& hash_table)
-{
- VERIFY(!m_conservative_hash_tables.contains(hash_table));
- m_conservative_hash_tables.append(hash_table);
-}
-
-inline void Heap::did_destroy_conservative_hash_table(Badge<ConservativeHashTableBase>, ConservativeHashTableBase& hash_table)
-{
- VERIFY(m_conservative_hash_tables.contains(hash_table));
- m_conservative_hash_tables.remove(hash_table);
-}
-
inline void Heap::did_create_conservative_vector(Badge<ConservativeVectorBase>, ConservativeVectorBase& vector)
{
VERIFY(!m_conservative_vectors.contains(vector));
diff --git a/Libraries/LibGC/HeapRoot.h b/Libraries/LibGC/HeapRoot.h
index 8b13d191e3b..68d5f5f05c8 100644
--- a/Libraries/LibGC/HeapRoot.h
+++ b/Libraries/LibGC/HeapRoot.h
@@ -14,8 +14,6 @@ namespace GC {
struct GC_API HeapRoot {
enum class Type {
- ConservativeHashMap,
- ConservativeHashTable,
ConservativeVector,
CrossHeapMember,
AKFunctionCapturedPointer,
diff --git a/Libraries/LibWeb/Animations/AnimationEffect.h b/Libraries/LibWeb/Animations/AnimationEffect.h
index d8c769076f2..0aad86ea856 100644
--- a/Libraries/LibWeb/Animations/AnimationEffect.h
+++ b/Libraries/LibWeb/Animations/AnimationEffect.h
@@ -10,7 +10,7 @@
#include <AK/Optional.h>
#include <AK/Utf16String.h>
#include <AK/Variant.h>
-#include <LibGC/ConservativeHashMap.h>
+#include <LibGC/RootHashMap.h>
#include <LibGC/RootVector.h>
#include <LibWeb/Animations/TimeValue.h>
#include <LibWeb/Bindings/AnimationEffect.h>
@@ -63,7 +63,7 @@ struct AnimationUpdateContext {
void publish();
// NOTE: This is lazily populated by KeyframeEffects as their respective animations are applied to an element.
- GC::ConservativeHashMap<DOM::AbstractElement, ElementData> elements;
+ GC::RootHashMap<DOM::AbstractElement, ElementData> elements;
};
// https://www.w3.org/TR/web-animations-1/#the-animationeffect-interface
diff --git a/Libraries/LibWeb/DOM/AbstractElement.cpp b/Libraries/LibWeb/DOM/AbstractElement.cpp
index 93571818d7f..a825a0c0479 100644
--- a/Libraries/LibWeb/DOM/AbstractElement.cpp
+++ b/Libraries/LibWeb/DOM/AbstractElement.cpp
@@ -35,6 +35,11 @@ void AbstractElement::visit(GC::Cell::Visitor& visitor) const
visitor.visit(m_element);
}
+void AbstractElement::visit_edges(GC::Cell::Visitor& visitor) const
+{
+ visitor.visit(m_element);
+}
+
Document& AbstractElement::document() const
{
return m_element->document();
diff --git a/Libraries/LibWeb/DOM/AbstractElement.h b/Libraries/LibWeb/DOM/AbstractElement.h
index 8d7b86876e1..55deae3891d 100644
--- a/Libraries/LibWeb/DOM/AbstractElement.h
+++ b/Libraries/LibWeb/DOM/AbstractElement.h
@@ -89,6 +89,8 @@ public:
CSS::StyleScope const& style_scope() const;
+ void visit_edges(GC::Cell::Visitor&) const;
+
private:
GC::Ref<Element> m_element;
Optional<CSS::PseudoElement> m_pseudo_element;
diff --git a/Libraries/LibWeb/DOM/Document.cpp b/Libraries/LibWeb/DOM/Document.cpp
index 9ecf5bfed1e..864c43c4524 100644
--- a/Libraries/LibWeb/DOM/Document.cpp
+++ b/Libraries/LibWeb/DOM/Document.cpp
@@ -9282,12 +9282,22 @@ void Document::update_compositor_animations(Layout::BegunRead const& read)
GC::Ptr<Animations::KeyframeEffect> winner;
bool all_effects_use_replace { true };
u32 effect_count { 0 };
+
+ void visit_edges(GC::Cell::Visitor& visitor) { visitor.visit(winner); }
};
struct CompetingEffects {
CompetingPropertyEffects opacity;
CompetingPropertyEffects background_color;
CompetingPropertyEffects filter;
CompetingPropertyEffects transform;
+
+ void visit_edges(GC::Cell::Visitor& visitor)
+ {
+ opacity.visit_edges(visitor);
+ background_color.visit_edges(visitor);
+ filter.visit_edges(visitor);
+ transform.visit_edges(visitor);
+ }
};
Optional<Compositing::AccumulatedVisualContextTree> visual_context_tree = paint_state().visual_context_tree(*this);
@@ -9298,7 +9308,7 @@ void Document::update_compositor_animations(Layout::BegunRead const& read)
GC::RootHashTable<GC::Ref<Animations::KeyframeEffect>> previously_compositor_replaced_effects;
GC::RootHashTable<GC::Ref<Animations::KeyframeEffect>> previously_published_effects;
GC::RootHashTable<GC::Ref<Animations::KeyframeEffect>> previously_offscreen_throttled_effects;
- GC::ConservativeHashMap<DOM::AbstractElement, CompetingEffects> competing_effects;
+ GC::RootHashMap<DOM::AbstractElement, CompetingEffects> competing_effects;
CompositorAnimationKeyframesByEffect keyframes_by_effect;
GC::RootHashMap<GC::Ptr<Animations::KeyframeEffect>, bool> only_translates_horizontally_cache;
GC::RootHashMap<GC::Ptr<Animations::KeyframeEffect>, bool> animated_transform_preserves_axes_cache;
diff --git a/Libraries/LibWeb/FileAPI/BlobURLStore.cpp b/Libraries/LibWeb/FileAPI/BlobURLStore.cpp
index ae07f8119a2..ea8321d3814 100644
--- a/Libraries/LibWeb/FileAPI/BlobURLStore.cpp
+++ b/Libraries/LibWeb/FileAPI/BlobURLStore.cpp
@@ -7,7 +7,7 @@
*/
#include <AK/Utf16StringBuilder.h>
-#include <LibGC/ConservativeHashMap.h>
+#include <LibGC/RootHashMap.h>
#include <LibURL/Origin.h>
#include <LibURL/URL.h>
#include <LibWeb/Bindings/PrincipalHostDefined.h>
@@ -17,20 +17,27 @@
#include <LibWeb/FileAPI/BlobURLStore.h>
#include <LibWeb/HTML/Scripting/Environments.h>
#include <LibWeb/Infra/SerializedURL.h>
+#include <LibWeb/MediaSourceExtensions/MediaSource.h>
#include <LibWeb/Page/Page.h>
#include <LibWeb/StorageAPI/StorageKey.h>
namespace Web::FileAPI {
+void BlobURLEntry::visit_edges(GC::Cell::Visitor& visitor) const
+{
+ visitor.visit(object);
+ visitor.visit(environment);
+}
+
// https://w3c.github.io/FileAPI/#BlobURLStore
// NB: Only the entries this agent created, in its own heap. The browser process keeps every agent's entries, and is
// asked for them by blob_url_entry_in_the_user_agent_store().
-static thread_local GC::ConservativeHashMap<Utf16String, BlobURLEntry>* s_blob_url_store;
+static thread_local GC::RootHashMap<Utf16String, BlobURLEntry>* s_blob_url_store;
-static GC::ConservativeHashMap<Utf16String, BlobURLEntry>& blob_url_store()
+static GC::RootHashMap<Utf16String, BlobURLEntry>& blob_url_store()
{
if (!s_blob_url_store)
- s_blob_url_store = new GC::ConservativeHashMap<Utf16String, BlobURLEntry>;
+ s_blob_url_store = new GC::RootHashMap<Utf16String, BlobURLEntry>;
return *s_blob_url_store;
}
diff --git a/Libraries/LibWeb/FileAPI/BlobURLStore.h b/Libraries/LibWeb/FileAPI/BlobURLStore.h
index 2715c828c40..7a75a66d1bc 100644
--- a/Libraries/LibWeb/FileAPI/BlobURLStore.h
+++ b/Libraries/LibWeb/FileAPI/BlobURLStore.h
@@ -7,6 +7,7 @@
#pragma once
#include <AK/Utf16String.h>
+#include <LibGC/Cell.h>
#include <LibGC/Ptr.h>
#include <LibURL/URL.h>
#include <LibWeb/Forward.h>
@@ -25,6 +26,8 @@ struct BlobURLEntry {
// The token the user agent's blob URL store gave this entry.
URL::BlobURLEntry::Token token { 0 };
+
+ void visit_edges(GC::Cell::Visitor&) const;
};
Utf16String generate_new_blob_url();
diff --git a/Libraries/LibWeb/HTML/HTMLSlotElement.cpp b/Libraries/LibWeb/HTML/HTMLSlotElement.cpp
index c845e0fee15..64b1930fe0f 100644
--- a/Libraries/LibWeb/HTML/HTMLSlotElement.cpp
+++ b/Libraries/LibWeb/HTML/HTMLSlotElement.cpp
@@ -6,7 +6,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include <LibGC/ConservativeHashTable.h>
+#include <LibGC/RootHashTable.h>
#include <LibGC/RootVector.h>
#include <LibWeb/Bindings/HTMLSlotElement.h>
#include <LibWeb/DOM/Document.h>
@@ -130,8 +130,8 @@ void HTMLSlotElement::assign(GC::ConservativeVector<SlottableHandle> nodes)
}
// 2. Let nodesSet be a new ordered set.
- GC::ConservativeVector<DOM::Slottable> nodes_set;
- GC::ConservativeHashTable<GC::Ref<DOM::Node const>> nodes_in_nodes_set;
+ GC::RootVector<DOM::Slottable> nodes_set;
+ GC::RootHashTable<GC::Ref<DOM::Node const>> nodes_in_nodes_set;
// INTEROP: The spec only assigns slottables for this's root below, so a slot in another tree that loses a node
// to this slot keeps it as an assigned node and fires no slotchange event. Browsers also assign
diff --git a/Libraries/LibWeb/Page/EventHandler.cpp b/Libraries/LibWeb/Page/EventHandler.cpp
index 536b4221643..9f700e10e98 100644
--- a/Libraries/LibWeb/Page/EventHandler.cpp
+++ b/Libraries/LibWeb/Page/EventHandler.cpp
@@ -12,7 +12,6 @@
#include <AK/Debug.h>
#include <AK/Math.h>
#include <LibCompositing/DisplayList/DisplayListResourceStorage.h>
-#include <LibGC/ConservativeHashTable.h>
#include <LibGC/Heap.h>
#include <LibGC/RootHashTable.h>
#include <LibGC/RootVector.h>
@@ -4861,7 +4860,7 @@ void EventHandler::update_pointer_hover(Layout::BegunRead const& read, PointerSt
pointer.hovered_node = target;
// INTEROP: Traverse the flat tree like Blink and Gecko do for mouse boundary events.
- GC::ConservativeHashTable<DOM::Node*> previous_ancestors;
+ GC::RootHashTable<DOM::Node*> previous_ancestors;
for (auto* node = previous.ptr(); node; node = node->flat_tree_parent())
previous_ancestors.set(node);
DOM::Node* common_ancestor = nullptr;
diff --git a/Libraries/LibWeb/PaintTiming/DocumentPaintTimingState.h b/Libraries/LibWeb/PaintTiming/DocumentPaintTimingState.h
index 20cfc2e051c..5265c6f9fb6 100644
--- a/Libraries/LibWeb/PaintTiming/DocumentPaintTimingState.h
+++ b/Libraries/LibWeb/PaintTiming/DocumentPaintTimingState.h
@@ -10,8 +10,8 @@
#include <AK/Optional.h>
#include <AK/Utf16String.h>
#include <AK/Vector.h>
-#include <LibGC/ConservativeHashMap.h>
#include <LibGC/Ptr.h>
+#include <LibGC/RootHashMap.h>
#include <LibGC/RootVector.h>
#include <LibGC/Weak.h>
#include <LibWeb/Forward.h>
@@ -66,7 +66,7 @@ struct LargestContentfulPaintCandidate {
// NB: The elements that get a text node in their set of owned text nodes for the first time as a frame is painted,
// with those text nodes.
-using PaintedTextNodes = GC::OrderedConservativeHashMap<GC::Ref<DOM::Element>, GC::RootVector<GC::Ref<DOM::Text>>>;
+using PaintedTextNodes = GC::OrderedRootHashMap<GC::Ref<DOM::Element>, GC::RootVector<GC::Ref<DOM::Text>>>;
struct DocumentPaintTimingState {
// https://w3c.github.io/paint-timing/#set-of-previously-reported-paints
diff --git a/Libraries/LibWeb/UIEvents/TouchEvent.cpp b/Libraries/LibWeb/UIEvents/TouchEvent.cpp
index 334ccd45de0..721c0bf03f2 100644
--- a/Libraries/LibWeb/UIEvents/TouchEvent.cpp
+++ b/Libraries/LibWeb/UIEvents/TouchEvent.cpp
@@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include <LibGC/ConservativeHashMap.h>
#include <LibGC/Heap.h>
+#include <LibGC/RootHashMap.h>
#include <LibGC/RootVector.h>
#include <LibWeb/UIEvents/TouchEvent.h>
@@ -52,7 +52,7 @@ void TouchEvent::retarget_touch_lists()
if (targets == m_last_touch_targets)
return;
m_last_touch_targets = targets;
- GC::ConservativeHashMap<Touch*, GC::Ref<Touch>> clones;
+ GC::RootHashMap<Touch*, GC::Ref<Touch>> clones;
GC::RootVector<GC::Ref<Touch>> cloned_touches;
size_t offset = 0;
auto retarget = [&](GC::Ref<TouchList> original) {
diff --git a/Meta/ClangPlugins/LibJSGCPluginAction.cpp b/Meta/ClangPlugins/LibJSGCPluginAction.cpp
index 493611e5fb0..81523377557 100644
--- a/Meta/ClangPlugins/LibJSGCPluginAction.cpp
+++ b/Meta/ClangPlugins/LibJSGCPluginAction.cpp
@@ -145,10 +145,8 @@ static ContainsGCPtrResult record_contains_gc_ptr(clang::CXXRecordDecl const* re
"GC::Heap",
"GC::MarkedVector",
"GC::ConservativeVector",
- "GC::ConservativeHashMap",
- "GC::ConservativeHashMapBase",
- "GC::ConservativeHashTable",
- "GC::ConservativeHashTableBase",
+ "GC::RootHashMap",
+ "GC::RootHashMapBase",
};
if (gc_infrastructure_types.contains(qualified_name)) {
s_contains_gc_ptr_cache[record] = ContainsGCPtrResult::No;
@@ -215,7 +213,7 @@ static ContainsGCPtrResult type_contains_gc_ptr(clang::QualType const& type, std
return ContainsGCPtrResult::No;
// Root types handle their own visiting
- if (template_name == "GC::Root" || template_name == "GC::RootVector" || template_name == "GC::ConservativeHashMap" || template_name == "GC::ConservativeHashTable" || template_name == "GC::RootHashTable")
+ if (template_name == "GC::Root" || template_name == "GC::RootVector" || template_name == "GC::RootHashMap" || template_name == "GC::RootHashTable")
return ContainsGCPtrResult::No;
// Check template arguments recursively for containers
@@ -255,8 +253,7 @@ static std::vector<clang::QualType> get_all_qualified_types(clang::QualType cons
"GC::RawPtr",
"GC::RawRef",
"GC::RootVector",
- "GC::ConservativeHashMap",
- "GC::ConservativeHashTable",
+ "GC::RootHashMap",
"GC::RootHashTable",
"GC::Root",
};
@@ -1110,8 +1107,6 @@ static bool is_type_that_does_not_store_gc_pointers_by_value(std::string const&
"AK::RefPtr",
"AK::Span",
"AK::WeakPtr",
- "GC::ConservativeHashMap",
- "GC::ConservativeHashTable",
"GC::ConservativeVector",
"GC::RawPtr",
"GC::RawRef",
@@ -1477,8 +1472,6 @@ static bool is_container_with_heap_storage(std::string const& template_name)
static bool is_container_scanned_by_gc(std::string const& template_name)
{
static std::unordered_set<std::string> const template_names {
- "GC::ConservativeHashMap",
- "GC::ConservativeHashTable",
"GC::ConservativeVector",
"GC::RootHashMap",
"GC::RootHashTable",
diff --git a/Tests/LibGC/TestGCContainers.cpp b/Tests/LibGC/TestGCContainers.cpp
index fc5ae7842bf..d5d73560734 100644
--- a/Tests/LibGC/TestGCContainers.cpp
+++ b/Tests/LibGC/TestGCContainers.cpp
@@ -7,8 +7,6 @@
#include <AK/NeverDestroyed.h>
#include <LibGC/Cell.h>
#include <LibGC/CellAllocator.h>
-#include <LibGC/ConservativeHashMap.h>
-#include <LibGC/ConservativeHashTable.h>
#include <LibGC/ConservativeVector.h>
#include <LibGC/Heap.h>
#include <LibGC/HeapHashTable.h>
@@ -118,28 +116,6 @@ static bool possible_values_contain(GC::ConservativeVectorBase const& container,
return false;
}
-static bool possible_values_contain(GC::ConservativeHashMapBase const& container, GC::Cell* cell)
-{
- bool found = false;
- auto target = bit_cast<FlatPtr>(cell);
- container.for_each_possible_value([&](FlatPtr value) {
- if (value == target)
- found = true;
- });
- return found;
-}
-
-static bool possible_values_contain(GC::ConservativeHashTableBase const& container, GC::Cell* cell)
-{
- bool found = false;
- auto target = bit_cast<FlatPtr>(cell);
- container.for_each_possible_value([&](FlatPtr value) {
- if (value == target)
- found = true;
- });
- return found;
-}
-
TEST_CASE(root_vector_reports_roots)
{
auto& heap = test_heap();
@@ -551,64 +527,6 @@ TEST_CASE(empty_containers_report_no_roots)
EXPECT_EQ(roots.size(), 0u);
}
-TEST_CASE(conservative_hash_map_reports_possible_values)
-{
- auto& heap = test_heap();
- GC::ConservativeHashMap<int, GC::Ref<TestCell>> map;
-
- auto cell = heap.allocate<TestCell>();
- map.set(42, cell);
-
- EXPECT(possible_values_contain(map, cell.ptr()));
-}
-
-TEST_CASE(cleared_conservative_hash_map_reports_no_stale_values)
-{
- auto& heap = test_heap();
- GC::ConservativeHashMap<int, GC::Ref<TestCell>> map;
-
- auto cell = heap.allocate<TestCell>();
- map.set(42, cell);
- map.clear();
-
- EXPECT(!possible_values_contain(map, cell.ptr()));
-}
-
-TEST_CASE(removed_conservative_hash_map_entry_not_reported)
-{
- auto& heap = test_heap();
- GC::ConservativeHashMap<int, GC::Ref<TestCell>> map;
-
- auto cell = heap.allocate<TestCell>();
- map.set(42, cell);
- map.remove(42);
-
- EXPECT(!possible_values_contain(map, cell.ptr()));
-}
-
-TEST_CASE(conservative_hash_map_key_reports_possible_values)
-{
- auto& heap = test_heap();
- GC::ConservativeHashMap<GC::Ref<TestCell>, int> map;
-
- auto cell = heap.allocate<TestCell>();
- map.set(cell, 42);
-
- EXPECT(possible_values_contain(map, cell.ptr()));
-}
-
-TEST_CASE(removed_conservative_hash_map_key_not_reported)
-{
- auto& heap = test_heap();
- GC::ConservativeHashMap<GC::Ref<TestCell>, int> map;
-
- auto cell = heap.allocate<TestCell>();
- map.set(cell, 42);
- map.remove(cell);
-
- EXPECT(!possible_values_contain(map, cell.ptr()));
-}
-
TEST_CASE(weak_hash_map_non_cell_key_cell_value)
{
auto& heap = test_heap();
@@ -760,41 +678,6 @@ TEST_CASE(weak_hash_map_ensure_handles_non_cell_value)
EXPECT_EQ(map.get(*default_key).value(), 13);
}
-TEST_CASE(conservative_hash_table_reports_possible_values)
-{
- auto& heap = test_heap();
- GC::ConservativeHashTable<GC::Ref<TestCell>> table;
-
- auto cell = heap.allocate<TestCell>();
- table.set(cell);
-
- EXPECT(possible_values_contain(table, cell.ptr()));
-}
-
-TEST_CASE(cleared_conservative_hash_table_reports_no_stale_values)
-{
- auto& heap = test_heap();
- GC::ConservativeHashTable<GC::Ref<TestCell>> table;
-
- auto cell = heap.allocate<TestCell>();
- table.set(cell);
- table.clear();
-
- EXPECT(!possible_values_contain(table, cell.ptr()));
-}
-
-TEST_CASE(removed_conservative_hash_table_entry_not_reported)
-{
- auto& heap = test_heap();
- GC::ConservativeHashTable<GC::Ref<TestCell>> table;
-
- auto cell = heap.allocate<TestCell>();
- table.set(cell);
- table.remove(cell);
-
- EXPECT(!possible_values_contain(table, cell.ptr()));
-}
-
TEST_CASE(weak_pointers_to_dead_cells_are_null_while_finalizing)
{
auto& heap = test_heap();