1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:07:35 +00:00

LibJS/Bytecode: Rename Call and SuperCall to &WithArgumentArray

Forcing every function call to allocate a new Array just to accommodate
spread parameters is not very nice, so let's start moving towards making
this a special case rather than the general (and only) case.
This commit is contained in:
Andreas Kling 2023-07-02 15:59:54 +02:00
parent dc884aa0d3
commit 7eb87dec9f
5 changed files with 38 additions and 40 deletions

View file

@ -770,17 +770,16 @@ public:
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
};
// NOTE: This instruction is variable-width depending on the number of arguments!
class Call final : public Instruction {
public:
enum class CallType {
Call,
Construct,
DirectEval,
};
enum class CallType {
Call,
Construct,
DirectEval,
};
Call(CallType type, Register callee, Register this_value, Optional<StringTableIndex> expression_string = {})
: Instruction(Type::Call)
class CallWithArgumentArray final : public Instruction {
public:
CallWithArgumentArray(CallType type, Register callee, Register this_value, Optional<StringTableIndex> expression_string = {})
: Instruction(Type::CallWithArgumentArray)
, m_callee(callee)
, m_this_value(this_value)
, m_type(type)
@ -802,11 +801,10 @@ private:
Optional<StringTableIndex> m_expression_string;
};
// NOTE: This instruction is variable-width depending on the number of arguments!
class SuperCall : public Instruction {
class SuperCallWithArgumentArray : public Instruction {
public:
explicit SuperCall(bool is_synthetic)
: Instruction(Type::SuperCall)
explicit SuperCallWithArgumentArray(bool is_synthetic)
: Instruction(Type::SuperCallWithArgumentArray)
, m_is_synthetic(is_synthetic)
{
}