Ben Murdoch | 014dc51 | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 1 | // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | new BenchmarkSuite('Basic1', [1000], [ |
| 6 | new Benchmark('BasicRest1', false, false, 0, |
| 7 | BasicRest1, BasicRest1Setup, BasicRest1TearDown) |
| 8 | ]); |
| 9 | |
| 10 | // ---------------------------------------------------------------------------- |
| 11 | |
| 12 | var result; |
| 13 | |
| 14 | function basic_rest_fn_1(factor, ...values) { |
| 15 | var result = 0; |
| 16 | for (var i = 0; i < values.length; ++i) { |
| 17 | result += (factor * values[i]); |
| 18 | } |
| 19 | return result; |
| 20 | } |
| 21 | |
| 22 | function BasicRest1Setup() {} |
| 23 | |
| 24 | function BasicRest1() { |
| 25 | result = basic_rest_fn_1(10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); |
| 26 | } |
| 27 | |
| 28 | function BasicRest1TearDown() { |
| 29 | return result == 550; |
| 30 | } |