Closed Bug 1453922 Opened 6 years ago Closed 6 years ago

Add int32 values inline for ToIndex

Categories

(Core :: JavaScript Engine, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla61
Tracking Status
firefox61 --- fixed

People

(Reporter: anba, Assigned: anba)

Details

Attachments

(1 file, 1 obsolete file)

While working on bug 1453809, I've noticed that ToIndex <https://searchfox.org/mozilla-central/rev/9f3da81290054c5b8955bb67ff98cae66676f745/js/src/jsnum.h#273,276> doesn't have a fast path for int32 values. (The other ToIntxyz or ToInteger functions all handle int32 values in the inline part.)
Attached patch bug1453922.patch (obsolete) — Splinter Review
The patch improves this DataView µ-benchmark from 330ms to 250ms for me:
---
function f() {
    var dv = new DataView(new ArrayBuffer(8));
    var t = dateNow();
    for (var i = 0; i < 10000000; ++i) {
        dv.getInt32(0, true);
    }
    print(dateNow() - t);
}
---
Attachment #8967682 - Flags: review?(jdemooij)
Comment on attachment 8967682 [details] [diff] [review]
bug1453922.patch

Review of attachment 8967682 [details] [diff] [review]:
-----------------------------------------------------------------

Nice, thanks!
Attachment #8967682 - Flags: review?(jdemooij) → review+
Attached patch bug1453922.patchSplinter Review
Rebased patch to apply cleanly on inbound, carrying r+.
Attachment #8967682 - Attachment is obsolete: true
Attachment #8969195 - Flags: review+
Pushed by nerli@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/363cc3b4dd41
Add fast path for non-negative int32 values to ToIndex. r=jandem
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/363cc3b4dd41
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
You need to log in before you can comment on or make changes to this bug.