LibJS: Make Value::as_cell() return a Cell&

This commit is contained in:
Andreas Kling 2021-05-25 18:48:11 +02:00
parent 0de954e86b
commit 47a4b2ba9f
Notes: sideshowbarker 2024-07-18 17:25:04 +09:00
3 changed files with 7 additions and 7 deletions

View file

@ -92,7 +92,7 @@ void Heap::gather_roots(HashTable<Cell*>& roots)
for (auto* list : m_marked_value_lists) {
for (auto& value : list->values()) {
if (value.is_cell())
roots.set(value.as_cell());
roots.set(&value.as_cell());
}
}

View file

@ -93,15 +93,15 @@ void VM::gather_roots(HashTable<Cell*>& roots)
roots.set(m_exception);
if (m_last_value.is_cell())
roots.set(m_last_value.as_cell());
roots.set(&m_last_value.as_cell());
for (auto& call_frame : m_call_stack) {
if (call_frame->this_value.is_cell())
roots.set(call_frame->this_value.as_cell());
roots.set(&call_frame->this_value.as_cell());
roots.set(call_frame->arguments_object);
for (auto& argument : call_frame->arguments) {
if (argument.is_cell())
roots.set(argument.as_cell());
roots.set(&argument.as_cell());
}
roots.set(call_frame->scope);
}

View file

@ -222,10 +222,10 @@ public:
return *m_value.as_symbol;
}
Cell* as_cell()
Cell& as_cell()
{
VERIFY(is_cell());
return m_value.as_cell;
return *m_value.as_cell;
}
Accessor& as_accessor()
@ -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);