fix(stdlib): delegate Array reverse/fill/copyWithin/sort to prototype#471
Conversation
The fast-path branches in get_array_method and get_array_method_with_interp bypassed Array.prototype for reverse, fill, copyWithin, and sort. The _with_interp paths called the same indexed-property helpers that the prototype methods already use, so the bypass was redundant and skipped length-writable and Proxy trap semantics that go through the indexed [[Set]]/[[Delete]] path. Remove the four live fast-path arms from get_array_method_with_interp, collapse the corresponding dead arms in get_array_method, and delete the array_direct_* helpers (array_direct_reverse, array_direct_fill, array_direct_copy_within, array_direct_sort_default) and the now-unused array_mutator_relative_index helper. All 2249 unit tests pass; test262 filter rates are unchanged: reverse 64/64, fill 162/162, copyWithin 150/150, sort 130/144 (14 pre-existing). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughArray builtin dispatch now delegates ChangesArray method delegation updates
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Benchmark ResultsRun: https://github.com/dowdiness/js_engine/actions/runs/28223365312
Stage summary
Focused bytecode base-vs-head comparison
Base-vs-head comparison
Mean-time chart (log scale)
Closure-conversion comparison
|
Summary
reverse,fill,copyWithin, andsortfromget_array_method_with_interp, delegating each toArray.prototypevia the normal prototype chainget_array_method(these were unreachable since_with_interphandles them before the_fallback fires)array_direct_reverse,array_direct_fill,array_direct_copy_within,array_direct_sort_default, and the no-longer-referencedarray_mutator_relative_indexWhy safe: The removed
_with_interpfast paths called the same indexed-property helpers (array_reverse_indexed_properties,array_fill_indexed_properties, etc.) thatArray.prototypealready uses — the bypass was redundant and skipped length-writable and Proxy trap semantics that route through indexed[[Set]]/[[Delete]].Net change: −249 lines.
Test plan
moon check— clean, 0 warningsmoon test— 2249/2249 passedmake test262-filter FILTER="reverse"— 64/64 (strict + non-strict)make test262-filter FILTER="fill"— 162/162make test262-filter FILTER="copyWithin"— 150/150make test262-filter FILTER="sort"— 130/144 (14 failures confirmed pre-existing onmain)🤖 Generated with Claude Code
Summary by CodeRabbit
reverse,fill,copyWithin, andsortto use the shared array prototype path.entries,keys,values, andsplice.