Closed Bug 1816860 Opened 1 year ago Closed 1 year ago

Improve branchTruncateDoubleToInt32 test coverage and remove some dead code

Categories

(Core :: JavaScript Engine: JIT, task)

task

Tracking

()

RESOLVED FIXED
112 Branch
Tracking Status
firefox112 --- fixed

People

(Reporter: jandem, Assigned: jandem)

Details

Attachments

(3 files)

The LoongArch maintainers noticed we're missing test coverage for the out-of-int32-range case. I wrote a test that failed for them but jit-tests didn't catch it with --tbpl:

function g(d) {
    return parseInt(d);
}
function f() {
    with({}) {}
    for (var i = 0; i < 10_000; i++) {
        assertEq(g(1.1), 1);
    }
    assertEq(g(0xf_ffff_ffff) + 345, 68719477080);
}
f();

I also noticed some of the callers are dead code and/or can be simplified now post-Warp.

MToIntegerInt32 is currently only used for boolean-to-int32. We can do that with
a much simpler MIR instruction.

The LoongArch maintainers noticed we were missing test coverage for some of these cases.
This test catches the bug they had noticed in their implementation, so we should add it
to the test suite.

Depends on D169897

Pushed by jdemooij@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/13cee6282674
part 1 - Replace MToIntegerInt32 with MBooleanToInt32. r=iain,nbp
https://hg.mozilla.org/integration/autoland/rev/91f90c6bfe46
part 2 - Remove dead truncate-no-wrap code. r=iain
https://hg.mozilla.org/integration/autoland/rev/f76abe74fdee
part 3 - Add test for truncating large doubles to int32. r=iain
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 112 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: