Replace JSOP_POS in ++/-- with JSOP_TONUMERIC
Categories
(Core :: JavaScript Engine, enhancement, P2)
Tracking
()
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
| Assignee | ||
Comment 1•7 years ago
|
||
Updated•7 years ago
|
| Assignee | ||
Comment 2•7 years ago
|
||
Setting checkin-needed, the feedback from :nbp was addressed and :jandem reviewed the latest revisions
Pushed by csabou@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d65cae66e331
Replace JSOP_POS in ++/-- with JSOP_TONUMERIC r=terpri,jandem
Comment 4•7 years ago
|
||
| bugherder | ||
Updated•7 years ago
|
Updated•7 years ago
|
Description
•