Closed Bug 1665946 Opened 4 years ago Closed 4 years ago

Handle Strings and null/undefined in CacheIR bitwise operations

Categories

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

task

Tracking

()

RESOLVED FIXED
83 Branch
Tracking Status
firefox82 --- wontfix
firefox83 --- fixed

People

(Reporter: anba, Assigned: anba)

References

(Blocks 1 open bug)

Details

Attachments

(4 files)

We don't have CacheIR support for string|0, because it's already supported by Ion. For Warp we need to handle this at the CacheIR level. The same goes for null and undefined, which I've seen in user code like int32Array[invalidIndex] | 0 (bug 1515620).

Handle null and undefined to avoid the slow VM-call fallback for code like
int32Array[invalidIndex]|0 (bug 1515620).

string|0 is sometimes used as a "fast" way to convert strings to integers.
Ion handles this case, but Warp doesn't yet.

Depends on D90712

Extract the CanTruncateToInt32 and EmitTruncateToInt32Guard functions in
preparation for the next part.

Depends on D90713

Use the same approach as taken for binary bitwise operations. This ensures no
unexpected performance differences can happen when switching between binary
and unary operations. This change also removes unreachable code in
UnaryArithIRGenerator::tryAttachStringNumber(): If the input is a string,
we always succeed in tryAttachStringInt32(), so the JSOp::BitNot case in
tryAttachStringNumber() is never taken. Furthermore this avoids attaching
the same stub multiple times in tryAttachStringInt32() when the string can't
be parsed as an int32 (e.g. ~"1.1").

Depends on D90714

Severity: -- → N/A
Priority: -- → P2
Pushed by abutkovits@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/657a08a46195 Part 1: Handle null and undefined in CacheIR binary bit-ops. r=jandem https://hg.mozilla.org/integration/autoland/rev/c7fe96c53e6f Part 2: Handle Strings in CacheIR binary bit-ops. r=jandem https://hg.mozilla.org/integration/autoland/rev/bb9a4a6710d1 Part 3: Extract CanTruncateToInt32 and TruncateToInt32Guard functions. r=jandem https://hg.mozilla.org/integration/autoland/rev/1fc515ba6237 Part 4: Align CacheIR unary with binary bit-ops. r=jandem
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: