summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Runtime/SymbolConstructor.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/SymbolConstructor.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/SymbolConstructor.cpp')
-rw-r--r--Libraries/LibJS/Runtime/SymbolConstructor.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Libraries/LibJS/Runtime/SymbolConstructor.cpp b/Libraries/LibJS/Runtime/SymbolConstructor.cpp
index 47ff1283b2..64de9db9ff 100644
--- a/Libraries/LibJS/Runtime/SymbolConstructor.cpp
+++ b/Libraries/LibJS/Runtime/SymbolConstructor.cpp
@@ -65,7 +65,7 @@ Value SymbolConstructor::call(Interpreter& interpreter)
Value SymbolConstructor::construct(Interpreter& interpreter, Function&)
{
- interpreter.throw_exception<TypeError>(ErrorType::NotAConstructor, "Symbol");
+ interpreter.vm().throw_exception<TypeError>(global_object(), ErrorType::NotAConstructor, "Symbol");
return {};
}
@@ -85,7 +85,7 @@ JS_DEFINE_NATIVE_FUNCTION(SymbolConstructor::key_for)
{
auto argument = interpreter.argument(0);
if (!argument.is_symbol()) {
- interpreter.throw_exception<TypeError>(ErrorType::NotASymbol, argument.to_string_without_side_effects().characters());
+ interpreter.vm().throw_exception<TypeError>(global_object, ErrorType::NotASymbol, argument.to_string_without_side_effects().characters());
return {};
}