js/src/jit-test/tests/ion/getPropertyCacheOverflow.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/ion/getPropertyCacheOverflow.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,37 @@
     1.4 +// This test was made to be effective with --no-jm.
     1.5 +
     1.6 +var list = [
     1.7 +  { entry00: 0, length: 1 },
     1.8 +  { entry01: 0, length: 1 },
     1.9 +  { entry02: 0, length: 1 },
    1.10 +  { entry03: 0, length: 1 },
    1.11 +  { entry04: 0, length: 1 },
    1.12 +  { entry05: 0, length: 1 },
    1.13 +  { entry06: 0, length: 1 },
    1.14 +  { entry07: 0, length: 1 },
    1.15 +  { entry08: 0, length: 1 },
    1.16 +  { entry09: 0, length: 1 },
    1.17 +  { entry10: 0, length: 1 },
    1.18 +  { entry11: 0, length: 1 },
    1.19 +  { entry12: 0, length: 1 },
    1.20 +  { entry13: 0, length: 1 },
    1.21 +  { entry14: 0, length: 1 },
    1.22 +  { entry15: 0, length: 1 },
    1.23 +  { entry16: 0, length: 1 }, // cause an overflow.
    1.24 +  { entry17: 0, length: 1 },
    1.25 +  [0],
    1.26 +  (new Uint8Array(new ArrayBuffer(1)))
    1.27 +];
    1.28 +
    1.29 +function f(obj) {
    1.30 +    return obj.length;
    1.31 +}
    1.32 +
    1.33 +// Cook the f function on the top of the list to make sure we do not register
    1.34 +// our test cases.
    1.35 +for (var i = 0; i < 100; i++)
    1.36 +    f(list[i % 10]);
    1.37 +
    1.38 +// Register & check stubs.
    1.39 +for (var i = 0; i < 40; i++)
    1.40 +    assertEq(f(list[i % 20]), 1);

mercurial