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

LibJS: Shrink Identifier's environment coordinate cache

This patch does two things:

- We now use u32 instead of size_t for the hops and index fields
  in EnvironmentCoordinate. This means we're limited to an environment
  nesting level and variable count of 4Gs respectively.

- Instead of wrapping it in an Optional, EnvironmentCoordinate now has
  a custom valid/invalid state using a magic marker value.

These two changes reduce the size of Identifier by 16 bytes. :^)
This commit is contained in:
Andreas Kling 2022-11-21 18:01:22 +01:00
parent 76f438eb3e
commit 0f1f925532
4 changed files with 16 additions and 10 deletions

View file

@ -1222,7 +1222,7 @@ private:
virtual bool is_identifier() const override { return true; }
FlyString m_string;
mutable Optional<EnvironmentCoordinate> m_cached_environment_coordinate;
mutable EnvironmentCoordinate m_cached_environment_coordinate;
};
class PrivateIdentifier final : public Expression {