#include #include #include #include #include #include #include #include namespace JS { GlobalObject::GlobalObject(Heap& heap) { put("print", heap.allocate([](Interpreter&, Vector arguments) -> Value { for (auto& argument : arguments) printf("%s ", argument.to_string().characters()); return js_undefined(); })); put("gc", heap.allocate([](Interpreter& interpreter, Vector) -> Value { dbg() << "Forced garbage collection requested!"; interpreter.heap().collect_garbage(); return js_undefined(); })); } GlobalObject::~GlobalObject() { } }