mirror of https://github.com/tc39/test262.git
[javascriptcore-test262-automation] Changes from https://github.com/webkit/webkit.git at sha 5bbf629de8 on Fri Oct 19 2018 18:41:28 GMT+0000 (Coordinated Universal Time)
This commit is contained in:
parent
3936950114
commit
ef17eeedb5
|
@ -0,0 +1,19 @@
|
||||||
|
//@ runBigIntEnabled
|
||||||
|
|
||||||
|
let assert = {
|
||||||
|
sameValue: function(i, e, m) {
|
||||||
|
if (i !== e)
|
||||||
|
throw new Error(m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function bigIntAddition(x, y) {
|
||||||
|
return x - y - 1n;
|
||||||
|
}
|
||||||
|
noInline(bigIntAddition);
|
||||||
|
|
||||||
|
for (let i = 0; i < 10000; i++) {
|
||||||
|
let r = bigIntAddition(3n, 10n);
|
||||||
|
assert.sameValue(r, -8n, 3n + " - " + 10n + " - 1 = " + r);
|
||||||
|
}
|
||||||
|
|
|
@ -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, 0xfffffffffffffffffffffffffffffen)
|
||||||
|
}
|
||||||
|
|
|
@ -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, 10n);
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(c, 200000);
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
function assert(a, e) {
|
||||||
|
if (a !== e)
|
||||||
|
throw new Error("Bad");
|
||||||
|
}
|
||||||
|
|
||||||
|
function valueSub() {
|
||||||
|
let sum = 0;
|
||||||
|
do {
|
||||||
|
// We trigger the JIT compilation of valueSub
|
||||||
|
// so Date.now() will have SpecNone as result
|
||||||
|
for (let i = 0; i < 10000; i++)
|
||||||
|
sum++;
|
||||||
|
|
||||||
|
sum += 0.5;
|
||||||
|
} while (Date.now() - sum < 0);
|
||||||
|
|
||||||
|
assert(sum, 10000.5);
|
||||||
|
}
|
||||||
|
noInline(valueSub);
|
||||||
|
|
||||||
|
valueSub();
|
||||||
|
|
Loading…
Reference in New Issue