test262-automation e9a5a7f918 [javascriptcore-test262-automation] changes from git@github.com:WebKit/webkit.git at sha 949e26452cfa153a7f4afe593da97e2fe9e1b706 on Tue Jul 03 2018 14:35:15 GMT-0400 (Eastern Daylight Time) (#1620)
* [javascriptcore-test262-automation] changes from git@github.com:WebKit/webkit.git at sha 949e26452cfa153a7f4afe593da97e2fe9e1b706 on Tue Jul 03 2018 14:35:15 GMT-0400 (Eastern Daylight Time)
2018-07-03 15:59:58 -04:00

49 lines
1.2 KiB
JavaScript

//@ skip if not $jitTests
//@ runBigIntEnabled
function assert(a, b) {
if (a !== b)
throw new Error("Bad!");
}
function negateBigInt(n) {
return -n;
}
noInline(negateBigInt);
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) {
return -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) {
return -(-(-n));
}
noInline(mixedSpeculationNegateBigInt);
for (let i = 0; i < 100000; i++) {
if (i % 2)
assert(mixedSpeculationNegateBigInt(100), -100);
else
assert(mixedSpeculationNegateBigInt(-0x1fffffffffffff01n), 0x1fffffffffffff01n);
}
if (numberOfDFGCompiles(mixedSpeculationNegateBigInt) > 1)
throw "Failed negateBigInt(). We should have compiled a single negate for the BigInt type.";