js/src/jit-test/tests/ion/mathFloor.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 // Test Math.floor() for IonMonkey.
     2 // Requires --ion-eager to enter at the top of each loop.
     4 var floorDTests = [
     5 	[-0, -0],
     6 	[0.49999999999999997, 0],
     7 	[0.5, 0],
     8 	[1.0, 1],
     9 	[1.5, 1],
    10 	[792.8, 792],
    11 	[-0.1, -1],
    12 	[-1.0001, -2],
    13 	[-3.14, -4],
    14 	[2137483649.5, 2137483649],
    15 	[2137483648.5, 2137483648],
    16 	[2137483647.1, 2137483647],
    17 	[900000000000, 900000000000],
    18 	[-0, -0],
    19 	[-Infinity, -Infinity],
    20 	[Infinity, Infinity],
    21 	[NaN, NaN],
    22 	[-2147483648.8, -2147483649],
    23 	[-2147483649.8, -2147483650]
    24 ];
    26 var floorITests = [
    27 	[0, 0],
    28 	[4, 4],
    29 	[-1, -1],
    30 	[-7, -7],
    31 	[2147483648, 2147483648],
    32 	[-2147483649, -2147483649]
    33 ];
    35 // Typed functions to be compiled by Ion.
    36 function floorD(x) { return Math.floor(x); }
    37 function floorI(x) { return Math.floor(x); }
    39 function test() {
    40 	// Always run this function in the interpreter.
    41 	try {} catch (e) {}
    43 	for (var i = 0; i < floorDTests.length; i++)
    44 		assertEq(floorD(floorDTests[i][0]), floorDTests[i][1]);
    45 	for (var i = 0; i < floorITests.length; i++)
    46 		assertEq(floorI(floorITests[i][0]), floorITests[i][1]);
    47 }
    49 for (var i = 0; i < 40; i++)
    50 	test();

mercurial