mirror of https://github.com/tc39/test262.git
[javascriptcore-test262-automation] Changes from https://github.com/webkit/webkit.git at sha 5ec2ecf1e4 on Thu Nov 08 2018 18:51:29 GMT+0000 (Coordinated Universal Time)
This commit is contained in:
parent
678b6b656b
commit
6059c1c526
|
@ -0,0 +1,48 @@
|
|||
//@ 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 mixedSpeculationNegateBigInt(). We should have compiled a single negate for the BigInt type.";
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
//@ runBigIntEnabled
|
||||
|
||||
function assert(v, e) {
|
||||
if (v !== e)
|
||||
throw new Error("Expected value: " + e + " but got: " + v)
|
||||
}
|
||||
|
||||
function bigIntOperations(a, b) {
|
||||
let c = a + b;
|
||||
return a + c;
|
||||
}
|
||||
noInline(bigIntOperations);
|
||||
|
||||
for (let i = 0; i < 100000; i++) {
|
||||
let out = bigIntOperations(0b1111n, "16");
|
||||
assert(out, "151516");
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
//@ runBigIntEnabled
|
||||
|
||||
function assert(v, e) {
|
||||
if (v !== e)
|
||||
throw new Error("Expected value: " + e + " but got: " + v)
|
||||
}
|
||||
|
||||
function bigIntPropagation(a, b) {
|
||||
let c = a + b;
|
||||
return c + 0n;
|
||||
}
|
||||
noInline(bigIntPropagation);
|
||||
|
||||
for (let i = 0; i < 100000; i++) {
|
||||
let out = bigIntPropagation(0xffffffffffffffffffffffffffffffn, 0x1n);
|
||||
assert(out, 0x1000000000000000000000000000000n)
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
//@ runBigIntEnabled
|
||||
|
||||
function assert(v, e) {
|
||||
if (v !== e)
|
||||
throw new Error("Expected value: " + e + " but got: " + v)
|
||||
}
|
||||
|
||||
function bigIntOperations(a, b) {
|
||||
let c = a + b;
|
||||
return a + c;
|
||||
}
|
||||
noInline(bigIntOperations);
|
||||
|
||||
c = 0;
|
||||
let o = { valueOf: function () {
|
||||
c++;
|
||||
return 0b1111n;
|
||||
}};
|
||||
|
||||
for (let i = 0; i < 100000; i++) {
|
||||
let out = bigIntOperations(o, 0b1010n);
|
||||
assert(out, 40n);
|
||||
}
|
||||
|
||||
assert(c, 200000);
|
||||
|
Loading…
Reference in New Issue