765e002a4f
The preparser needs to log the usage of super properties and then update the scope when we create the function later. BUG=v8:3888 LOG=N R=dslomov@chromium.org, marja Review URL: https://codereview.chromium.org/923683002 Cr-Commit-Position: refs/heads/master@{#26642}
58 lines
1.0 KiB
JavaScript
58 lines
1.0 KiB
JavaScript
// Copyright 2014 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
'use strict';
|
|
|
|
var SuperBenchmark = new BenchmarkSuite('Super', [100], [
|
|
new Benchmark('SuperMethodCall', false, false, 0, SuperMethodCall),
|
|
new Benchmark('SuperGetterCall', false, false, 0, SuperGetterCall),
|
|
new Benchmark('SuperSetterCall', false, false, 0, SuperSetterCall),
|
|
]);
|
|
|
|
|
|
class Base {
|
|
constructor() {}
|
|
get x() {
|
|
return this._x++;
|
|
}
|
|
set x(v) {
|
|
this._x += v;
|
|
return this._x;
|
|
}
|
|
f() {
|
|
return this._x++;
|
|
}
|
|
}
|
|
|
|
|
|
class Derived extends Base {
|
|
constructor() {
|
|
super();
|
|
this._x = 1;
|
|
}
|
|
SuperCall() {
|
|
return super.f();
|
|
}
|
|
GetterCall() {
|
|
return super.x;
|
|
}
|
|
SetterCall() {
|
|
return super.x = 5;
|
|
}
|
|
}
|
|
|
|
|
|
var derived = new Derived();
|
|
|
|
function SuperMethodCall() {
|
|
return derived.SuperCall();
|
|
}
|
|
|
|
function SuperGetterCall() {
|
|
return derived.GetterCall();
|
|
}
|
|
|
|
function SuperSetterCall() {
|
|
return derived.SetterCall();
|
|
}
|