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 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 13 class Base { 14 constructor() {} 15 get x() { 16 return this._x++; 17 } 18 set x(v) { 19 this._x += v; 20 return this._x; 21 } 22 f() { 23 return this._x++; 24 } 25 } 26 27 28 class 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 } 42 } 43 44 45 var derived = new Derived(); 46 47 function SuperMethodCall() { 48 return derived.SuperCall(); 49 } 50 51 function SuperGetterCall() { 52 return derived.GetterCall(); 53 } 54 55 function SuperSetterCall() { 56 return derived.SetterCall(); 57 } 58