Files
ladybird/Libraries/LibJS/Runtime/Object.cpp
Andreas Kling 5f586ae406 LibJS: Promote Holey arrays to Packed when all holes are filled
Arrays created via new Array(N) or by setting .length start as Holey
since their elements are not present. After sequential fill (e.g.
for (i=0; i<N; i++) a[i]=v), all holes are filled but the array
remained Holey, preventing the Packed fast paths in the asm
interpreter from triggering.

Now, whenever indexed_put() writes to the last index of a Holey
array, we scan for remaining holes and promote to Packed if none
are found. Only checking on writes to the last index avoids O(N^2)
scanning on partial fills while still catching the common
sequential fill pattern.
2026-03-17 22:28:35 -05:00

78 KiB