blob: 0c12b8df004ef72bf6250d274ad67d726b3939c0 [file] [log] [blame]
Emily Bernier958fae72015-03-24 16:35:39 -04001// 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
6var SuperBenchmark = new BenchmarkSuite('Super', [100], [
7 new Benchmark('SuperMethodCall', false, false, 0, SuperMethodCall),
8 new Benchmark('SuperGetterCall', false, false, 0, SuperGetterCall),
9 new Benchmark('SuperSetterCall', false, false, 0, SuperSetterCall),
10]);
11
12
Ben Murdoch014dc512016-03-22 12:00:34 +000013class Base {
14 constructor() {}
Emily Bernier958fae72015-03-24 16:35:39 -040015 get x() {
16 return this._x++;
Ben Murdoch014dc512016-03-22 12:00:34 +000017 }
Emily Bernier958fae72015-03-24 16:35:39 -040018 set x(v) {
19 this._x += v;
20 return this._x;
21 }
Ben Murdoch014dc512016-03-22 12:00:34 +000022 f() {
23 return this._x++;
24 }
Emily Bernier958fae72015-03-24 16:35:39 -040025}
26
Emily Bernier958fae72015-03-24 16:35:39 -040027
Ben Murdoch014dc512016-03-22 12:00:34 +000028class Derived extends Base {
29 constructor() {
30 super();
31 this._x = 1;
32 }
33 SuperCall() {
34 return super.f();
35 }
36 GetterCall() {
37 return super.x;
38 }
39 SetterCall() {
40 return super.x = 5;
41 }
Emily Bernier958fae72015-03-24 16:35:39 -040042}
Emily Bernier958fae72015-03-24 16:35:39 -040043
Emily Bernier958fae72015-03-24 16:35:39 -040044
45var derived = new Derived();
46
47function SuperMethodCall() {
48 return derived.SuperCall();
49}
50
51function SuperGetterCall() {
52 return derived.GetterCall();
53}
54
55function SuperSetterCall() {
56 return derived.SetterCall();
57}