Closed Bug 1964692 Opened 5 months ago Closed 5 months ago

Move (Shared)Array.prototype.slice to C++

Categories

(Core :: JavaScript: Standard Library, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
140 Branch
Tracking Status
firefox140 --- fixed

People

(Reporter: anba, Assigned: anba)

References

Details

Attachments

(8 files)

Moving (Shared)Array.prototype.slice to C++ avoids adding a bunch of self-hosting intrinsics and helps a bit for implementing the "Immutable ArrayBuffer" proposal (bug 1952253). When using fuses for the species constructor, there's additional a performance improvement when copying small ArrayBuffers using inline storage.

Add ToIntegerIndex in preparation for the next part.

ToIntegerIndex needs to be instantiated for size_t and uint64_t. It's not
valid add explicit instantiations for both size_t and uint64_t, because
size_t is uint64_t on 64-bit platforms and it's invalid to have duplicate
template instantiations. Instead instantiate uint32_t and uint64_t to handle
32- and 64-bit targets.

Re-implement ArrayBuffer.prototype.slice in C++, because the self-hosted
implementation needs to call into C++ anyway for copying the bytes. And it
makes things easier for implementing ArrayBuffer.prototype.sliceToImmutable
from the "Immutable ArrayBuffer" proposal.

Part 3 will remove the self-hosted implementation. And part 8 will add a fast
path when the species constructor is the built-in ArrayBuffer constructor.

Remove the self-hosted function and all supporting intrinsics.

Noticed in part 3 that there are more no longer used built-in object kinds.

Also move the SharedArrayBuffer version to C++ to match how ArrayBuffer is
now implemented.

SharedArrayBufferObject::copyData no longer uses handles to avoid unnecessary
rooting for unwrappedResult in SharedArrayBufferObject::sliceImpl.

Used in the next part to optimise slice for the common case when the species
constructor is the built-in (Shared)ArrayBuffer constructor.

This gives a noticeable speed-up in µ-benchmarks when constructing ArrayBuffer
objects with inline storage. SharedArrayBuffer objects don't benefit that much,
but it probably doesn't hurt to align SharedArrayBuffer with ArrayBuffer.

Blocks: 784288
Severity: -- → N/A
Priority: -- → P2
Pushed by andre.bargull@gmail.com: https://hg.mozilla.org/integration/autoland/rev/c8785ba9536a Part 1: Move ToIntegerIndex to jsnum. r=jandem https://hg.mozilla.org/integration/autoland/rev/d906f948df43 Part 2: Implement ArrayBuffer.prototype.slice in C++. r=jandem https://hg.mozilla.org/integration/autoland/rev/c4c82b8949ed Part 3: Remove self-hosting functions for ArrayBufferSlice. r=jandem https://hg.mozilla.org/integration/autoland/rev/c2faff222a7f Part 4: Remove unused built-in object kinds. r=jandem https://hg.mozilla.org/integration/autoland/rev/63137340380a Part 5: Implement SharedArrayBuffer.prototype.slice in C++. r=jandem https://hg.mozilla.org/integration/autoland/rev/ebe210c439c7 Part 6: Remove self-hosting functions for SharedArrayBufferSlice. r=jandem https://hg.mozilla.org/integration/autoland/rev/704fabe7a702 Part 7: Add fuses for ArrayBuffer and SharedArrayBuffer species. r=jandem https://hg.mozilla.org/integration/autoland/rev/7ffd6a45a275 Part 8: Add fast-path when (Shared)ArrayBuffer species fuses are intact. r=jandem
Pushed by agoloman@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d21086757441 Revert "Bug 1964692 - Part 8: Add fast-path when (Shared)ArrayBuffer species fuses are intact. r=jandem"

Backed out for causing build bustages @jsnum.cpp.

Flags: needinfo?(andrebargull)
Flags: needinfo?(andrebargull)
Pushed by andre.bargull@gmail.com: https://hg.mozilla.org/integration/autoland/rev/9bfa7c8f85af Part 1: Move ToIntegerIndex to jsnum. r=jandem https://hg.mozilla.org/integration/autoland/rev/5d3df727445b Part 2: Implement ArrayBuffer.prototype.slice in C++. r=jandem https://hg.mozilla.org/integration/autoland/rev/4beff360f7ee Part 3: Remove self-hosting functions for ArrayBufferSlice. r=jandem https://hg.mozilla.org/integration/autoland/rev/15eed7e6983f Part 4: Remove unused built-in object kinds. r=jandem https://hg.mozilla.org/integration/autoland/rev/479468ad7b5c Part 5: Implement SharedArrayBuffer.prototype.slice in C++. r=jandem https://hg.mozilla.org/integration/autoland/rev/4245d0b38c88 Part 6: Remove self-hosting functions for SharedArrayBufferSlice. r=jandem https://hg.mozilla.org/integration/autoland/rev/f529723c02d0 Part 7: Add fuses for ArrayBuffer and SharedArrayBuffer species. r=jandem https://hg.mozilla.org/integration/autoland/rev/e946ef6e23cb Part 8: Add fast-path when (Shared)ArrayBuffer species fuses are intact. r=jandem
QA Whiteboard: [qa-triage-done-c141/b140]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: