diff --git a/Libraries/LibJS/Runtime/ArrayConstructor.cpp b/Libraries/LibJS/Runtime/ArrayConstructor.cpp index e9f10781cfb137f1dc1aecc81f5b1746518d40bf..ea399ece8104ab8f3bd14c31741b166a57588877 100644 --- a/Libraries/LibJS/Runtime/ArrayConstructor.cpp +++ b/Libraries/LibJS/Runtime/ArrayConstructor.cpp @@ -81,7 +81,7 @@ Value ArrayConstructor::call() return array; } -Value ArrayConstructor::construct(Interpreter&, Function&) +Value ArrayConstructor::construct(Function&) { return call(); } diff --git a/Libraries/LibJS/Runtime/ArrayConstructor.h b/Libraries/LibJS/Runtime/ArrayConstructor.h index b238226a7375fe6834782ee9a3c5e5cf272c2d13..5c85dfc04b47174a62e0628887326cc3bf9da498 100644 --- a/Libraries/LibJS/Runtime/ArrayConstructor.h +++ b/Libraries/LibJS/Runtime/ArrayConstructor.h @@ -39,7 +39,7 @@ public: virtual ~ArrayConstructor() override; virtual Value call() override; - virtual Value construct(Interpreter&, Function& new_target) override; + virtual Value construct(Function& new_target) override; private: virtual bool has_constructor() const override { return true; } diff --git a/Libraries/LibJS/Runtime/BigIntConstructor.cpp b/Libraries/LibJS/Runtime/BigIntConstructor.cpp index e358d9e77515788b5e714029e2dbe49305b9543a..85ad748da2f645d90311c00e2e7cb1c008b88139 100644 --- a/Libraries/LibJS/Runtime/BigIntConstructor.cpp +++ b/Libraries/LibJS/Runtime/BigIntConstructor.cpp @@ -72,9 +72,9 @@ Value BigIntConstructor::call() return bigint; } -Value BigIntConstructor::construct(Interpreter& interpreter, Function&) +Value BigIntConstructor::construct(Function&) { - interpreter.vm().throw_exception(global_object(), ErrorType::NotAConstructor, "BigInt"); + vm().throw_exception(global_object(), ErrorType::NotAConstructor, "BigInt"); return {}; } diff --git a/Libraries/LibJS/Runtime/BigIntConstructor.h b/Libraries/LibJS/Runtime/BigIntConstructor.h index 4eeceec8fe2714954d2a6f8badadbbd53ca566a2..5a4fc6bef7084a7b834b0d9839b17b3573650cd6 100644 --- a/Libraries/LibJS/Runtime/BigIntConstructor.h +++ b/Libraries/LibJS/Runtime/BigIntConstructor.h @@ -39,7 +39,7 @@ public: virtual ~BigIntConstructor() override; virtual Value call() override; - virtual Value construct(Interpreter&, Function& new_target) override; + virtual Value construct(Function& new_target) override; private: virtual bool has_constructor() const override { return true; } diff --git a/Libraries/LibJS/Runtime/BooleanConstructor.cpp b/Libraries/LibJS/Runtime/BooleanConstructor.cpp index 4c446471798b98d5c24ba8bb64ba449228e69196..db88f1cb3e64932421e9a99a140c163b4bdfb398 100644 --- a/Libraries/LibJS/Runtime/BooleanConstructor.cpp +++ b/Libraries/LibJS/Runtime/BooleanConstructor.cpp @@ -54,9 +54,9 @@ Value BooleanConstructor::call() return Value(vm().argument(0).to_boolean()); } -Value BooleanConstructor::construct(Interpreter& interpreter, Function&) +Value BooleanConstructor::construct(Function&) { - return BooleanObject::create(global_object(), interpreter.argument(0).to_boolean()); + return BooleanObject::create(global_object(), vm().argument(0).to_boolean()); } } diff --git a/Libraries/LibJS/Runtime/BooleanConstructor.h b/Libraries/LibJS/Runtime/BooleanConstructor.h index c5a438b1df345cccd123f6042ac6da4742d669b7..1c68814b21217d33b9620debfbcbe86f3621328a 100644 --- a/Libraries/LibJS/Runtime/BooleanConstructor.h +++ b/Libraries/LibJS/Runtime/BooleanConstructor.h @@ -39,7 +39,7 @@ public: virtual ~BooleanConstructor() override; virtual Value call() override; - virtual Value construct(Interpreter&, Function& new_target) override; + virtual Value construct(Function& new_target) override; private: virtual bool has_constructor() const override { return true; } diff --git a/Libraries/LibJS/Runtime/BoundFunction.cpp b/Libraries/LibJS/Runtime/BoundFunction.cpp index 44e6b840b3ad8e1080015b27764a1e3614d5eeec..f249cd6335d02e06d5015f1f74b3b2d6254851fa 100644 --- a/Libraries/LibJS/Runtime/BoundFunction.cpp +++ b/Libraries/LibJS/Runtime/BoundFunction.cpp @@ -54,14 +54,14 @@ Value BoundFunction::call() return m_target_function->call(); } -Value BoundFunction::construct(Interpreter& interpreter, Function& new_target) +Value BoundFunction::construct(Function& new_target) { if (auto this_value = vm().this_value(global_object()); m_constructor_prototype && this_value.is_object()) { this_value.as_object().set_prototype(m_constructor_prototype); - if (interpreter.exception()) + if (vm().exception()) return {}; } - return m_target_function->construct(interpreter, new_target); + return m_target_function->construct(new_target); } LexicalEnvironment* BoundFunction::create_environment() diff --git a/Libraries/LibJS/Runtime/BoundFunction.h b/Libraries/LibJS/Runtime/BoundFunction.h index c889a63a82a1045b9d3a6559b4d450446d876d72..f86f58e93e6554739e53627fa4f507a82ce92d09 100644 --- a/Libraries/LibJS/Runtime/BoundFunction.h +++ b/Libraries/LibJS/Runtime/BoundFunction.h @@ -40,7 +40,7 @@ public: virtual Value call() override; - virtual Value construct(Interpreter&, Function& new_target) override; + virtual Value construct(Function& new_target) override; virtual LexicalEnvironment* create_environment() override; diff --git a/Libraries/LibJS/Runtime/DateConstructor.cpp b/Libraries/LibJS/Runtime/DateConstructor.cpp index 83765da1ace6c4d00b16e85450099f5b85688e1b..32b8be3033749945b45e6ae86d7cc97551b891e5 100644 --- a/Libraries/LibJS/Runtime/DateConstructor.cpp +++ b/Libraries/LibJS/Runtime/DateConstructor.cpp @@ -159,13 +159,13 @@ DateConstructor::~DateConstructor() Value DateConstructor::call() { - auto date = construct(interpreter(), *this); + auto date = construct(*this); if (!date.is_object()) return {}; return js_string(heap(), static_cast(date.as_object()).string()); } -Value DateConstructor::construct(Interpreter&, Function&) +Value DateConstructor::construct(Function&) { if (vm().argument_count() == 0) { struct timeval tv; diff --git a/Libraries/LibJS/Runtime/DateConstructor.h b/Libraries/LibJS/Runtime/DateConstructor.h index 1885057e885c809dccf2da87421ffc91c36a8958..cc16ee8e4a756c446138cf944a9de6841f33e835 100644 --- a/Libraries/LibJS/Runtime/DateConstructor.h +++ b/Libraries/LibJS/Runtime/DateConstructor.h @@ -39,7 +39,7 @@ public: virtual ~DateConstructor() override; virtual Value call() override; - virtual Value construct(Interpreter&, Function& new_target) override; + virtual Value construct(Function& new_target) override; private: virtual bool has_constructor() const override { return true; } diff --git a/Libraries/LibJS/Runtime/ErrorConstructor.cpp b/Libraries/LibJS/Runtime/ErrorConstructor.cpp index 939e1294e996da1237791717e623a90c3b18a068..3e6b87316cf61ed9a7fd916e2a057092a6c42790 100644 --- a/Libraries/LibJS/Runtime/ErrorConstructor.cpp +++ b/Libraries/LibJS/Runtime/ErrorConstructor.cpp @@ -49,15 +49,16 @@ ErrorConstructor::~ErrorConstructor() Value ErrorConstructor::call() { - return construct(interpreter(), *this); + return construct(*this); } -Value ErrorConstructor::construct(Interpreter& interpreter, Function&) +Value ErrorConstructor::construct(Function&) { + auto& vm = this->vm(); String message = ""; - if (!interpreter.call_frame().arguments.is_empty() && !interpreter.call_frame().arguments[0].is_undefined()) { - message = interpreter.call_frame().arguments[0].to_string(global_object()); - if (interpreter.exception()) + if (!vm.call_frame().arguments.is_empty() && !vm.call_frame().arguments[0].is_undefined()) { + message = vm.call_frame().arguments[0].to_string(global_object()); + if (vm.exception()) return {}; } return Error::create(global_object(), "Error", message); @@ -77,9 +78,9 @@ Value ErrorConstructor::construct(Interpreter& interpreter, Function&) ConstructorName::~ConstructorName() { } \ Value ConstructorName::call() \ { \ - return construct(interpreter(), *this); \ + return construct(*this); \ } \ - Value ConstructorName::construct(Interpreter&, Function&) \ + Value ConstructorName::construct(Function&) \ { \ String message = ""; \ if (!vm().call_frame().arguments.is_empty() && !vm().call_frame().arguments[0].is_undefined()) { \ diff --git a/Libraries/LibJS/Runtime/ErrorConstructor.h b/Libraries/LibJS/Runtime/ErrorConstructor.h index 40a413a63a953914327357b885ff931ce8c7a8fb..5f7d69830e933d8d172871c67ed9e242538864b4 100644 --- a/Libraries/LibJS/Runtime/ErrorConstructor.h +++ b/Libraries/LibJS/Runtime/ErrorConstructor.h @@ -40,7 +40,7 @@ public: virtual ~ErrorConstructor() override; virtual Value call() override; - virtual Value construct(Interpreter&, Function& new_target) override; + virtual Value construct(Function& new_target) override; private: virtual bool has_constructor() const override { return true; } @@ -55,7 +55,7 @@ private: virtual void initialize(GlobalObject&) override; \ virtual ~ConstructorName() override; \ virtual Value call() override; \ - virtual Value construct(Interpreter&, Function& new_target) override; \ + virtual Value construct(Function& new_target) override; \ \ private: \ virtual bool has_constructor() const override { return true; } \ diff --git a/Libraries/LibJS/Runtime/Function.h b/Libraries/LibJS/Runtime/Function.h index 8e0f9591a6adc96023761c42a93c70bc0c4a5e34..6c5832fc3fd0550d9278d8c8dbbe490d70ee5cbd 100644 --- a/Libraries/LibJS/Runtime/Function.h +++ b/Libraries/LibJS/Runtime/Function.h @@ -44,7 +44,7 @@ public: virtual void initialize(GlobalObject&) override { } virtual Value call() = 0; - virtual Value construct(Interpreter&, Function& new_target) = 0; + virtual Value construct(Function& new_target) = 0; virtual const FlyString& name() const = 0; virtual LexicalEnvironment* create_environment() = 0; diff --git a/Libraries/LibJS/Runtime/FunctionConstructor.cpp b/Libraries/LibJS/Runtime/FunctionConstructor.cpp index 6ae2923308cded89897e6a98e8f4e71f762c20a7..39c91d00b643ad5fade4f60f4e5c42c4ec0d9a94 100644 --- a/Libraries/LibJS/Runtime/FunctionConstructor.cpp +++ b/Libraries/LibJS/Runtime/FunctionConstructor.cpp @@ -53,10 +53,10 @@ FunctionConstructor::~FunctionConstructor() Value FunctionConstructor::call() { - return construct(interpreter(), *this); + return construct(*this); } -Value FunctionConstructor::construct(Interpreter& interpreter, Function&) +Value FunctionConstructor::construct(Function&) { auto& vm = this->vm(); String parameters_source = ""; @@ -88,7 +88,17 @@ Value FunctionConstructor::construct(Interpreter& interpreter, Function&) vm.throw_exception(global_object(), error.to_string()); return {}; } - return function_expression->execute(interpreter, global_object()); + + OwnPtr local_interpreter; + Interpreter* interpreter = vm.interpreter_if_exists(); + + if (!interpreter) { + local_interpreter = Interpreter::create_with_existing_global_object(global_object()); + interpreter = local_interpreter.ptr(); + } + + VM::InterpreterExecutionScope scope(*interpreter); + return function_expression->execute(*interpreter, global_object()); } } diff --git a/Libraries/LibJS/Runtime/FunctionConstructor.h b/Libraries/LibJS/Runtime/FunctionConstructor.h index 4bd266f5cbb9fff71d940660444792bf37fbabbf..70405d43e44a8dd6ff0b81c94eb152ec12a1dc03 100644 --- a/Libraries/LibJS/Runtime/FunctionConstructor.h +++ b/Libraries/LibJS/Runtime/FunctionConstructor.h @@ -39,7 +39,7 @@ public: virtual ~FunctionConstructor() override; virtual Value call() override; - virtual Value construct(Interpreter&, Function& new_target) override; + virtual Value construct(Function& new_target) override; private: virtual bool has_constructor() const override { return true; } diff --git a/Libraries/LibJS/Runtime/NativeFunction.cpp b/Libraries/LibJS/Runtime/NativeFunction.cpp index 3785b4865b20004453628890dfb50e8761af956c..caa77e3801ee45f6021652ee2e22745c74090015 100644 --- a/Libraries/LibJS/Runtime/NativeFunction.cpp +++ b/Libraries/LibJS/Runtime/NativeFunction.cpp @@ -63,7 +63,7 @@ Value NativeFunction::call() return m_native_function(vm(), global_object()); } -Value NativeFunction::construct(Interpreter&, Function&) +Value NativeFunction::construct(Function&) { return {}; } diff --git a/Libraries/LibJS/Runtime/NativeFunction.h b/Libraries/LibJS/Runtime/NativeFunction.h index 6e2d8189014e5b8155469e601d4fa71b6ec0a8ea..6d0f3bca84845db1175416a6302cc821a4a871c8 100644 --- a/Libraries/LibJS/Runtime/NativeFunction.h +++ b/Libraries/LibJS/Runtime/NativeFunction.h @@ -42,7 +42,7 @@ public: virtual ~NativeFunction() override; virtual Value call() override; - virtual Value construct(Interpreter&, Function& new_target) override; + virtual Value construct(Function& new_target) override; virtual const FlyString& name() const override { return m_name; }; virtual bool has_constructor() const { return false; } diff --git a/Libraries/LibJS/Runtime/NumberConstructor.cpp b/Libraries/LibJS/Runtime/NumberConstructor.cpp index 17704720816251a5aee3d3e7f8e04b955062a9dc..0346f99cf5740fa302bfea6b03314951eff9df96 100644 --- a/Libraries/LibJS/Runtime/NumberConstructor.cpp +++ b/Libraries/LibJS/Runtime/NumberConstructor.cpp @@ -72,7 +72,7 @@ Value NumberConstructor::call() return vm().argument(0).to_number(global_object()); } -Value NumberConstructor::construct(Interpreter&, Function&) +Value NumberConstructor::construct(Function&) { double number = 0; if (vm().argument_count()) { diff --git a/Libraries/LibJS/Runtime/NumberConstructor.h b/Libraries/LibJS/Runtime/NumberConstructor.h index a401b9fb44cefd51eeb8600e9dd138a9399dfddc..0ed58b70cb8507d2a1d8eb5b3a9661a6e562a588 100644 --- a/Libraries/LibJS/Runtime/NumberConstructor.h +++ b/Libraries/LibJS/Runtime/NumberConstructor.h @@ -39,7 +39,7 @@ public: virtual ~NumberConstructor() override; virtual Value call() override; - virtual Value construct(Interpreter&, Function& new_target) override; + virtual Value construct(Function& new_target) override; private: virtual bool has_constructor() const override { return true; } diff --git a/Libraries/LibJS/Runtime/ObjectConstructor.cpp b/Libraries/LibJS/Runtime/ObjectConstructor.cpp index c97b8bfbbb291a22c8737ed136fab9a2fbcbb064..4600d683260d3b18ce5f17b276f21bf16a5537a1 100644 --- a/Libraries/LibJS/Runtime/ObjectConstructor.cpp +++ b/Libraries/LibJS/Runtime/ObjectConstructor.cpp @@ -69,7 +69,7 @@ Value ObjectConstructor::call() return Object::create_empty(global_object()); } -Value ObjectConstructor::construct(Interpreter&, Function&) +Value ObjectConstructor::construct(Function&) { return call(); } diff --git a/Libraries/LibJS/Runtime/ObjectConstructor.h b/Libraries/LibJS/Runtime/ObjectConstructor.h index 7d7bb5e751fa72478743d56f6a70ebeaa6519761..717539651c525dd80718139ed0cf2f88c17dd5c6 100644 --- a/Libraries/LibJS/Runtime/ObjectConstructor.h +++ b/Libraries/LibJS/Runtime/ObjectConstructor.h @@ -39,7 +39,7 @@ public: virtual ~ObjectConstructor() override; virtual Value call() override; - virtual Value construct(Interpreter&, Function& new_target) override; + virtual Value construct(Function& new_target) override; private: virtual bool has_constructor() const override { return true; } diff --git a/Libraries/LibJS/Runtime/ProxyConstructor.cpp b/Libraries/LibJS/Runtime/ProxyConstructor.cpp index a107927db2fbbdad223b9c568cbb26562f421e36..c38394f8edd7eab1acfd9d20fcea7a0d662a6273 100644 --- a/Libraries/LibJS/Runtime/ProxyConstructor.cpp +++ b/Libraries/LibJS/Runtime/ProxyConstructor.cpp @@ -55,22 +55,23 @@ Value ProxyConstructor::call() return {}; } -Value ProxyConstructor::construct(Interpreter& interpreter, Function&) +Value ProxyConstructor::construct(Function&) { - if (interpreter.argument_count() < 2) { - interpreter.vm().throw_exception(global_object(), ErrorType::ProxyTwoArguments); + auto& vm = this->vm(); + if (vm.argument_count() < 2) { + vm.throw_exception(global_object(), ErrorType::ProxyTwoArguments); return {}; } - auto target = interpreter.argument(0); - auto handler = interpreter.argument(1); + auto target = vm.argument(0); + auto handler = vm.argument(1); if (!target.is_object()) { - interpreter.vm().throw_exception(global_object(), ErrorType::ProxyConstructorBadType, "target", target.to_string_without_side_effects().characters()); + vm.throw_exception(global_object(), ErrorType::ProxyConstructorBadType, "target", target.to_string_without_side_effects().characters()); return {}; } if (!handler.is_object()) { - interpreter.vm().throw_exception(global_object(), ErrorType::ProxyConstructorBadType, "handler", handler.to_string_without_side_effects().characters()); + vm.throw_exception(global_object(), ErrorType::ProxyConstructorBadType, "handler", handler.to_string_without_side_effects().characters()); return {}; } return ProxyObject::create(global_object(), target.as_object(), handler.as_object()); diff --git a/Libraries/LibJS/Runtime/ProxyConstructor.h b/Libraries/LibJS/Runtime/ProxyConstructor.h index 752c12fe6cb0a1038b6254ef977753768da92d03..69d23b847a70e0b353ab58a8aab973e9b8abb677 100644 --- a/Libraries/LibJS/Runtime/ProxyConstructor.h +++ b/Libraries/LibJS/Runtime/ProxyConstructor.h @@ -39,7 +39,7 @@ public: virtual ~ProxyConstructor() override; virtual Value call() override; - virtual Value construct(Interpreter&, Function& new_target) override; + virtual Value construct(Function& new_target) override; private: virtual bool has_constructor() const override { return true; } diff --git a/Libraries/LibJS/Runtime/ProxyObject.cpp b/Libraries/LibJS/Runtime/ProxyObject.cpp index ea435c7ec11552e0b52780694f024d7e92825b97..1654ad4005ec1377016d0eb2346a8325f8f073d6 100644 --- a/Libraries/LibJS/Runtime/ProxyObject.cpp +++ b/Libraries/LibJS/Runtime/ProxyObject.cpp @@ -492,7 +492,7 @@ Value ProxyObject::call() return vm().call(trap.as_function(), Value(&m_handler), move(arguments)); } -Value ProxyObject::construct(Interpreter& interpreter, Function& new_target) +Value ProxyObject::construct(Function& new_target) { auto& vm = this->vm(); if (!is_function()) { @@ -507,7 +507,7 @@ Value ProxyObject::construct(Interpreter& interpreter, Function& new_target) if (vm.exception()) return {}; if (trap.is_empty() || trap.is_undefined() || trap.is_null()) - return static_cast(m_target).construct(interpreter, new_target); + return static_cast(m_target).construct(new_target); if (!trap.is_function()) { vm.throw_exception(global_object(), ErrorType::ProxyInvalidTrap, "construct"); return {}; diff --git a/Libraries/LibJS/Runtime/ProxyObject.h b/Libraries/LibJS/Runtime/ProxyObject.h index 0c7cf16b7a5289f24c34fb97f58aab37b83c5c0e..911bbe506706b0b543ed8a5f18eda03fe243a877 100644 --- a/Libraries/LibJS/Runtime/ProxyObject.h +++ b/Libraries/LibJS/Runtime/ProxyObject.h @@ -40,7 +40,7 @@ public: virtual ~ProxyObject() override; virtual Value call() override; - virtual Value construct(Interpreter&, Function& new_target) override; + virtual Value construct(Function& new_target) override; virtual const FlyString& name() const override; virtual LexicalEnvironment* create_environment() override; diff --git a/Libraries/LibJS/Runtime/RegExpConstructor.cpp b/Libraries/LibJS/Runtime/RegExpConstructor.cpp index 82ae584e014718420284108ea8ba64ca2eeb18b7..9a8b4fbba31fb3c530d3e92cdf9e5ea3ea3b479c 100644 --- a/Libraries/LibJS/Runtime/RegExpConstructor.cpp +++ b/Libraries/LibJS/Runtime/RegExpConstructor.cpp @@ -50,10 +50,10 @@ RegExpConstructor::~RegExpConstructor() Value RegExpConstructor::call() { - return construct(interpreter(), *this); + return construct(*this); } -Value RegExpConstructor::construct(Interpreter&, Function&) +Value RegExpConstructor::construct(Function&) { auto& vm = this->vm(); if (!vm.argument_count()) diff --git a/Libraries/LibJS/Runtime/RegExpConstructor.h b/Libraries/LibJS/Runtime/RegExpConstructor.h index 31a36432a21b3259ec64c072dc0d217b696e4d24..0c3d05563624eaf72f8d0858edd23d4ce349b297 100644 --- a/Libraries/LibJS/Runtime/RegExpConstructor.h +++ b/Libraries/LibJS/Runtime/RegExpConstructor.h @@ -39,7 +39,7 @@ public: virtual ~RegExpConstructor() override; virtual Value call() override; - virtual Value construct(Interpreter&, Function& new_target) override; + virtual Value construct(Function& new_target) override; private: virtual bool has_constructor() const override { return true; } diff --git a/Libraries/LibJS/Runtime/ScriptFunction.cpp b/Libraries/LibJS/Runtime/ScriptFunction.cpp index ccc524eb6bd8e90c3cfa139396e7b01bf74339f3..8d6181513079a897bd7cef92b96c04146662c3a0 100644 --- a/Libraries/LibJS/Runtime/ScriptFunction.cpp +++ b/Libraries/LibJS/Runtime/ScriptFunction.cpp @@ -143,7 +143,7 @@ Value ScriptFunction::call() return interpreter->execute_statement(global_object(), m_body, arguments, ScopeType::Function); } -Value ScriptFunction::construct(Interpreter&, Function&) +Value ScriptFunction::construct(Function&) { if (m_is_arrow_function) { vm().throw_exception(global_object(), ErrorType::NotAConstructor, m_name.characters()); diff --git a/Libraries/LibJS/Runtime/ScriptFunction.h b/Libraries/LibJS/Runtime/ScriptFunction.h index b1ca08a88d73bc4a854a815151bf31825ba586de..3f0b2276eda528218b08a1fffe259184313eceef 100644 --- a/Libraries/LibJS/Runtime/ScriptFunction.h +++ b/Libraries/LibJS/Runtime/ScriptFunction.h @@ -45,7 +45,7 @@ public: const Vector& parameters() const { return m_parameters; }; virtual Value call() override; - virtual Value construct(Interpreter&, Function& new_target) override; + virtual Value construct(Function& new_target) override; virtual const FlyString& name() const override { return m_name; }; void set_name(const FlyString& name) { m_name = name; }; diff --git a/Libraries/LibJS/Runtime/StringConstructor.cpp b/Libraries/LibJS/Runtime/StringConstructor.cpp index d5afc9eeff5073a0c544dc10a2dfcfb75f7c9d9c..421c0899acbd61b4a7b6e7905da605bcbcdc208d 100644 --- a/Libraries/LibJS/Runtime/StringConstructor.cpp +++ b/Libraries/LibJS/Runtime/StringConstructor.cpp @@ -67,7 +67,7 @@ Value StringConstructor::call() return string; } -Value StringConstructor::construct(Interpreter&, Function&) +Value StringConstructor::construct(Function&) { PrimitiveString* primitive_string = nullptr; if (!vm().argument_count()) diff --git a/Libraries/LibJS/Runtime/StringConstructor.h b/Libraries/LibJS/Runtime/StringConstructor.h index 34317edeeb62d80023249f7d48ddba24e081cd89..239d9e759663ba2aabb37d2851a5e26a7e37b184 100644 --- a/Libraries/LibJS/Runtime/StringConstructor.h +++ b/Libraries/LibJS/Runtime/StringConstructor.h @@ -39,7 +39,7 @@ public: virtual ~StringConstructor() override; virtual Value call() override; - virtual Value construct(Interpreter&, Function& new_target) override; + virtual Value construct(Function& new_target) override; private: virtual bool has_constructor() const override { return true; } diff --git a/Libraries/LibJS/Runtime/SymbolConstructor.cpp b/Libraries/LibJS/Runtime/SymbolConstructor.cpp index 2135b41917287927b9d7248fca42f6e8729f13f7..d1b86303ed91a64388843f73138b34ba004056c0 100644 --- a/Libraries/LibJS/Runtime/SymbolConstructor.cpp +++ b/Libraries/LibJS/Runtime/SymbolConstructor.cpp @@ -63,9 +63,9 @@ Value SymbolConstructor::call() return js_symbol(heap(), vm().argument(0).to_string(global_object()), false); } -Value SymbolConstructor::construct(Interpreter& interpreter, Function&) +Value SymbolConstructor::construct(Function&) { - interpreter.vm().throw_exception(global_object(), ErrorType::NotAConstructor, "Symbol"); + vm().throw_exception(global_object(), ErrorType::NotAConstructor, "Symbol"); return {}; } diff --git a/Libraries/LibJS/Runtime/SymbolConstructor.h b/Libraries/LibJS/Runtime/SymbolConstructor.h index 40d6a33690eedfa11beb5c563093db3d6a583f37..8afba45fb5b499e36e1049b8332023a39797747d 100644 --- a/Libraries/LibJS/Runtime/SymbolConstructor.h +++ b/Libraries/LibJS/Runtime/SymbolConstructor.h @@ -39,7 +39,7 @@ public: virtual ~SymbolConstructor() override; virtual Value call() override; - virtual Value construct(Interpreter&, Function& new_target) override; + virtual Value construct(Function& new_target) override; private: virtual bool has_constructor() const override { return true; } diff --git a/Libraries/LibJS/Runtime/VM.cpp b/Libraries/LibJS/Runtime/VM.cpp index 8b3d16c3578f9b6c89a2e0006a60e4a42df8a03c..273ba911a9b3a71401f0c9b12843348d24205fec 100644 --- a/Libraries/LibJS/Runtime/VM.cpp +++ b/Libraries/LibJS/Runtime/VM.cpp @@ -220,7 +220,7 @@ Value VM::construct(Function& function, Function& new_target, Optionalget_this_binding(); pop_call_frame(); diff --git a/Libraries/LibWeb/Bindings/XMLHttpRequestConstructor.cpp b/Libraries/LibWeb/Bindings/XMLHttpRequestConstructor.cpp index fb8a26098c2861518a3583881f8475db6533732e..f66f827034d4800b3ae06558bac4b04b925844a9 100644 --- a/Libraries/LibWeb/Bindings/XMLHttpRequestConstructor.cpp +++ b/Libraries/LibWeb/Bindings/XMLHttpRequestConstructor.cpp @@ -58,13 +58,13 @@ XMLHttpRequestConstructor::~XMLHttpRequestConstructor() JS::Value XMLHttpRequestConstructor::call() { - return construct(interpreter(), *this); + return construct(*this); } -JS::Value XMLHttpRequestConstructor::construct(JS::Interpreter& interpreter, Function&) +JS::Value XMLHttpRequestConstructor::construct(Function&) { auto& window = static_cast(global_object()); - return interpreter.heap().allocate(window, window, XMLHttpRequest::create(window.impl())); + return heap().allocate(window, window, XMLHttpRequest::create(window.impl())); } } diff --git a/Libraries/LibWeb/Bindings/XMLHttpRequestConstructor.h b/Libraries/LibWeb/Bindings/XMLHttpRequestConstructor.h index d478149662200ba6f646f7ca0562fa8ea95beec3..0ca6f5063fc111134d8ef001232030f5a4cd6c12 100644 --- a/Libraries/LibWeb/Bindings/XMLHttpRequestConstructor.h +++ b/Libraries/LibWeb/Bindings/XMLHttpRequestConstructor.h @@ -37,7 +37,7 @@ public: virtual ~XMLHttpRequestConstructor() override; virtual JS::Value call() override; - virtual JS::Value construct(JS::Interpreter& interpreter, Function& new_target) override; + virtual JS::Value construct(JS::Function& new_target) override; private: virtual bool has_constructor() const override { return true; }