mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 03:09:08 +00:00
LibJS: Don't directly teach the heap about the javascript VM or Realm
Instead, smuggle it in as a `void*` private data and let Javascript aware code cast out that pointer to a VM&. In order to make this split, rename JS::Cell to JS::CellImpl. Once we have a LibGC, this will become GC::Cell. CellImpl then has no specific knowledge of the VM& and Realm&. That knowledge is instead put into JS::Cell, which inherits from CellImpl. JS::Cell is responsible for JavaScript's realm initialization, as well as converting of the void* private data to what it knows should be the VM&.
This commit is contained in:
committed by
Andreas Kling
parent
ae6d105f41
commit
c2988a7dd5
@@ -5,19 +5,11 @@
|
||||
*/
|
||||
|
||||
#include <LibJS/Heap/Cell.h>
|
||||
#include <LibJS/Heap/Heap.h>
|
||||
#include <LibJS/Heap/NanBoxedValue.h>
|
||||
|
||||
namespace JS {
|
||||
|
||||
void JS::Cell::initialize(JS::Realm&)
|
||||
void Cell::initialize(Realm&)
|
||||
{
|
||||
}
|
||||
|
||||
void JS::Cell::Visitor::visit(NanBoxedValue const& value)
|
||||
{
|
||||
if (value.is_cell())
|
||||
visit_impl(value.as_cell());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user