Closed Bug 1980578 Opened 1 year ago Closed 1 year ago

Support IntPtr in M{Add,Sub,Mul,Lsh,Rsh,Ursh,MinMax}

Categories

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

enhancement

Tracking

()

RESOLVED FIXED
143 Branch
Tracking Status
firefox143 --- fixed

People

(Reporter: anba, Assigned: anba)

References

Details

Attachments

(5 external files)

Support for MIRType::IntPtr in M{Add,Sub,Mul,Lsh,Rsh,Ursh,MinMax} is needed for scalar replacement of subarray.

Blocks: 1980613

Generated code ignores overflow, similar to Int64 code generation.

Drive-by change:

  • Align Int64 with IntPtr, which also fixes some TODO notes about missing folding.
  • Mark getIdentity() as a const method.

Also update MMinMax::foldsTo to handle both IntPtr and Int64.

Drive-by change:

  • Re-enable folding Math.min(typedArray.length, 0) to 0 by
    handling isNonNegativeIntPtrToInt32 in foldLength.

These two changes allow to optimise away more nested MinMax instructions
when one operand is a constant and the other a non-negative value.

The first change allows to fold the following pattern to constant zero:

  min(min(0, len), min(>=0, len))
= min(min(0, >=0), len)
= min(0, len)
= 0

The other change allows to fold this pattern to constant zero:

  min(0, min(>=0, len))
= min(min(0, >=0), len)
= min(0, len)
= 0

These patterns can be produced when scalar-replacing subarray.

Severity: -- → N/A
Priority: -- → P2
Regressions: 1982241
Regressions: 1982666
QA Whiteboard: [qa-triage-done-c144/b143]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: