summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Runtime/ProxyConstructor.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-09-27 15:18:55 +0200
committerAndreas Kling <kling@serenityos.org>2020-09-27 20:26:58 +0200
commit6861c619c6768ae47b546ff27ff5c48bcdc62e15 (patch)
tree54dea8a80fc66bf15c481f69b8e1c0c600bcd115 /Libraries/LibJS/Runtime/ProxyConstructor.cpp
parent838d9fa251ed34289cb9c77eb46f889dc9e79416 (diff)
downloadserenity-6861c619c6768ae47b546ff27ff5c48bcdc62e15.zip
LibJS: Move most of Interpreter into VM
This patch moves the exception state, call stack and scope stack from Interpreter to VM. I'm doing this to help myself discover what the split between Interpreter and VM should be, by shuffling things around and seeing what falls where. With these changes, we no longer have a persistent lexical environment for the current global object on the Interpreter's call stack. Instead, we push/pop that environment on Interpreter::run() enter/exit. Since it should only be used to find the global "this", and not for variable storage (that goes directly into the global object instead!), I had to insert some short-circuiting when walking the environment parent chain during variable lookup. Note that this is a "stepping stone" commit, not a final design.
Diffstat (limited to 'Libraries/LibJS/Runtime/ProxyConstructor.cpp')
-rw-r--r--Libraries/LibJS/Runtime/ProxyConstructor.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/Libraries/LibJS/Runtime/ProxyConstructor.cpp b/Libraries/LibJS/Runtime/ProxyConstructor.cpp
index c5b76307d5..d1c35803ce 100644
--- a/Libraries/LibJS/Runtime/ProxyConstructor.cpp
+++ b/Libraries/LibJS/Runtime/ProxyConstructor.cpp
@@ -51,14 +51,14 @@ ProxyConstructor::~ProxyConstructor()
Value ProxyConstructor::call(Interpreter& interpreter)
{
- interpreter.throw_exception<TypeError>(ErrorType::ProxyCallWithNew);
+ interpreter.vm().throw_exception<TypeError>(global_object(), ErrorType::ProxyCallWithNew);
return {};
}
Value ProxyConstructor::construct(Interpreter& interpreter, Function&)
{
if (interpreter.argument_count() < 2) {
- interpreter.throw_exception<TypeError>(ErrorType::ProxyTwoArguments);
+ interpreter.vm().throw_exception<TypeError>(global_object(), ErrorType::ProxyTwoArguments);
return {};
}
@@ -66,11 +66,11 @@ Value ProxyConstructor::construct(Interpreter& interpreter, Function&)
auto handler = interpreter.argument(1);
if (!target.is_object()) {
- interpreter.throw_exception<TypeError>(ErrorType::ProxyConstructorBadType, "target", target.to_string_without_side_effects().characters());
+ interpreter.vm().throw_exception<TypeError>(global_object(), ErrorType::ProxyConstructorBadType, "target", target.to_string_without_side_effects().characters());
return {};
}
if (!handler.is_object()) {
- interpreter.throw_exception<TypeError>(ErrorType::ProxyConstructorBadType, "handler", handler.to_string_without_side_effects().characters());
+ interpreter.vm().throw_exception<TypeError>(global_object(), ErrorType::ProxyConstructorBadType, "handler", handler.to_string_without_side_effects().characters());
return {};
}
return ProxyObject::create(global_object(), target.as_object(), handler.as_object());