shape_regen.js (628B)
1 // Try to test that we handle shape regeneration correctly. 2 // This is a fragile test, but as of this writing, on dmandelin's 3 // windows box, we have the same shape number with different 4 // logical shapes in the two assertEq lines. 5 6 var o; 7 var p; 8 var zz; 9 var o2; 10 11 function f(x) { 12 return x.a; 13 } 14 15 gczeal(1); 16 gc(); 17 18 zz = { q: 11 }; 19 o = { a: 77, b: 88 }; 20 o2 = { c: 11 }; 21 p = { b: 99, a: 11 }; 22 23 //print('s ' + shapeOf(zz) + ' ' + shapeOf(o) + ' ' + shapeOf(o2) + ' ' + shapeOf(p)); 24 25 assertEq(f(o), 77); 26 27 o = undefined; 28 29 gczeal(1); 30 gc(); 31 //print('s ' + 'x' + ' ' + shapeOf(p)); 32 33 assertEq(f(p), 11);