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

LibJS: Remove m_first_invalid_property_range from ObjectExpression

This was state only used by the parser to output an error with
appropriate location. This shrinks the size of ObjectExpression from
120 bytes down to just 56. This saves roughly 2.5 MiB when loading
twitter.
This commit is contained in:
davidot 2022-11-27 02:24:38 +01:00 committed by Linus Groh
parent 3acbd96851
commit 2c26ee89ac
3 changed files with 12 additions and 9 deletions

View file

@ -1691,10 +1691,9 @@ private:
class ObjectExpression final : public Expression {
public:
explicit ObjectExpression(SourceRange source_range, NonnullRefPtrVector<ObjectProperty> properties = {}, Optional<SourceRange> first_invalid_property_range = {})
explicit ObjectExpression(SourceRange source_range, NonnullRefPtrVector<ObjectProperty> properties = {})
: Expression(source_range)
, m_properties(move(properties))
, m_first_invalid_property_range(move(first_invalid_property_range))
{
}
@ -1702,13 +1701,10 @@ public:
virtual void dump(int indent) const override;
virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override;
Optional<SourceRange> const& invalid_property_range() const { return m_first_invalid_property_range; }
private:
virtual bool is_object_expression() const override { return true; }
NonnullRefPtrVector<ObjectProperty> m_properties;
Optional<SourceRange> m_first_invalid_property_range;
};
class ArrayExpression final : public Expression {