Closed Bug 1519135 Opened 7 years ago Closed 7 years ago

Replace JSOP_POS in ++/-- with JSOP_TONUMERIC

Categories

(Core :: JavaScript Engine, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla67
Tracking Status
firefox66 --- wontfix
firefox67 --- fixed

People

(Reporter: wingo, Assigned: wingo)

References

Details

Attachments

(1 file)

In a post-BigInt world, we need to change how ++/-- compiles. Currently, to compile "++i", the bytecode emitter will emit JSOP_POS to force ToNumber(i), then emit JSOP_ADD with a constant of 1. However ++/-- should also work on bigints, but it is not allowed to add a normal 1 to a bigint; both operands have to be bigints.

To fix this, bug 1508521 replaces the addition/subtraction by one with new JSOP_INC / JSOP_DEC opcodes. But we need to replace JSOP_POS as well, because unary plus (JSOP_POS) isn't valid on BigInts, sadly, because it's used by asm.js to ensure a number is a number :(

So, the bigint spec replaces ToNumber in ++ with ToNumeric, specified as:

https://tc39.github.io/proposal-bigint/#sec-tonumeric

See also the updated ++/-- spec:

https://tc39.github.io/proposal-bigint/#sec-update-expressions

This patch will add a new JSOP_TONUMERIC opcode and change to make ++/-- emit JSOP_TONUMERIC instead of JSOP_POS. Let's see if we can do this without regressing ++/-- for everyone!

additional keywords for future searching: increment, decrement, preincrement, predecrement, postincrement, postdecrement

Priority: -- → P2

Setting checkin-needed, the feedback from :nbp was addressed and :jandem reviewed the latest revisions

Keywords: checkin-needed

Pushed by csabou@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d65cae66e331
Replace JSOP_POS in ++/-- with JSOP_TONUMERIC r=terpri,jandem

Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla67
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: