nashorn/test/script/basic/run-octane.js
author lagergren
Wed, 30 Jan 2013 12:26:45 +0100
changeset 16201 889ddb179cdf
parent 16163 71f4cff209a9
child 16525 1409942e618e
permissions -rw-r--r--
8007062: Split Lower up into Lower/Attr/FinalizeTypes. Integrate AccessSpecalizer into FinalizeTypes. Summary: Lower suffered from being a "God class" trying to do everything at once. As Nashorn code generation has grown, so has Lower. It does several post processing passes, tries to do several things at once even though all type information isn't in place, adjusting state afterwards and so on. It also performs control flow analysis, type attribution and constant folding, and everything else code generation related before byte code emission. I have now separated the compilation process into Lower (create low level nodes from high level ones, copy code such as finally block inlining etc), Attr (assign types and symbols to all nodes - freeze slot and scope information) and FinalizeTypes (insert explicit casts, specialize invoke dynamic types for scope accesses). I've removed the kludgy AccessSpecializer, as this now integrates naturally with typing. Everything is now much easier to read and each module performs only one thing. I have added separate loggers for the separate tiers. In the process I have also fixed: (1) problems with type coercion (see test/script/basic/typecoercion.js, basically our coercion was too late and our symbol inference was erroneous. This only manifested itself in very rare occasions where toNumber coercion has side effects, such as for example when valueOf is overridden) (2) copying literal nodes (literal copy did not use the superclass copy, which made all the Node specific fields not to be copied (3) erroneous literal tokenization (literals shouldn't always just inherit token information from whatever node that creates them) (4) splitter weighnodes - unary nodes were considered weightless (4) removed the hateful and kludgy "VarNode.shouldAppend", which really isn't needed when we have an attribution phase that determines self reference symbols (the only thing it was used for) (5) duplicate line number issues in the parser (6) convert bug in CodeGenerator for intermediate results of scope accesses (see test/script/basic/access-specializer.js) ... Several of these things just stopped being problems with the new architecture "can't happen anymore" and are not bug fixes per se. All tests run. No performance regressions exist that I've been able to measure. Some increases in performance were measured, but in the statistical margin of error (which is very wide as HotSpot currently has warmup issues with LambdaForms/invoke dynamic). Compile speed has not measurably increased. Reviewed-by: jlaskey, attila
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", 
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    34
    "gbemu.js",	     
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    35
    "navier-stokes.js", 
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    36
    "pdfjs.js",
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    37
    "raytrace.js",
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    38
    "regexp.js", 
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    39
    "richards.js", 
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    40
    "splay.js" 
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    41
];
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    42
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    43
// hack, teardown breaks things defined in the global space, making it impossible
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    44
// 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
    45
// that the setup and teardown aren't each others constructor and destructor but rather
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    46
// that the benchmarks rely on partial global state. For shame, Octane! 
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    47
var ignoreTeardown = [
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    48
    { name: "box2d.js" },
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    49
    { name: "gbemu.js" },
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    50
];
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    51
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    52
var dir = (typeof(__DIR__) == 'undefined') ? "test/script/basic/" : __DIR__;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    53
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    54
// 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
    55
var path = dir + "../external/octane/";
16147
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    56
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    57
var runtime = "";
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    58
var verbose = false;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    59
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    60
var numberOfIterations = 5;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    61
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    62
function endsWith(str, suffix) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    63
    return str.indexOf(suffix, str.length - suffix.length) !== -1;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    64
}
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    65
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    66
function run_one_benchmark(arg, iters) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    67
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    68
    var file_name;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    69
    var file = arg.split('/');
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    70
    if (file.length == 1) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    71
        file = arg.split('\\');
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    72
    }    
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    73
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    74
    //trim off trailing path separators
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    75
    while (file[file.length - 1].indexOf(".js") == -1) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    76
	file.pop();
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    77
    }
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    78
    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
    79
889ddb179cdf 8007062: Split Lower up into Lower/Attr/FinalizeTypes. Integrate AccessSpecalizer into FinalizeTypes.
lagergren
parents: 16163
diff changeset
    80
    if (typeof compile_only !== 'undefined') {
889ddb179cdf 8007062: Split Lower up into Lower/Attr/FinalizeTypes. Integrate AccessSpecalizer into FinalizeTypes.
lagergren
parents: 16163
diff changeset
    81
	print("Compiling... " + file_name);
889ddb179cdf 8007062: Split Lower up into Lower/Attr/FinalizeTypes. Integrate AccessSpecalizer into FinalizeTypes.
lagergren
parents: 16163
diff changeset
    82
    }
889ddb179cdf 8007062: Split Lower up into Lower/Attr/FinalizeTypes. Integrate AccessSpecalizer into FinalizeTypes.
lagergren
parents: 16163
diff changeset
    83
889ddb179cdf 8007062: Split Lower up into Lower/Attr/FinalizeTypes. Integrate AccessSpecalizer into FinalizeTypes.
lagergren
parents: 16163
diff changeset
    84
    load(path + 'base.js');
889ddb179cdf 8007062: Split Lower up into Lower/Attr/FinalizeTypes. Integrate AccessSpecalizer into FinalizeTypes.
lagergren
parents: 16163
diff changeset
    85
    load(arg);
16147
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    86
    
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    87
    if (typeof compile_only !== 'undefined') {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    88
	print("Compiled OK: " + file_name);
16201
889ddb179cdf 8007062: Split Lower up into Lower/Attr/FinalizeTypes. Integrate AccessSpecalizer into FinalizeTypes.
lagergren
parents: 16163
diff changeset
    89
	print("");
16147
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    90
	return;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    91
    }
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    92
    
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    93
    var success = true;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    94
    var hiscore = 0;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    95
    var loscore = 10e8;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    96
    var current_name;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    97
    
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    98
    function PrintResult(name, result) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
    99
	current_name = name;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   100
    }
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   101
        
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   102
    function PrintError(name, error) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   103
	current_name = name;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   104
	PrintResult(name, error);
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   105
	success = false;
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
    function PrintScore(score) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   109
	if (success) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   110
	    if (+score >= hiscore) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   111
		hiscore = +score;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   112
	    }
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   113
	    if (+score <= loscore) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   114
		loscore = +score;
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
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   118
	if (verbose) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   119
	    print("Score: " + score);
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   120
	}
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
    if (iters == undefined) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   124
	iters = numberOfIterations;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   125
    } else {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   126
	numberOfIterations = iters;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   127
    }
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   128
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   129
    print(runtime + ": running " + file_name + "...");
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   130
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   131
    for (var i = 0; i < numberOfIterations; i++) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   132
	var callbacks =
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   133
	    { NotifyResult: PrintResult,
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   134
	      NotifyError: PrintError,
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   135
	      NotifyScore: PrintScore };	
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   136
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   137
	for (j in ignoreTeardown) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   138
	    var ignore = ignoreTeardown[j];
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   139
	    if (endsWith(arg, ignore.name)) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   140
		var teardownOverride = ignore.teardown;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   141
		if (!teardownOverride) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   142
		    teardownOverride = function() {};
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   143
		}
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   144
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   145
		for (k in BenchmarkSuite.suites) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   146
		    var benchmarks = BenchmarkSuite.suites[k].benchmarks;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   147
		    for (l in benchmarks) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   148
			benchmarks[l].TearDown = teardownOverride;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   149
		    }
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   150
                }
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   151
		break;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   152
	    }
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   153
	}
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   154
	
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   155
	BenchmarkSuite.RunSuites(callbacks);
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   156
    }
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   157
    
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   158
    var start = "Score: ";
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   159
    if (runtime != "") {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   160
	start = runtime + ": ";
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   161
    } 
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   162
    print(start + current_name + ' (version ' + BenchmarkSuite.version + '): ' + loscore + '-' + hiscore);
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   163
}
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   164
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   165
function run_suite(tests, iters) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   166
    for (var idx = 0; idx < tests.length; idx++) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   167
	run_one_benchmark(tests[idx], iters, false);
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
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   171
runtime = "command line";
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   172
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   173
var args = [];
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   174
if (typeof $ARGS !== 'undefined') {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   175
    args = $ARGS;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   176
} else if (typeof arguments !== 'undefined' && arguments.length != 0) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   177
    args = arguments;
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
var new_args = [];
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   181
for (i in args) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   182
    if (args[i].toString().indexOf(' ') != -1) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   183
	args[i] = args[i].replace(/\/$/, '');
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   184
	var s = args[i].split(' ');
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   185
	for (j in s) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   186
	    new_args.push(s[j]);
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   187
	}
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   188
    } else {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   189
	new_args.push(args[i]);
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   190
    }
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   191
}
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   192
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   193
if (new_args.length != 0) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   194
    args = new_args;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   195
}
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   196
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   197
var tests_found = [];
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   198
var iters = undefined;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   199
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   200
for (var i = 0; i < args.length; i++) { 
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   201
    arg = args[i];
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   202
    if (arg == "--iterations") {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   203
	iters = +args[++i];
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   204
    } else if (arg == "--runtime") {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   205
	runtime = args[++i];
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   206
    } else if (arg == "--verbose") {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   207
	verbose = true;
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   208
    } else if (arg == "") {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   209
	continue; //skip
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   210
    } else {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   211
	tests_found.push(arg);
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   212
    }
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   213
}
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   214
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   215
if (tests_found.length == 0) {    
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   216
    for (i in tests) {
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   217
	tests_found.push(path + tests[i]);
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   218
    }
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   219
} 
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   220
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   221
tests_found.sort();
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   222
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   223
run_suite(tests_found, iters);
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   224
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   225
e63b63819133 8005403: Open-source Nashorn
jlaskey
parents:
diff changeset
   226