Emily Bernier | 958fae7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 1 | // Copyright 2014 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 | 'use strict'; |
| 5 | |
| 6 | var DefaultConstructorBenchmark = new BenchmarkSuite('DefaultConstructor', |
| 7 | [100], [ |
| 8 | new Benchmark('NoSuperClass', false, false, 0, NoSuperClass), |
| 9 | new Benchmark('WithSuperClass', false, false, 0, WithSuperClass), |
| 10 | new Benchmark('WithSuperClassArguments', false, false, 0, |
| 11 | WithSuperClassArguments), |
| 12 | ]); |
| 13 | |
| 14 | |
| 15 | class BaseClass {} |
| 16 | |
| 17 | |
| 18 | class DerivedClass extends BaseClass {} |
| 19 | |
| 20 | |
| 21 | function NoSuperClass() { |
| 22 | return new BaseClass(); |
| 23 | } |
| 24 | |
| 25 | |
| 26 | function WithSuperClass() { |
| 27 | return new DerivedClass(); |
| 28 | } |
| 29 | |
| 30 | |
| 31 | function WithSuperClassArguments() { |
| 32 | return new DerivedClass(0, 1, 2, 3, 4); |
| 33 | } |