summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Interpreter.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-04-19 17:24:56 +0200
committerAndreas Kling <kling@serenityos.org>2020-04-19 17:34:33 +0200
commitf7a1696087d3b2f03e11f07cb28ef4f6cbd9fdb0 (patch)
tree0dfdd8c0b6cfa0e8a2534da52b3f997943bd62cf /Libraries/LibJS/Interpreter.h
parentcb3cf589ed8a5df38a801bbc34a21951924e9195 (diff)
downloadserenity-f7a1696087d3b2f03e11f07cb28ef4f6cbd9fdb0.zip
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.
Diffstat (limited to 'Libraries/LibJS/Interpreter.h')
-rw-r--r--Libraries/LibJS/Interpreter.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/Libraries/LibJS/Interpreter.h b/Libraries/LibJS/Interpreter.h
index a6f54d97aa..9b32334df8 100644
--- a/Libraries/LibJS/Interpreter.h
+++ b/Libraries/LibJS/Interpreter.h
@@ -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()
{