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

73 lines
1.5 KiB
JavaScript

var basicBlockExecutionCount = $vm.basicBlockExecutionCount;
load("./driver/driver.js");
function noop() { ; }
function foo(num) {
for (let i = 0; i < num; i++) {
noop();
}
}
function a() { ; }
function b() { ; }
function baz(num) {
for (let i = 0; i < num; i++) {
i % 2 ? a() : b();
}
}
function jaz(num) {
for (let i = 0; i < num; i++) {
if (i % 2)
a();
else
b();
}
}
function testWhile(num) {
let i = num;
while (i--) {
noop();
if (i % 2)
a();
else
b();
}
}
foo(120);
assert(basicBlockExecutionCount(foo, "noop()") === 120);
noop();
assert(basicBlockExecutionCount(noop, ";") === 121);
baz(140);
assert(basicBlockExecutionCount(baz, "a()") === 140/2);
assert(basicBlockExecutionCount(baz, "b()") === 140/2);
assert(basicBlockExecutionCount(a, ";") === 140/2);
assert(basicBlockExecutionCount(b, ";") === 140/2);
jaz(140);
assert(basicBlockExecutionCount(jaz, "a()") === 140/2);
assert(basicBlockExecutionCount(jaz, "b()") === 140/2);
testWhile(140);
assert(basicBlockExecutionCount(testWhile, "noop()") === 140);
assert(basicBlockExecutionCount(testWhile, "a()") === 140/2);
assert(basicBlockExecutionCount(testWhile, "b()") === 140/2);
if (is32BitPlatform()) {
function testMax() {
let j = 0;
let numIters = Math.pow(2, 32) + 10;
for (let i = 0; i < numIters; i++) {
j++;
}
}
testMax();
assert(basicBlockExecutionCount(testMax, "j++") === Math.pow(2, 32) - 1);
}