| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 'use strict'; | 4 'use strict'; |
| 5 | 5 |
| 6 var SuperBenchmark = new BenchmarkSuite('Super', [100], [ | 6 var SuperBenchmark = new BenchmarkSuite('Super', [100], [ |
| 7 new Benchmark('SuperMethodCall', false, false, 0, SuperMethodCall), | 7 new Benchmark('SuperMethodCall', false, false, 0, SuperMethodCall), |
| 8 new Benchmark('SuperGetterCall', false, false, 0, SuperGetterCall), | 8 new Benchmark('SuperGetterCall', false, false, 0, SuperGetterCall), |
| 9 new Benchmark('SuperSetterCall', false, false, 0, SuperSetterCall), | 9 new Benchmark('SuperSetterCall', false, false, 0, SuperSetterCall), |
| 10 ]); | 10 ]); |
| 11 | 11 |
| 12 | 12 |
| 13 class Base { | 13 class Base { |
| 14 constructor() {} | 14 constructor() {} |
| 15 get x() { | 15 get x() { |
| 16 return this._x++; | 16 return this._x++; |
| 17 } | 17 } |
| 18 set x(v) { | 18 set x(v) { |
| 19 this._x += v; | 19 this._x += v; |
| 20 return this._x; | 20 return this._x; |
| 21 } | 21 } |
| 22 f() { | 22 f() { |
| 23 return this._x++; | 23 return this._x++; |
| 24 } | 24 } |
| 25 } | 25 } |
| 26 | 26 |
| 27 | 27 |
| 28 class Derived extends Base { | 28 class Derived extends Base { |
| 29 constructor() { | 29 constructor() { |
| 30 super(); |
| 30 this._x = 1; | 31 this._x = 1; |
| 31 } | 32 } |
| 32 SuperCall() { | 33 SuperCall() { |
| 33 return super.f(); | 34 return super.f(); |
| 34 } | 35 } |
| 35 GetterCall() { | 36 GetterCall() { |
| 36 return super.x; | 37 return super.x; |
| 37 } | 38 } |
| 38 SetterCall() { | 39 SetterCall() { |
| 39 return super.x = 5; | 40 return super.x = 5; |
| 40 } | 41 } |
| 41 } | 42 } |
| 42 | 43 |
| 43 | 44 |
| 44 var derived = new Derived(); | 45 var derived = new Derived(); |
| 45 | 46 |
| 46 function SuperMethodCall() { | 47 function SuperMethodCall() { |
| 47 return derived.SuperCall(); | 48 return derived.SuperCall(); |
| 48 } | 49 } |
| 49 | 50 |
| 50 function SuperGetterCall() { | 51 function SuperGetterCall() { |
| 51 return derived.GetterCall(); | 52 return derived.GetterCall(); |
| 52 } | 53 } |
| 53 | 54 |
| 54 function SuperSetterCall() { | 55 function SuperSetterCall() { |
| 55 return derived.SetterCall(); | 56 return derived.SetterCall(); |
| 56 } | 57 } |
| OLD | NEW |