js/src/jit-test/tests/basic/testMethodWriteBarrier3.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/basic/testMethodWriteBarrier3.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,27 @@
     1.4 +function g() {}
     1.5 +
     1.6 +function h() {
     1.7 +    for (var i = 0; i < 9; i++)
     1.8 +	x.f = i;
     1.9 +}
    1.10 +
    1.11 +function j() {
    1.12 +    x.f();
    1.13 +}
    1.14 +
    1.15 +var x = {f: 0.7, g: g};
    1.16 +x.g();  // interpreter brands x
    1.17 +h();
    1.18 +print(shapeOf(x));
    1.19 +x.f = function (){}; // does not change x's shape
    1.20 +j();
    1.21 +print(shapeOf(x));
    1.22 +h(); // should change x's shape
    1.23 +
    1.24 +var thrown = 'none';
    1.25 +try {
    1.26 +    j(); // should throw since x.f === 8
    1.27 +} catch (exc) {
    1.28 +    thrown = exc.name;
    1.29 +}
    1.30 +assertEq(thrown, 'TypeError');
    1.31 \ No newline at end of file

mercurial