Page MenuHomePhorge

repro_nan4.js
No OneTemporary

Size
875 B
Referenced Files
None
Subscribers
None

repro_nan4.js

// Test: many SHORT calls to trigger call_count JIT (not OSR back-edge)
function test_short(n) {
function f(a) { sum++; }
var j, sum;
sum = 0;
for (j = 0; j < n; j++) { f(j); }
return n;
}
// Call with small n many times to trigger call_count threshold
var fails = 0;
for (var i = 0; i < 200; i++) {
var result = test_short(5);
if (result !== 5) {
if (fails < 3) console.log("FAIL iter " + i + ": test_short(5) = " + result);
fails++;
}
}
console.log("call_count path: " + (fails > 0 ? fails + " failures" : "PASS"));
// Now test with large n to trigger OSR
fails = 0;
for (var i = 0; i < 20; i++) {
var n = 2000;
var result = test_short(n);
if (result !== n) {
if (fails < 3) console.log("FAIL iter " + i + ": test_short(" + n + ") = " + result);
fails++;
}
}
console.log("OSR path: " + (fails > 0 ? fails + " failures" : "PASS"));

File Metadata

Mime Type
text/plain
Expires
Wed, Jun 17, 11:53 AM (1 d, 22 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
537048
Default Alt Text
repro_nan4.js (875 B)

Event Timeline