mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 15:16:14 +00:00
LibJS: Add MarkedValueList and use it for argument passing
A MarkedValueList is basically a Vector<JS::Value> that registers with the Heap and makes sure that the stored values don't get GC'd. Before this change, we were unsafely keeping Vector<JS::Value> in some places, which is out-of-reach for the live reference finding logic since Vector puts its elements on the heap by default. We now pass all the JavaScript tests even when running with "js -g", which does a GC on every heap allocation.
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
#include <LibJS/Heap/Heap.h>
|
||||
#include <LibJS/Runtime/Exception.h>
|
||||
#include <LibJS/Runtime/LexicalEnvironment.h>
|
||||
#include <LibJS/Runtime/MarkedValueList.h>
|
||||
#include <LibJS/Runtime/Value.h>
|
||||
|
||||
namespace JS {
|
||||
@@ -100,7 +101,7 @@ public:
|
||||
void enter_scope(const ScopeNode&, ArgumentVector, ScopeType);
|
||||
void exit_scope(const ScopeNode&);
|
||||
|
||||
Value call(Function*, Value this_value = {}, const Vector<Value>& arguments = {});
|
||||
Value call(Function*, Value this_value = {}, Optional<MarkedValueList> arguments = {});
|
||||
|
||||
CallFrame& push_call_frame()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user