summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-05-25 18:39:01 +0200
committerAndreas Kling <kling@serenityos.org>2021-05-25 18:39:01 +0200
commit0de954e86b64ff3e36c737d8e19cc6957de098c9 (patch)
tree8843aae51dfe96678eb1a672cb234129ef2a031d
parent789d20ebb7b0c7089c49ca1df549bba4aac78996 (diff)
downloadserenity-0de954e86b64ff3e36c737d8e19cc6957de098c9.zip
LibJS: Make Cell::Visitor::visit_impl() take a Cell&
Passing a null cell pointer is not supported.
-rw-r--r--Userland/Libraries/LibJS/Heap/Cell.h4
-rw-r--r--Userland/Libraries/LibJS/Heap/Heap.cpp8
-rw-r--r--Userland/Libraries/LibJS/Runtime/Value.h2
3 files changed, 7 insertions, 7 deletions
diff --git a/Userland/Libraries/LibJS/Heap/Cell.h b/Userland/Libraries/LibJS/Heap/Cell.h
index 3074562fac..16d72c24de 100644
--- a/Userland/Libraries/LibJS/Heap/Cell.h
+++ b/Userland/Libraries/LibJS/Heap/Cell.h
@@ -41,12 +41,12 @@ public:
void visit(Cell* cell)
{
if (cell)
- visit_impl(cell);
+ visit_impl(*cell);
}
void visit(Value);
protected:
- virtual void visit_impl(Cell*) = 0;
+ virtual void visit_impl(Cell&) = 0;
virtual ~Visitor() = default;
};
diff --git a/Userland/Libraries/LibJS/Heap/Heap.cpp b/Userland/Libraries/LibJS/Heap/Heap.cpp
index 669d5d7b02..8d0e3be1d0 100644
--- a/Userland/Libraries/LibJS/Heap/Heap.cpp
+++ b/Userland/Libraries/LibJS/Heap/Heap.cpp
@@ -155,13 +155,13 @@ class MarkingVisitor final : public Cell::Visitor {
public:
MarkingVisitor() { }
- virtual void visit_impl(Cell* cell)
+ virtual void visit_impl(Cell& cell)
{
- if (cell->is_marked())
+ if (cell.is_marked())
return;
dbgln_if(HEAP_DEBUG, " ! {}", cell);
- cell->set_marked(true);
- cell->visit_edges(*this);
+ cell.set_marked(true);
+ cell.visit_edges(*this);
}
};
diff --git a/Userland/Libraries/LibJS/Runtime/Value.h b/Userland/Libraries/LibJS/Runtime/Value.h
index f4ca977faa..22b7b49282 100644
--- a/Userland/Libraries/LibJS/Runtime/Value.h
+++ b/Userland/Libraries/LibJS/Runtime/Value.h
@@ -330,7 +330,7 @@ inline Value js_negative_infinity()
inline void Cell::Visitor::visit(Value value)
{
if (value.is_cell())
- visit_impl(value.as_cell());
+ visit_impl(*value.as_cell());
}
Value greater_than(GlobalObject&, Value lhs, Value rhs);