mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 06:47:40 +00:00
LibJS: Add magical "$gc" function that can be called to trigger GC
This will be immensely useful for testing.
This commit is contained in:
parent
1382dbc5e1
commit
15d8b9c671
1 changed files with 5 additions and 0 deletions
|
@ -46,6 +46,11 @@ Value FunctionDeclaration::execute(Interpreter& interpreter) const
|
||||||
|
|
||||||
Value CallExpression::execute(Interpreter& interpreter) const
|
Value CallExpression::execute(Interpreter& interpreter) const
|
||||||
{
|
{
|
||||||
|
if (name() == "$gc") {
|
||||||
|
interpreter.heap().collect_garbage();
|
||||||
|
return js_undefined();
|
||||||
|
}
|
||||||
|
|
||||||
auto callee = interpreter.global_object().get(name());
|
auto callee = interpreter.global_object().get(name());
|
||||||
ASSERT(callee.is_object());
|
ASSERT(callee.is_object());
|
||||||
auto* callee_object = callee.as_object();
|
auto* callee_object = callee.as_object();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue