| //@ skip if not $jitTests |
| function negateBigInt(n) { |
| for (let i = 0; i < 100000; i++) { |
| assert(negateBigInt(100n), -100n); |
| assert(negateBigInt(-0x1fffffffffffff01n), 0x1fffffffffffff01n); |
| if (numberOfDFGCompiles(negateBigInt) > 1) |
| throw "Failed negateBigInt(). We should have compiled a single negate for the BigInt type."; |
| function negateBigIntSpecializedToInt(n) { |
| noInline(negateBigIntSpecializedToInt); |
| for (let i = 0; i < 100000; i++) { |
| negateBigIntSpecializedToInt(100); |
| assert(negateBigIntSpecializedToInt(100n), -100n); |
| // Testing case mixing int and BigInt speculations |
| function mixedSpeculationNegateBigInt(n, arr) { |
| noInline(mixedSpeculationNegateBigInt); |
| for (let i = 0; i < 100000; i++) { |
| assert(mixedSpeculationNegateBigInt(100), -100); |
| assert(mixedSpeculationNegateBigInt(-0x1fffffffffffff01n), 0x1fffffffffffff01n); |
| if (numberOfDFGCompiles(mixedSpeculationNegateBigInt) > 1) |
| throw "Failed mixedSpeculationNegateBigInt(). We should have compiled a single negate for the BigInt type."; |