Closed Bug 1685708 Opened 5 years ago Closed 5 years ago

Add inlining support for BigInt.as{Int,Uint}N

Categories

(Core :: JavaScript Engine: JIT, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
86 Branch
Tracking Status
firefox86 --- fixed

People

(Reporter: anba, Assigned: anba)

Details

Attachments

(5 files)

Add inlining support for BigInt.as{Int,Uint}N() to improve the performance when using BigInt for int64 operations. Inlining support more than doubles our performance for the test case from https://github.com/tc39/proposal-bigint/issues/117. (Make sure to use JSGC_DISABLE_POISONING=1 to avoid measuring GC poisoning cost.)

This bug is also a prerequisite for optimising BigInt on int64 values without actually allocating BigInt objects. When most BigInt allocations can be optimised away, the "sha512-with-bigints.js" test case even runs slightly faster than "sha512-with-runtime-long.js" for us. But we also regressed "sha512-with-runtime-long.js" with Warp (by ~50% when compared to Ion, IIRC), so that should probably be taken into account, too.

The fast path didn't handle the no-op case, which actually made the fast-path
slower for the case when no conversion is necessary.

Add CacheIR support for Big.as{Uint,Int}N() so we can optimise these functions
more efficiently in Warp in part 5.

Depends on D101167

Support Signed/NotSigned in preparation for part 5.

Depends on D101168

For the next part we want to call these methods without having to worry about
the edx:eax restriction on x86.

Depends on D101169

BigInt.as{Int,Uint}N(bits, x) with bits={32,64} are expected to be common enough
to warrant providing specialised code. For example BigInt.asIntN(64, x + y) can
be used to inform the compiler to perform Int64 additions.

Depends on D101170

Pushed by rmaries@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/de98a7e28f06 Part 1: Handle no-op cases for 64-bit results in Big.as{Uint,Int}N. r=jandem https://hg.mozilla.org/integration/autoland/rev/c7a807bd4deb Part 2: Add CacheIR support for Big.as{Uint,Int}N. r=jandem https://hg.mozilla.org/integration/autoland/rev/db013483866a Part 3: Support Signed/NotSigned in MacroAssembler::branchTest64 on 32-bit platforms. r=jandem https://hg.mozilla.org/integration/autoland/rev/1273409d014c Part 4: Remove register restrictions from MacroAssembler::move{8,16,32}To64SignExtend. r=jandem https://hg.mozilla.org/integration/autoland/rev/ff678e63e677 Part 5: Transpile BigInt.as{Int,Uint}N. r=jandem

Missing #include leading to non-unified builds bustage. I'll update the patch shortly. Thanks for the info!

Flags: needinfo?(andrebargull)
Pushed by rmaries@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/18f3ee438da2 Part 1: Handle no-op cases for 64-bit results in Big.as{Uint,Int}N. r=jandem https://hg.mozilla.org/integration/autoland/rev/501a75fb9ffb Part 2: Add CacheIR support for Big.as{Uint,Int}N. r=jandem https://hg.mozilla.org/integration/autoland/rev/d6617eb8f783 Part 3: Support Signed/NotSigned in MacroAssembler::branchTest64 on 32-bit platforms. r=jandem https://hg.mozilla.org/integration/autoland/rev/095a87205614 Part 4: Remove register restrictions from MacroAssembler::move{8,16,32}To64SignExtend. r=jandem https://hg.mozilla.org/integration/autoland/rev/4711d0893629 Part 5: Transpile BigInt.as{Int,Uint}N. r=jandem
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: