You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browse filesBrowse the repository at this point in the historyBrowse files
Ralph Küpper
committed
perf(array): serve the object keys walk from the array's own words (#7768)
The object field-get funnel already proves `keys` is a live `GC_TYPE_ARRAY` and
caps the index below its capacity, then called `js_array_get` per key — which
re-establishes both facts from scratch: a `clean_arr_ptr` forwarding walk, a
lazy-header probe, the exotic-receiver classifications and a descriptor-flag
read. That funnel was 78% of all `js_array_get_f64` samples on
`gc-handoff/apps/asyncpipe_big.ts`. `keys_array_len_capped_to_capacity` paid the
same toll through `js_array_length` once per property read.
`keys_array_slot` serves the dense, descriptor-free, non-forwarded case from the
array's own words and delegates everything else — a hole, an out-of-range index,
a forwarded or descriptor-carrying array, a null pointer — so no general
semantics move. A test-only per-thread fallback counter pins both directions, so
a fast path that stopped applying and one that started swallowing a shape it
should have delegated are equally red.
Also switches the #7768 receiver-tag read to `addr_class::try_read_gc_header`:
this file's usual `>= GC_HEADER_SIZE + 0x1000` floor sits BELOW the handle band,
and `js_array_length` reaches it before proxy/handle receivers are routed. Keeps
the addr-class ratchet green too.
crates/perry-runtime/src/closure/dispatch/ | * | pre-existing GcHeader probe predating addr_class; address validated by call-site guards (magnitude/registry/is_valid_obj_ptr) -- migrate to addr_class::try_read_gc_header in a follow-up (split of closure/dispatch.rs)
152
152
crates/perry-runtime/src/bun_compat/string_width.rs | 0xE0000..=0xE007F | Unicode "Tags" codepoint block (U+E0000..U+E007F) tested against a char, not a handle-band address
153
153
crates/perry-runtime/src/bun_compat/width_tables.rs | * | pure Unicode East-Asian-width codepoint-range table; every hex literal is a Unicode code point (e.g. U+F0000 / U+100000 SPUA-A/B planes), never a handle-band address
154
+
crates/perry-runtime/src/array/collection_tag_tests.rs | * | unit tests for the #7768 receiver-tag gate: they read AND re-stamp `GcHeader.obj_type` on an address they allocated themselves, which is the whole subject under test. `try_read_gc_header` cannot serve them (it hands out a shared reference, and the recycling test must WRITE the tag to model `arena_alloc_gc` handing the bytes to the next owner).
0 commit comments