Images 💾

Last commit ⭐

commit 8ff16c1b5703a380a3ddbd945d1dbebd8532ad89
Author:     Andreas Kling <>
AuthorDate: Sat May 4 15:48:23 2024 +0200
Commit:     Andreas Kling <>
CommitDate: Sat May 4 21:42:59 2024 +0200

    LibJS: Cache access to properties found in prototype chain
    We already had fast access to own properties via shape-based IC.
    This patch extends the mechanism to properties on the prototype chain,
    using the "validity cell" technique from V8.
    - Prototype objects now have unique shape
    - Each prototype has an associated PrototypeChainValidity
    - When a prototype shape is mutated, every prototype shape "below" it
      in any prototype chain is invalidated.
    - Invalidation happens by marking the validity object as invalid,
      and then replacing it with a new validity object.
    - Property caches keep a pointer to the last seen valid validity.
      If there is no validity, or the validity is invalid, the cache
      misses and gets repopulated.
    This is very helpful when using JavaScript to access DOM objects,
    as we frequently have to traverse 4+ prototype objects before finding
    the property we're interested in on e.g EventTarget or Node.