mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-14 13:01:55 +00:00
LibJS: Make GetById cache polymorphic
Instead of monomorphic (1 shape), GetById inline caches are now polymorphic (4 shapes). This improves inline cache hit rates greatly on most web JavaScript. For example, Speedometer 2.1 sees 88% -> 97% cache hit rate improvement. 1.71x speedup on MicroBench/pic-get-own.js 1.82x speedup on MicroBench/pic-get-pchain.js
This commit is contained in:
parent
678c15a06a
commit
a677d96b8f
Notes:
github-actions[bot]
2025-05-06 22:28:14 +00:00
Author: https://github.com/awesomekling
Commit: a677d96b8f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4628
2 changed files with 59 additions and 43 deletions
|
@ -23,11 +23,16 @@
|
|||
|
||||
namespace JS::Bytecode {
|
||||
|
||||
// Represents one polymorphic inline cache used for property lookups.
|
||||
struct PropertyLookupCache {
|
||||
WeakPtr<Shape> shape;
|
||||
Optional<u32> property_offset;
|
||||
WeakPtr<Object> prototype;
|
||||
WeakPtr<PrototypeChainValidity> prototype_chain_validity;
|
||||
static constexpr size_t max_number_of_shapes_to_remember = 4;
|
||||
struct Entry {
|
||||
WeakPtr<Shape> shape;
|
||||
Optional<u32> property_offset;
|
||||
WeakPtr<Object> prototype;
|
||||
WeakPtr<PrototypeChainValidity> prototype_chain_validity;
|
||||
};
|
||||
AK::Array<Entry, max_number_of_shapes_to_remember> entries;
|
||||
};
|
||||
|
||||
struct GlobalVariableCache : public PropertyLookupCache {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue