1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:28:11 +00:00

LibJS/JIT: Add fast path for GetById of Array.length

Array.length is magical (since it has to reflect the number of elements
in the object's property storage).

We now handle it specially in jitted code, giving us a massive speed-up
on Kraken/ai-astar.js (and probably many other things as well) :^)
This commit is contained in:
Andreas Kling 2023-11-12 15:04:23 +01:00
parent e41f0d9dec
commit b532dedc91
3 changed files with 65 additions and 0 deletions

View file

@ -64,6 +64,7 @@ NonnullGCPtr<Array> Array::create_from(Realm& realm, Vector<Value> const& elemen
Array::Array(Object& prototype)
: Object(ConstructWithPrototypeTag::Tag, prototype)
{
m_has_magical_length_property = true;
}
// 10.4.2.4 ArraySetLength ( A, Desc ), https://tc39.es/ecma262/#sec-arraysetlength