Merge pull request #1940 from test262-automation/javascriptcore-test262-automation-export-81663e4556

Import test changes from JavaScriptCore
This commit is contained in:
Rick Waldron 2018-11-08 15:12:25 -05:00 committed by GitHub
commit deea398316
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 112 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"sourceRevisionAtLastExport": "5ec2ecf1e4",
"targetRevisionAtLastExport": "81663e4556",
"sourceRevisionAtLastExport": "b85a66fba6",
"targetRevisionAtLastExport": "6059c1c526",
"curatedFiles": {
"/stress/Number-isNaN-basics.js": "DELETED_IN_TARGET",
"/stress/Object_static_methods_Object.getOwnPropertyDescriptors-proxy.js": "DELETED_IN_TARGET",

View File

@ -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.";

View File

@ -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");
}

View File

@ -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)
}

View File

@ -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);