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

LibJS: Reorganize computing of |this| for CallExpressions

This avoids executing the LHS of the object expression twice when doing
a call on the result of an object expression.
This commit is contained in:
Andreas Kling 2020-04-01 18:51:27 +02:00
parent 021d78f8f7
commit cd9379dca9
2 changed files with 29 additions and 11 deletions

View file

@ -484,6 +484,12 @@ public:
private:
virtual const char* class_name() const override { return "CallExpression"; }
struct ThisAndCallee {
Value this_value;
Value callee;
};
ThisAndCallee compute_this_and_callee(Interpreter&) const;
NonnullRefPtr<Expression> m_callee;
const NonnullRefPtrVector<Expression> m_arguments;
};