diff --git a/test/js-perf-test/JSTests.json b/test/js-perf-test/JSTests.json index bff5b6536f..5c52827ffe 100644 --- a/test/js-perf-test/JSTests.json +++ b/test/js-perf-test/JSTests.json @@ -8,6 +8,19 @@ "total": true, "resources": ["base.js"], "tests": [ + { + "name": "RestParameters", + "path": ["RestParameters"], + "main": "run.js", + "resources": ["rest.js"], + "flags": ["--harmony-rest-parameters"], + "run_count": 5, + "units": "score", + "results_regexp": "^%s\\-RestParameters\\(Score\\): (.+)$", + "tests": [ + {"name": "BasicRest1"} + ] + }, { "name": "SpreadCalls", "path": ["SpreadCalls"], diff --git a/test/js-perf-test/RestParameters/rest.js b/test/js-perf-test/RestParameters/rest.js new file mode 100644 index 0000000000..f449aca36c --- /dev/null +++ b/test/js-perf-test/RestParameters/rest.js @@ -0,0 +1,30 @@ +// Copyright 2015 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +new BenchmarkSuite('Basic', [1000], [ + new Benchmark('BasicRest1', false, false, 0, + BasicRest1, BasicRest1Setup, BasicRest1TearDown) +]); + +// ---------------------------------------------------------------------------- + +var result; + +function basic_rest_fn_1(factor, ...values) { + var result = 0; + for (var i = 0; i < values.length; ++i) { + result += (factor * values[i]); + } + return result; +} + +function BasicRest1Setup() {} + +function BasicRest1() { + result = basic_rest_fn_1(10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); +} + +function BasicRest1TearDown() { + return result == 550; +} diff --git a/test/js-perf-test/RestParameters/run.js b/test/js-perf-test/RestParameters/run.js new file mode 100644 index 0000000000..71d3d43bc2 --- /dev/null +++ b/test/js-perf-test/RestParameters/run.js @@ -0,0 +1,26 @@ +// Copyright 2015 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + + +load('../base.js'); +load('rest.js'); + +var success = true; + +function PrintResult(name, result) { + print(name + '-RestParameters(Score): ' + result); +} + + +function PrintError(name, error) { + PrintResult(name, error); + success = false; +} + + +BenchmarkSuite.config.doWarmup = undefined; +BenchmarkSuite.config.doDeterministic = undefined; + +BenchmarkSuite.RunSuites({ NotifyResult: PrintResult, + NotifyError: PrintError });