nashorn/test/script/basic/runsunspider.js
author lagergren
Thu, 17 Apr 2014 20:01:19 +0200
changeset 24740 26791be09688
parent 24719 f726e9d67629
child 24743 138ee369abd8
permissions -rw-r--r--
8040089: Apply to call transform was incomplete. Now passes all tests and performance is back Reviewed-by: hannesw, attila, sundar, jlaskey
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
16147
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
     1
/*
16151
97c1e756ae1e 8005663: Update copyright year to 2013
jlaskey
parents: 16147
diff changeset
     2
 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
16147
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
     4
 *
16147
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
     7
 * published by the Free Software Foundation.
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
     8
 *
16147
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    13
 * accompanied this code).
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
    14
 *
16147
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
    18
 *
16147
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    21
 * questions.
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    22
 */
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    23
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    24
/**
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    25
 * runsunspider : runs the sunspider tests and checks for compliance
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    26
 *
16525
1409942e618e 8009982: Lazy execution bugfix. Added lazy sunspider unit test. Added mandreel to compile-octane test. Fixed warnings
lagergren
parents: 16164
diff changeset
    27
 * @subtest
16147
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    28
 */
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    29
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    30
/**
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    31
 * This is not a test, but a test "framework" for running sunspider tests.
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    32
 */
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    33
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    34
function assertEq(a, b) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    35
    if (a !== b) {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
    36
        throw "ASSERTION FAILED: " + a + " should be " + b;
16147
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    37
    }
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    38
}
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    39
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    40
function pprint(x) {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    41
    if (verbose_run) {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    42
	print(x);
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    43
    }
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    44
}
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    45
16147
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    46
var runs = 0;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    47
var total_time = 0;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    48
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    49
function runbench(name) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    50
    var filename = name.split("/").pop();
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    51
    pprint("Running (warmup/sanity) " + filename);
16147
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    52
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    53
    var start = new Date;
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    54
    load(name);
16147
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    55
    var stop = new Date - start;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    56
    total_time += stop;
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
    57
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    58
    pprint(filename + " done in " + stop + " ms");
16147
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    59
    runs++;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    60
}
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
    61
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    62
var m_w;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    63
var m_z;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    64
var MAXINT;
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
    65
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
    66
//produce deterministic random numbers for test suite
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
    67
function pseudorandom() {
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
    68
    m_z = 36969 * (m_z & 65535) + (m_z >> 16);
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
    69
    m_w = 18000 * (m_w & 65535) + (m_w >> 16);
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
    70
    return (Math.abs((m_z << 16) + m_w) & MAXINT) / MAXINT;
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
    71
}
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
    72
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    73
function initrandom() {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    74
    m_w = 4711;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    75
    m_z = 17;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    76
    MAXINT = 0x7fffffff;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    77
    Math.random = pseudorandom;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    78
}
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    79
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    80
var rtimes = 0;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    81
var dir = (typeof(__DIR__) == 'undefined') ? "test/script/basic/" : __DIR__;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    82
var single;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    83
var verbose_run = false;
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
    84
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    85
var args = [];
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    86
if (typeof $ARGS !== 'undefined') {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    87
    args = $ARGS;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    88
} else if (typeof arguments !== 'undefined' && arguments.length != 0) {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    89
    args = arguments;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    90
}
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    91
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    92
for (var i = 0; i < args.length; i++) {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    93
    if (args[i] === '--verbose') {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    94
        verbose_run = true;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    95
    } else if (args[i] === '--times') {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    96
	i++;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    97
	rtimes = +args[i];
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    98
    } else if (args[i] === '--single') {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
    99
	i++;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   100
	single = args[i];
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   101
    }
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   102
}
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   103
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   104
function runsuite(tests) {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   105
    var changed   = false;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   106
    var res       = [];
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   107
    var oldRandom = Math.random;
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   108
16147
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   109
    try {
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   110
	for (var n = 0; n < tests.length; n++) {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   111
            path = dir + '../external/sunspider/tests/sunspider-1.0.2/' + tests[n].name
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   112
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   113
	    initrandom();
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   114
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   115
	    var dd = new Date;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   116
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   117
            runbench(path);
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   118
            if (typeof tests[n].actual !== 'undefined') {
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   119
                assertEq(tests[n].actual(), tests[n].expected());
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   120
            }
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   121
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   122
	    if (typeof tests[n].rerun !== 'undefined' && tests[n].times > 0) {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   123
		pprint("rerunning " + tests[n].name + " " + tests[n].times + " times...");
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   124
		var times = 0;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   125
		var to = tests[n].times;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   126
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   127
		var elemsPerPercent = to / 100;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   128
		var po = 0|(to / 10);
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   129
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   130
		times = 0;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   131
		for (; times < to; times++) {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   132
		    initrandom();
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   133
		    tests[n].rerun();
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   134
		    if ((times % (po|0)) == 0) {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   135
			pprint(times/to * 100 + "%");
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   136
		    }		    
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   137
		}
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   138
	    }
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   139
	    
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   140
	    var t = new Date - dd;		    
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   141
	    pprint("time: " + t + " ms");
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   142
	    if (typeof tests[n].actual !== 'undefined') {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   143
		assertEq(tests[n].actual(), tests[n].expected());		    			
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   144
	    }
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   145
	    res.push(t);
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   146
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   147
	    pprint("");
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   148
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   149
            changed = true;
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   150
        }
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   151
    } catch (e) {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   152
	print("FAIL!");
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   153
	throw e;
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   154
        // no scripting or something, silently fail
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   155
    } finally {
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   156
	Math.random = oldRandom;
16147
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   157
    }
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   158
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   159
    for (var n = 0; n < tests.length; n++) {	
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   160
	
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   161
	var time = "" + res[n];
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   162
	while (time.length < 4) {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   163
	    time = " " + time;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   164
	}
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   165
	time += " ms";
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   166
	if (res[n] == -1) {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   167
	    time = "<couldn't be rerun>";
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   168
	}
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   169
	var str = tests[n].name;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   170
	for (var spaces = str.length; spaces < 32; spaces++) {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   171
	    str += " ";
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   172
	}
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   173
	str += " ";
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   174
	str += time;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   175
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   176
	if (tests[n].times > 0) {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   177
	    str += " [";
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   178
	    str += tests[n].times + " reruns]";
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   179
	} 
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   180
	pprint(str);
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   181
    }
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   182
16147
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   183
    return changed;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   184
}
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   185
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   186
function hash(str) {
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   187
    var s = "" + str;
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   188
    var h = 0;
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   189
    var off = 0;
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   190
    for (var i = 0; i < s.length; i++) {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   191
        h = 31 * h + s.charCodeAt(off++);
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   192
        h &= 0x7fffffff;
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   193
    }
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   194
    return h ^ s.length;
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   195
}
16147
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   196
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   197
var tests = [
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   198
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   199
    { name: 'regexp-dna.js',
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   200
      actual: function() {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   201
	  return dnaOutputString + dnaInput;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   202
      },      
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   203
      expected: function() {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   204
	  return expectedDNAOutputString + expectedDNAInput;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   205
      },
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   206
    },      
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   207
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   208
    { name: 'string-base64.js',
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   209
      actual: function() {
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   210
          return hash(str);
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   211
      },
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   212
      expected: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   213
          return 1544571068;
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   214
      },
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   215
      times: rtimes,
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   216
      rerun: function() {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   217
	  toBinaryTable = [
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   218
		  -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   219
		  -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   220
		  -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,62, -1,-1,-1,63,
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   221
	          52,53,54,55, 56,57,58,59, 60,61,-1,-1, -1, 0,-1,-1,
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   222
		  -1, 0, 1, 2,  3, 4, 5, 6,  7, 8, 9,10, 11,12,13,14,
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   223
	           15,16,17,18, 19,20,21,22, 23,24,25,-1, -1,-1,-1,-1,
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   224
		  -1,26,27,28, 29,30,31,32, 33,34,35,36, 37,38,39,40,
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   225
	          41,42,43,44, 45,46,47,48, 49,50,51,-1, -1,-1,-1,-1
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   226
	  ];   
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   227
	  var str = "";	  
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   228
	  for (var i = 0; i < 8192; i++)
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   229
              str += String.fromCharCode((25 * Math.random()) + 97);
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   230
	  
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   231
	  for (var i = 8192; i <= 16384; i *= 2) {	      
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   232
	      var base64;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   233
	      base64 = toBase64(str);
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   234
	      var encoded = base64ToString(base64);
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   235
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   236
	      str += str;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   237
	  }
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   238
	  toBinaryTable = null;
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   239
      }
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   240
    },
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   241
    { name: 'date-format-xparb.js',
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   242
      actual: function() {
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   243
          return shortFormat + longFormat;
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   244
      },
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   245
      expected: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   246
          return "2017-09-05Tuesday, September 05, 2017 8:43:48 AM";
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   247
      },
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   248
      times: rtimes,
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   249
      rerun: function() {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   250
	  date = new Date("1/1/2007 1:11:11");	  
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   251
	  for (i = 0; i < 4000; ++i) {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   252
	      var shortFormat = date.dateFormat("Y-m-d");
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   253
	      var longFormat = date.dateFormat("l, F d, Y g:i:s A");
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   254
	      date.setTime(date.getTime() + 84266956);
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   255
	  }
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   256
      }
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   257
	  
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   258
    },
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   259
    { name: 'string-validate-input.js',
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   260
      actual: function() {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   261
          return hash(endResult);
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   262
      },
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   263
      expected: function() {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   264
          return 726038055;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   265
      },
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   266
      times: rtimes,
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   267
      rerun: function() {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   268
	  doTest();
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   269
      },	 
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   270
    },
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   271
    { name: '3d-morph.js',
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   272
      actual: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   273
          var acceptableDelta = 4e-15;
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   274
          return (testOutput - 6.394884621840902e-14) < acceptableDelta;
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   275
      },
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   276
      expected: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   277
          return true;
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   278
      },
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   279
      times: rtimes,
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   280
      rerun: function() {	  
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   281
	  a = Array()
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   282
	  for (var i=0; i < nx*nz*3; ++i) 
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   283
	      a[i] = 0
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   284
	  for (var i = 0; i < loops; ++i) {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   285
	      morph(a, i/loops)
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   286
	  }
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   287
	  testOutput = 0;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   288
	  for (var i = 0; i < nx; i++)
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   289
	      testOutput += a[3*(i*nx+i)+1];
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   290
	  a = null;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   291
	  
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   292
      }
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   293
    },
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   294
    { name: 'crypto-aes.js',
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   295
      actual: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   296
          return plainText;
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   297
      },
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   298
      expected: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   299
          return decryptedText;
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   300
      },
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   301
      times: rtimes,
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   302
      rerun: function() {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   303
	  cipherText = AESEncryptCtr(plainText, password, 256);
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   304
	  decryptedText = AESDecryptCtr(cipherText, password, 256);
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   305
	  
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   306
      }
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   307
    },
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   308
    { name: 'crypto-md5.js',
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   309
      actual: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   310
          return md5Output;
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   311
      },
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   312
      expected: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   313
          return "a831e91e0f70eddcb70dc61c6f82f6cd";
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   314
      },
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   315
      times: rtimes,
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   316
      rerun: function() {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   317
	  md5Output = hex_md5(plainText);
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   318
      }
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   319
    },
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   320
    
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   321
    { name: 'crypto-sha1.js',
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   322
      actual: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   323
          return sha1Output;
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   324
      },
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   325
      expected: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   326
          return "2524d264def74cce2498bf112bedf00e6c0b796d";
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   327
      },
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   328
      times: rtimes,
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   329
      rerun: function() {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   330
	  sha1Output = hex_sha1(plainText);	  
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   331
      }
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   332
    },
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   333
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   334
    { name: 'bitops-bitwise-and.js',
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   335
      actual: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   336
          return result;
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   337
      },
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   338
      expected: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   339
          return 0;
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   340
      },
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   341
      times: rtimes,
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   342
      rerun: function() {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   343
	  bitwiseAndValue = 4294967296;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   344
	  for (var i = 0; i < 600000; i++) {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   345
	      bitwiseAndValue = bitwiseAndValue & i;	  
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   346
	  }
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   347
	  result = bitwiseAndValue;
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   348
      }
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   349
    },
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   350
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   351
    { name: 'bitops-bits-in-byte.js',
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   352
      actual: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   353
          return result;
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   354
      },
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   355
      expected: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   356
          return 358400;
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   357
      },
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   358
      times: rtimes,
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   359
      rerun: function() {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   360
	  result = TimeFunc(bitsinbyte);
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   361
      }
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   362
    },
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   363
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   364
    { name: 'bitops-nsieve-bits.js',
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   365
      actual: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   366
          var ret = 0;
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   367
          for (var i = 0; i < result.length; ++i) {
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   368
              ret += result[i];
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   369
          }
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   370
          ret += result.length;
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   371
          return ret;
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   372
      },
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   373
      expected: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   374
          return -1286749539853;
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   375
      },
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   376
      times: rtimes,
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   377
      rerun: function() {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   378
	  result = sieve();
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   379
      }
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   380
    },
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   381
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   382
    { name: 'bitops-3bit-bits-in-byte.js',
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   383
      actual: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   384
          return sum;
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   385
      },
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   386
      expected: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   387
          return 512000;
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   388
      },
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   389
      times: rtimes,
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   390
      rerun: function() {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   391
	  sum = TimeFunc(fast3bitlookup);	 
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   392
      }
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   393
    },
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   394
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   395
    { name: 'access-nbody.js',
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   396
      actual: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   397
          return ret;
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   398
      },
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   399
      expected: function() {
20947
ab64f6cdcad0 8026498: Revert: latest runsunspider.js tests contains several bugs
jlaskey
parents: 20942
diff changeset
   400
            return -1.3524862408537381;
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   401
      },
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   402
      times: rtimes,
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   403
      rerun: function() {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   404
	  var ret = 0;	  
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   405
	  for (var n = 3; n <= 24; n *= 2) {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   406
	      (function(){
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   407
		  var bodies = new NBodySystem( Array(
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   408
		      Sun(),Jupiter(),Saturn(),Uranus(),Neptune()
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   409
		  ));
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   410
		  var max = n * 100;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   411
		  
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   412
		  ret += bodies.energy();
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   413
		  for (var i=0; i<max; i++){
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   414
		      bodies.advance(0.01);
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   415
		  }
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   416
		  ret += bodies.energy();
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   417
	      })();
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   418
	  }
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   419
      }
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   420
    },
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   421
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   422
    { name: 'access-binary-trees.js',
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   423
      actual: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   424
          return ret;
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   425
      },
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   426
      expected: function() {
20947
ab64f6cdcad0 8026498: Revert: latest runsunspider.js tests contains several bugs
jlaskey
parents: 20942
diff changeset
   427
          return -4;
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   428
      },
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   429
      times: rtimes,
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   430
      rerun: function() {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   431
	  ret = 0;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   432
	  
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   433
	  for (var n = 4; n <= 7; n += 1) {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   434
	      var minDepth = 4;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   435
	      var maxDepth = Math.max(minDepth + 2, n);
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   436
	      var stretchDepth = maxDepth + 1;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   437
	      
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   438
	      var check = bottomUpTree(0,stretchDepth).itemCheck();
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   439
	      
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   440
	      var longLivedTree = bottomUpTree(0,maxDepth);
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   441
	      for (var depth=minDepth; depth<=maxDepth; depth+=2){
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   442
		  var iterations = 1 << (maxDepth - depth + minDepth);
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   443
		  
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   444
		  check = 0;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   445
		  for (var i=1; i<=iterations; i++){
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   446
		      check += bottomUpTree(i,depth).itemCheck();
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   447
		      check += bottomUpTree(-i,depth).itemCheck();
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   448
		  }
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   449
	      }
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   450
	      
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   451
	      ret += longLivedTree.itemCheck();
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   452
	  }
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   453
      }
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   454
    },
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   455
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   456
    { name: 'access-fannkuch.js',
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   457
      actual: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   458
          return ret;
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   459
      },
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   460
      expected: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   461
          return 22;
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   462
      },
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   463
      times: rtimes,
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   464
      rerun: function() {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   465
	  n = 8;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   466
	  ret = fannkuch(n);	  
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   467
      }
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   468
    },
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   469
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   470
    { name: 'math-spectral-norm.js',
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   471
      actual: function() {
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   472
          var ret = '';
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   473
          for (var i = 6; i <= 48; i *= 2) {
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   474
              ret += spectralnorm(i) + ',';
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   475
          }
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   476
          return ret;
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   477
      },
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   478
      expected: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   479
          return "1.2657786149754053,1.2727355112619148,1.273989979775574,1.274190125290389,";
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   480
      },
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   481
      times: rtimes,
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   482
      rerun: function() {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   483
	  total = 0;	  
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   484
	  for (var i = 6; i <= 48; i *= 2) {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   485
	      total += spectralnorm(i);
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   486
	  }
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   487
      }
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   488
    },
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   489
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   490
    { name: '3d-raytrace.js',
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   491
      actual: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   492
          return hash(testOutput);
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   493
      },
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   494
      expected: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   495
          return 230692593;
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   496
      },
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   497
      times: rtimes,
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   498
      rerun: function() {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   499
	  testOutput = arrayToCanvasCommands(raytraceScene());	  
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   500
      }
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   501
    },
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   502
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   503
    { name: 'math-cordic.js',
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   504
      actual: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   505
          return total;
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   506
      },
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   507
      expected: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   508
          return 10362.570468755888;
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   509
      },
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   510
      times: rtimes,
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   511
      rerun: function() {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   512
	  total = 0;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   513
	  cordic(25000);
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   514
      }
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   515
    },
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   516
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   517
    { name: 'controlflow-recursive.js',
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   518
      actual: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   519
          var ret = 0;
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   520
          for (var i = 3; i <= 5; i++) {
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   521
              ret += ack(3,i);
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   522
              ret += fib(17.0+i);
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   523
              ret += tak(3*i+3,2*i+2,i+1);
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   524
          }
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   525
          return ret;
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   526
      },
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   527
      expected: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   528
          return 57775;
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   529
      },
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   530
      times: rtimes,
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   531
      rerun: function() {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   532
	  result = 0;	  
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   533
	  for (var i = 3; i <= 5; i++) {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   534
	      result += ack(3,i);
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   535
	      result += fib(17.0+i);
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   536
	      result += tak(3*i+3,2*i+2,i+1);
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   537
	  }
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   538
      }
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   539
    },
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   540
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   541
    { name: 'date-format-tofte.js',
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   542
      actual: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   543
          return shortFormat + longFormat;
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   544
      },
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   545
      expected: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   546
          return "2008-05-01Thursday, May 01, 2008 6:31:22 PM";
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   547
      },
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   548
      times: rtimes,
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   549
      rerun: function() {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   550
	  date = new Date("1/1/2007 1:11:11");	  
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   551
	  for (i = 0; i < 500; ++i) {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   552
	      var shortFormat = date.formatDate("Y-m-d");
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   553
	      var longFormat = date.formatDate("l, F d, Y g:i:s A");
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   554
	      date.setTime(date.getTime() + 84266956);
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   555
	  }
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   556
      }
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   557
    },
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   558
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   559
    { name: 'string-tagcloud.js',
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   560
      actual: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   561
          // The result string embeds floating-point numbers, which can vary a bit on different platforms,
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   562
          // so we truncate them a bit before comparing.
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   563
          var tagcloud_norm = tagcloud.replace(/([0-9.]+)px/g, function(str, p1) { return p1.substr(0, 10) + 'px' })
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   564
          return tagcloud_norm.length;
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   565
      },
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   566
      expected: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   567
          return 295906;
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   568
      },
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   569
      times: rtimes,
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   570
      rerun: function() {	  
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   571
	  tagInfo = tagInfoJSON.parseJSON(function(a, b) { if (a == "popularity") { return Math.log(b) / log2; } else {return b; } });
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   572
	  tagcloud = makeTagCloud(tagInfo);
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   573
      }
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   574
    },
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   575
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   576
    { name: 'math-partial-sums.js',
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   577
      actual: function() {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   578
	  return total;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   579
      },
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   580
      expected: function() {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   581
	  return 60.08994194659945;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   582
      },
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   583
      times: rtimes,
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   584
      rerun: function() {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   585
	  total = 0;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   586
	  for (var i = 1024; i <= 16384; i *= 2) {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   587
	      total += partial(i);
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   588
	  }
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   589
      }
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   590
    },
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   591
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   592
    { name: 'access-nsieve.js',
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   593
      actual: function() {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   594
	  return result;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   595
      },
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   596
      expected: function() {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   597
	  return 14302;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   598
      },
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   599
      times: rtimes,
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   600
      rerun: function() {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   601
	  result = sieve();
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   602
      }      
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   603
    },
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   604
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   605
    { name: '3d-cube.js',
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   606
      times: rtimes,
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   607
      rerun: function() {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   608
	  Q = new Array();
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   609
	  MTrans = new Array();  // transformation matrix
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   610
	  MQube = new Array();  // position information of qube
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   611
	  I = new Array();      // entity matrix
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   612
	  Origin = new Object();
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   613
	  Testing = new Object();	  
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   614
	  for ( var i = 20; i <= 160; i *= 2 ) {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   615
	      Init(i);
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   616
	  }
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   617
      }
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   618
    },
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   619
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   620
    //TODO no easy way to sanity check result
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   621
    { name: 'string-fasta.js',
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   622
      times: rtimes,
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   623
      rerun: function() {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   624
	  ret = 0;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   625
	  count = 7;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   626
	  fastaRepeat(2*count*100000, ALU);
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   627
	  fastaRandom(3*count*1000, IUB);
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   628
	  fastaRandom(5*count*1000, HomoSap);
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   629
      }
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   630
    },      
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   631
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   632
    //TODO no easy way to sanity check result
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   633
    { name: 'string-unpack-code.js',
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   634
      actual: function() {
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   635
          return decompressedMochiKit.length == 106415 &&
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   636
              decompressedMochiKit[2000] == '5' &&
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   637
              decompressedMochiKit[12000] == '_' &&
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   638
              decompressedMochiKit[82556] == '>';
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   639
      },
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   640
      expected: function() {
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   641
	  return true;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   642
      },
19104
6fe18e748f74 8021321: Two runsunspider tests fail after updating sunspider to 1.0
jlaskey
parents: 17518
diff changeset
   643
    },
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   644
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   645
];
16147
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   646
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   647
tests.sort(function(a,b) { return a.name.localeCompare(b.name); });
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   648
if (typeof single !== 'undefined') {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   649
    for (i in tests) {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   650
	if (tests[i].name === single) {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   651
	    singleTest = tests[i];
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   652
	    tests = [singleTest];
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   653
	    break;
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   654
	}
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   655
    }
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   656
    if (tests.length != 1) {
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   657
	throw "unknown single test '" + single + "'";
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   658
    }
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   659
}
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   660
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   661
16147
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   662
// handle the case this script may be run by a JS engine that doesn't
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   663
// support __DIR__ global variable.
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   664
16164
1899aada11f8 8005971: runsunspider.js should check results of benchmarks
lagergren
parents: 16163
diff changeset
   665
runsuite(tests);
16147
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   666
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents: 20947
diff changeset
   667
pprint('\n' + runs + "/" + tests.length + " tests were successfully run in " + total_time + " ms ");
16147
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   668
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   669
print("Sunspider finished!");