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

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 function testChangingObjectWithLength()
     2 {
     3   var obj = { length: 10 };
     4   var dense = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
     5   var slow = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; slow.slow = 5;
     7   /*
     8    * The elements of objs constitute a De Bruijn sequence repeated 4x to trace
     9    * and run native code for every object and transition.
    10    */
    11   var objs = [obj, obj, obj, obj,
    12               obj, obj, obj, obj,
    13               dense, dense, dense, dense,
    14               obj, obj, obj, obj,
    15               slow, slow, slow, slow,
    16               dense, dense, dense, dense,
    17               dense, dense, dense, dense,
    18               slow, slow, slow, slow,
    19               slow, slow, slow, slow,
    20               obj, obj, obj, obj];
    22   var counter = 0;
    24   for (var i = 0, sz = objs.length; i < sz; i++)
    25   {
    26     var o = objs[i];
    27     for (var j = 0; j < o.length; j++)
    28       counter++;
    29   }
    31   return counter;
    32 }
    33 assertEq(testChangingObjectWithLength(), 400);

mercurial