Closed Bug 1451251 Opened 6 years ago Closed 6 years ago

Add missing JS_INLINABLE_FN for some built-ins exposed to self-hosting code

Categories

(Core :: JavaScript Engine, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla61
Tracking Status
firefox61 --- fixed

People

(Reporter: anba, Assigned: anba)

Details

Attachments

(1 file)

JS_INLINABLE_FN is missing for:
- std_Array_join
- std_String_toLowerCase
- std_String_toUpperCase

Supporting these functions improve this µ-benchmark from 450ms to 360ms for me:
---
function f() {
    var q = 0;
    var t = dateNow();
    for (var i = 0; i < 1000000; ++i) {
        q += "".toLocaleLowerCase("de-de").length;
    }
    return [dateNow() - t, q];
}
---

And this one from 50ms to 30ms:
---
function f() {
    var q = 0;
    var t = dateNow();
    for (var i = 0; i < 1000000; ++i) {
        q += "".toLocaleLowerCase("de").length;
    }
    return [dateNow() - t, q];
}
---



JS_INLINABLE_FN should also be supported for:
- IsArrayBuffer
- IsSharedArrayBuffer

That will improve this µ-benchmark from 440ms to 390ms:
---
function f() {
    var ab = new ArrayBuffer(8);
    var q = 0;
    var t = dateNow();
    for (var i = 0; i < 1000000; ++i) {
        q += ab.slice(0).byteLength;
    }
    return [dateNow() - t, q];
}
---

And this one from 285ms to 135ms:
---
function f() {
    var ta = new Int32Array(16);
    ta.buffer; // IsSharedArrayBuffer is called if reified buffer is present.
    var q = 0;
    var t = dateNow();
    for (var i = 0; i < 5000000; ++i) {
        q += ta.fill(i)[0];
    }
    return [dateNow() - t, q];
}
---
Attached patch bug1451251.patchSplinter Review
Adds inlining support for the built-ins mentioned in comment #0. Also removes the unused "IsReadableStreamBYOBRequest", "IsPromiseObject", and "CallPromiseMethodIfWrapped" exports.
Attachment #8964805 - Flags: review?(jdemooij)
Comment on attachment 8964805 [details] [diff] [review]
bug1451251.patch

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

Good finds!
Attachment #8964805 - Flags: review?(jdemooij) → review+
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/ab684911d520
Inline more functions used for self-hosting. r=jandem
Keywords: checkin-needed
Priority: -- → P3
https://hg.mozilla.org/mozilla-central/rev/ab684911d520
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.