mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:48:12 +00:00
LibJS: Add a basic mark&sweep garbage collector :^)
Objects can now be allocated via the interpreter's heap. Objects that are allocated in this way will need to be provably reachable from at least one of the known object graph roots. The roots are currently determined by Heap::collect_roots(). Anything that wants be collectable garbage should inherit from Cell, the fundamental atom of the GC heap. This is pretty neat! :^)
This commit is contained in:
parent
6da131d5db
commit
63e4b744ed
13 changed files with 498 additions and 6 deletions
|
@ -32,8 +32,9 @@
|
|||
namespace JS {
|
||||
|
||||
Interpreter::Interpreter()
|
||||
: m_heap(*this)
|
||||
{
|
||||
m_global_object = new Object;
|
||||
m_global_object = heap().allocate<Object>();
|
||||
}
|
||||
|
||||
Interpreter::~Interpreter()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue