test262/implementation-contributed/javascriptcore/stress/value-sub-spec-none-case.js

23 lines
412 B
JavaScript

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