Closed Bug 1564133 Opened 5 months ago Closed 5 months ago

Relax input requirement for String.fromCodePoint to allow double values

Categories

(Core :: JavaScript Engine: JIT, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox69 --- wontfix
firefox70 --- fixed

People

(Reporter: anba, Assigned: anba)

Details

Attachments

(1 file)

Improves the following µ-benchmark from ~180ms to ~25ms for me:

function f() {
    var xs = [Math.cos(0) * 0x41, Math.cos(0) * 0x61];
    var q = 0;
    var t = dateNow();
    for (var i = 0; i < 5000000; ++i) {
        q += String.fromCodePoint(xs[i & 1]).length;
    }
    return [dateNow() - t, q];
}
for (var i = 0; i < 10; ++i) print(f());

Relax the allowed input type for String.fromCodePoint from Int32 to any Number type, so that a
missed Int32 optimisation for the input argument doesn't prevent inlining the complete function.

MToNumberInt32 triggers a bailout when the input isn't representable as an Int32 value, but since
String.fromCodePoint will throw an exception in this case anyway, it's okay when MToNumberInt32
bails out earlier.

Priority: -- → P1

Pushed by rvandermeulen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8c0b051601f4
Allow inlining String.fromCodePoint when called with double values. r=mgaudet

Keywords: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70
You need to log in before you can comment on or make changes to this bug.