mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:57:44 +00:00
LibJS: Remove Interpreter::call()
Just use VM::call() directly everywhere.
This commit is contained in:
parent
ec55490198
commit
94b95a4924
4 changed files with 6 additions and 36 deletions
|
@ -215,7 +215,7 @@ Value CallExpression::execute(Interpreter& interpreter, GlobalObject& global_obj
|
|||
|
||||
interpreter.current_environment()->bind_this_value(global_object, result);
|
||||
} else {
|
||||
result = interpreter.call(function, this_value, move(arguments));
|
||||
result = interpreter.vm().call(function, this_value, move(arguments));
|
||||
}
|
||||
|
||||
if (interpreter.exception())
|
||||
|
@ -1760,7 +1760,7 @@ Value TaggedTemplateLiteral::execute(Interpreter& interpreter, GlobalObject& glo
|
|||
raw_strings->indexed_properties().append(value);
|
||||
}
|
||||
strings->define_property("raw", raw_strings, 0);
|
||||
return interpreter.call(tag_function, js_undefined(), move(arguments));
|
||||
return interpreter.vm().call(tag_function, js_undefined(), move(arguments));
|
||||
}
|
||||
|
||||
void TryStatement::dump(int indent) const
|
||||
|
|
|
@ -59,21 +59,6 @@ public:
|
|||
|
||||
static NonnullOwnPtr<Interpreter> create_with_existing_global_object(GlobalObject&);
|
||||
|
||||
template<typename... Args>
|
||||
[[nodiscard]] ALWAYS_INLINE Value call(Function& function, Value this_value, Args... args)
|
||||
{
|
||||
// Are there any values in this argpack?
|
||||
// args = [] -> if constexpr (false)
|
||||
// args = [x, y, z] -> if constexpr ((void)x, true || ...)
|
||||
if constexpr ((((void)args, true) || ...)) {
|
||||
MarkedValueList arglist { heap() };
|
||||
(..., arglist.append(move(args)));
|
||||
return call(function, this_value, move(arglist));
|
||||
}
|
||||
|
||||
return call(function, this_value);
|
||||
}
|
||||
|
||||
~Interpreter();
|
||||
|
||||
Value run(GlobalObject&, const Program&);
|
||||
|
@ -90,7 +75,6 @@ public:
|
|||
Value argument(size_t index) const { return vm().argument(index); }
|
||||
Value this_value(Object& global_object) const { return vm().this_value(global_object); }
|
||||
LexicalEnvironment* current_environment() { return vm().current_environment(); }
|
||||
const CallFrame& call_frame() { return vm().call_frame(); }
|
||||
|
||||
void enter_scope(const ScopeNode&, ArgumentVector, ScopeType, GlobalObject&);
|
||||
void exit_scope(const ScopeNode&);
|
||||
|
@ -100,11 +84,6 @@ public:
|
|||
private:
|
||||
explicit Interpreter(VM&);
|
||||
|
||||
[[nodiscard]] Value call_internal(Function& function, Value this_value, Optional<MarkedValueList> arguments)
|
||||
{
|
||||
return vm().call(function, this_value, move(arguments));
|
||||
}
|
||||
|
||||
void push_scope(ScopeFrame frame);
|
||||
|
||||
Vector<ScopeFrame> m_scope_stack;
|
||||
|
@ -114,13 +93,4 @@ private:
|
|||
Handle<Object> m_global_object;
|
||||
};
|
||||
|
||||
template<>
|
||||
[[nodiscard]] ALWAYS_INLINE Value Interpreter::call(Function& function, Value this_value, MarkedValueList arguments) { return call_internal(function, this_value, move(arguments)); }
|
||||
|
||||
template<>
|
||||
[[nodiscard]] ALWAYS_INLINE Value Interpreter::call(Function& function, Value this_value, Optional<MarkedValueList> arguments) { return call_internal(function, this_value, move(arguments)); }
|
||||
|
||||
template<>
|
||||
[[nodiscard]] ALWAYS_INLINE Value Interpreter::call(Function& function, Value this_value) { return call(function, this_value, Optional<MarkedValueList> {}); }
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue