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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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