mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-08 05:27:14 +09:00

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&.
25 lines
469 B
C++
25 lines
469 B
C++
/*
|
|
* Copyright (c) 2020, Andreas Kling <andreas@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibJS/Heap/CellImpl.h>
|
|
#include <LibJS/Heap/Handle.h>
|
|
#include <LibJS/Heap/Heap.h>
|
|
|
|
namespace JS {
|
|
|
|
HandleImpl::HandleImpl(CellImpl* cell, SourceLocation location)
|
|
: m_cell(cell)
|
|
, m_location(location)
|
|
{
|
|
m_cell->heap().did_create_handle({}, *this);
|
|
}
|
|
|
|
HandleImpl::~HandleImpl()
|
|
{
|
|
m_cell->heap().did_destroy_handle({}, *this);
|
|
}
|
|
|
|
}
|