blob: 8bf01d96903fc5f2111e1a6b3c399999e68cfce5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
// This forces the VM to start creating unboxed objects and thus stresses a
// particular path into generated code for a specialized unboxed object
// constructor.
var K = 2000; // 2000 should be plenty
var s = "[";
var i;
for ( i=0; i < K-1; i++ )
s = s + `{"i":${i}},`;
s += `{"i":${i}}]`;
var v = JSON.parse(s);
assertEq(v.length == K, true);
for ( i=0; i < K; i++) {
assertEq(v[i] instanceof Object, true);
assertEq(v[i].i, i);
}
|