nashorn/test/script/basic/run-octane.js
author lagergren
Thu, 14 Mar 2013 14:49:55 +0100
changeset 16525 1409942e618e
parent 16201 889ddb179cdf
child 17774 0407501fa563
permissions -rw-r--r--
8009982: Lazy execution bugfix. Added lazy sunspider unit test. Added mandreel to compile-octane test. Fixed warnings Reviewed-by: 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.
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
     4
 * 
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.
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
     8
 * 
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).
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    14
 * 
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.
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    18
 * 
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
 * @subtest
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    26
 */
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    27
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    28
var tests = [
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    29
    "box2d.js",
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    30
    "code-load.js",
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    31
    "crypto.js", 
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    32
    "deltablue.js", 
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    33
    "earley-boyer.js", 
16525
1409942e618e 8009982: Lazy execution bugfix. Added lazy sunspider unit test. Added mandreel to compile-octane test. Fixed warnings
lagergren
parents: 16201
diff changeset
    34
    "gbemu.js",
1409942e618e 8009982: Lazy execution bugfix. Added lazy sunspider unit test. Added mandreel to compile-octane test. Fixed warnings
lagergren
parents: 16201
diff changeset
    35
    "mandreel.js",
16147
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    36
    "navier-stokes.js", 
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    37
    "pdfjs.js",
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    38
    "raytrace.js",
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    39
    "regexp.js", 
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    40
    "richards.js", 
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    41
    "splay.js" 
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    42
];
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    43
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    44
// hack, teardown breaks things defined in the global space, making it impossible
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    45
// to do multiple consecutive benchmark runs with the same harness. I think it's a bug
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    46
// that the setup and teardown aren't each others constructor and destructor but rather
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    47
// that the benchmarks rely on partial global state. For shame, Octane! 
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    48
var ignoreTeardown = [
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    49
    { name: "box2d.js" },
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    50
    { name: "gbemu.js" },
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    51
];
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    52
16525
1409942e618e 8009982: Lazy execution bugfix. Added lazy sunspider unit test. Added mandreel to compile-octane test. Fixed warnings
lagergren
parents: 16201
diff changeset
    53
1409942e618e 8009982: Lazy execution bugfix. Added lazy sunspider unit test. Added mandreel to compile-octane test. Fixed warnings
lagergren
parents: 16201
diff changeset
    54
//TODO mandreel can be compiled as a test, but not run multiple times unless modified to not have global state
1409942e618e 8009982: Lazy execution bugfix. Added lazy sunspider unit test. Added mandreel to compile-octane test. Fixed warnings
lagergren
parents: 16201
diff changeset
    55
var compileOnly = {
1409942e618e 8009982: Lazy execution bugfix. Added lazy sunspider unit test. Added mandreel to compile-octane test. Fixed warnings
lagergren
parents: 16201
diff changeset
    56
    "mandreel.js" : true
1409942e618e 8009982: Lazy execution bugfix. Added lazy sunspider unit test. Added mandreel to compile-octane test. Fixed warnings
lagergren
parents: 16201
diff changeset
    57
};
1409942e618e 8009982: Lazy execution bugfix. Added lazy sunspider unit test. Added mandreel to compile-octane test. Fixed warnings
lagergren
parents: 16201
diff changeset
    58
16147
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    59
var dir = (typeof(__DIR__) == 'undefined') ? "test/script/basic/" : __DIR__;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    60
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    61
// TODO: why is this path hard coded when it's defined in project properties?
16163
71f4cff209a9 8005940: provide ant targets to get and update external test scripts
sundar
parents: 16151
diff changeset
    62
var path = dir + "../external/octane/";
16147
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    63
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    64
var runtime = "";
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    65
var verbose = false;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    66
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    67
var numberOfIterations = 5;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    68
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    69
function endsWith(str, suffix) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    70
    return str.indexOf(suffix, str.length - suffix.length) !== -1;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    71
}
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    72
16525
1409942e618e 8009982: Lazy execution bugfix. Added lazy sunspider unit test. Added mandreel to compile-octane test. Fixed warnings
lagergren
parents: 16201
diff changeset
    73
function should_compile_only(name) {
1409942e618e 8009982: Lazy execution bugfix. Added lazy sunspider unit test. Added mandreel to compile-octane test. Fixed warnings
lagergren
parents: 16201
diff changeset
    74
    return (typeof compile_only !== 'undefined') || compileOnly[name] === true;
1409942e618e 8009982: Lazy execution bugfix. Added lazy sunspider unit test. Added mandreel to compile-octane test. Fixed warnings
lagergren
parents: 16201
diff changeset
    75
}
1409942e618e 8009982: Lazy execution bugfix. Added lazy sunspider unit test. Added mandreel to compile-octane test. Fixed warnings
lagergren
parents: 16201
diff changeset
    76
16147
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    77
function run_one_benchmark(arg, iters) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    78
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    79
    var file_name;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    80
    var file = arg.split('/');
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    81
    if (file.length == 1) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    82
        file = arg.split('\\');
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    83
    }    
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    84
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    85
    //trim off trailing path separators
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    86
    while (file[file.length - 1].indexOf(".js") == -1) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    87
	file.pop();
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    88
    }
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    89
    file_name = file[file.length - 1];
16201
889ddb179cdf 8007062: Split Lower up into Lower/Attr/FinalizeTypes. Integrate AccessSpecalizer into FinalizeTypes.
lagergren
parents: 16163
diff changeset
    90
16525
1409942e618e 8009982: Lazy execution bugfix. Added lazy sunspider unit test. Added mandreel to compile-octane test. Fixed warnings
lagergren
parents: 16201
diff changeset
    91
    var compile_and_return = should_compile_only(file_name);
1409942e618e 8009982: Lazy execution bugfix. Added lazy sunspider unit test. Added mandreel to compile-octane test. Fixed warnings
lagergren
parents: 16201
diff changeset
    92
    if (compile_and_return) {
1409942e618e 8009982: Lazy execution bugfix. Added lazy sunspider unit test. Added mandreel to compile-octane test. Fixed warnings
lagergren
parents: 16201
diff changeset
    93
	if (typeof compile_only === 'undefined') { //for a run, skip compile onlies, don't even compile them
1409942e618e 8009982: Lazy execution bugfix. Added lazy sunspider unit test. Added mandreel to compile-octane test. Fixed warnings
lagergren
parents: 16201
diff changeset
    94
	    return;
1409942e618e 8009982: Lazy execution bugfix. Added lazy sunspider unit test. Added mandreel to compile-octane test. Fixed warnings
lagergren
parents: 16201
diff changeset
    95
	}
16201
889ddb179cdf 8007062: Split Lower up into Lower/Attr/FinalizeTypes. Integrate AccessSpecalizer into FinalizeTypes.
lagergren
parents: 16163
diff changeset
    96
	print("Compiling... " + file_name);
889ddb179cdf 8007062: Split Lower up into Lower/Attr/FinalizeTypes. Integrate AccessSpecalizer into FinalizeTypes.
lagergren
parents: 16163
diff changeset
    97
    }
889ddb179cdf 8007062: Split Lower up into Lower/Attr/FinalizeTypes. Integrate AccessSpecalizer into FinalizeTypes.
lagergren
parents: 16163
diff changeset
    98
889ddb179cdf 8007062: Split Lower up into Lower/Attr/FinalizeTypes. Integrate AccessSpecalizer into FinalizeTypes.
lagergren
parents: 16163
diff changeset
    99
    load(path + 'base.js');
889ddb179cdf 8007062: Split Lower up into Lower/Attr/FinalizeTypes. Integrate AccessSpecalizer into FinalizeTypes.
lagergren
parents: 16163
diff changeset
   100
    load(arg);
16147
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   101
    
16525
1409942e618e 8009982: Lazy execution bugfix. Added lazy sunspider unit test. Added mandreel to compile-octane test. Fixed warnings
lagergren
parents: 16201
diff changeset
   102
    if (compile_and_return) {
16147
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   103
	print("Compiled OK: " + file_name);
16201
889ddb179cdf 8007062: Split Lower up into Lower/Attr/FinalizeTypes. Integrate AccessSpecalizer into FinalizeTypes.
lagergren
parents: 16163
diff changeset
   104
	print("");
16147
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   105
	return;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   106
    }
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   107
    
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   108
    var success = true;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   109
    var hiscore = 0;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   110
    var loscore = 10e8;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   111
    var current_name;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   112
    
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   113
    function PrintResult(name, result) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   114
	current_name = name;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   115
    }
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   116
        
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   117
    function PrintError(name, error) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   118
	current_name = name;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   119
	PrintResult(name, error);
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   120
	success = false;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   121
    }
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   122
        
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   123
    function PrintScore(score) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   124
	if (success) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   125
	    if (+score >= hiscore) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   126
		hiscore = +score;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   127
	    }
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   128
	    if (+score <= loscore) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   129
		loscore = +score;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   130
	    }
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   131
	}
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   132
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   133
	if (verbose) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   134
	    print("Score: " + score);
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   135
	}
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   136
    }
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   137
    
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   138
    if (iters == undefined) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   139
	iters = numberOfIterations;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   140
    } else {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   141
	numberOfIterations = iters;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   142
    }
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   143
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   144
    print(runtime + ": running " + file_name + "...");
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   145
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   146
    for (var i = 0; i < numberOfIterations; i++) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   147
	var callbacks =
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   148
	    { NotifyResult: PrintResult,
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   149
	      NotifyError: PrintError,
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   150
	      NotifyScore: PrintScore };	
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   151
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   152
	for (j in ignoreTeardown) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   153
	    var ignore = ignoreTeardown[j];
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   154
	    if (endsWith(arg, ignore.name)) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   155
		var teardownOverride = ignore.teardown;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   156
		if (!teardownOverride) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   157
		    teardownOverride = function() {};
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   158
		}
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   159
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   160
		for (k in BenchmarkSuite.suites) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   161
		    var benchmarks = BenchmarkSuite.suites[k].benchmarks;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   162
		    for (l in benchmarks) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   163
			benchmarks[l].TearDown = teardownOverride;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   164
		    }
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   165
                }
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   166
		break;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   167
	    }
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   168
	}
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   169
	
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   170
	BenchmarkSuite.RunSuites(callbacks);
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   171
    }
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   172
    
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   173
    var start = "Score: ";
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   174
    if (runtime != "") {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   175
	start = runtime + ": ";
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   176
    } 
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   177
    print(start + current_name + ' (version ' + BenchmarkSuite.version + '): ' + loscore + '-' + hiscore);
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   178
}
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   179
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   180
function run_suite(tests, iters) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   181
    for (var idx = 0; idx < tests.length; idx++) {
16525
1409942e618e 8009982: Lazy execution bugfix. Added lazy sunspider unit test. Added mandreel to compile-octane test. Fixed warnings
lagergren
parents: 16201
diff changeset
   182
	run_one_benchmark(tests[idx], iters);
16147
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   183
    }
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   184
}
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   185
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   186
runtime = "command line";
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   187
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   188
var args = [];
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   189
if (typeof $ARGS !== 'undefined') {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   190
    args = $ARGS;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   191
} else if (typeof arguments !== 'undefined' && arguments.length != 0) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   192
    args = arguments;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   193
}  
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   194
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   195
var new_args = [];
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   196
for (i in args) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   197
    if (args[i].toString().indexOf(' ') != -1) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   198
	args[i] = args[i].replace(/\/$/, '');
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   199
	var s = args[i].split(' ');
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   200
	for (j in s) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   201
	    new_args.push(s[j]);
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   202
	}
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   203
    } else {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   204
	new_args.push(args[i]);
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   205
    }
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   206
}
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   207
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   208
if (new_args.length != 0) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   209
    args = new_args;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   210
}
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   211
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   212
var tests_found = [];
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   213
var iters = undefined;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   214
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   215
for (var i = 0; i < args.length; i++) { 
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   216
    arg = args[i];
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   217
    if (arg == "--iterations") {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   218
	iters = +args[++i];
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   219
    } else if (arg == "--runtime") {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   220
	runtime = args[++i];
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   221
    } else if (arg == "--verbose") {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   222
	verbose = true;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   223
    } else if (arg == "") {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   224
	continue; //skip
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   225
    } else {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   226
	tests_found.push(arg);
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   227
    }
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   228
}
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   229
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   230
if (tests_found.length == 0) {    
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   231
    for (i in tests) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   232
	tests_found.push(path + tests[i]);
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   233
    }
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   234
} 
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   235
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   236
tests_found.sort();
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   237
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   238
run_suite(tests_found, iters);
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   239
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   240
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   241