2019-11-18 13:02:13 +00:00
|
|
|
// Copyright 2019 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.
|
|
|
|
|
|
|
|
// Flags: --allow-natives-syntax
|
|
|
|
|
|
|
|
class C {
|
|
|
|
bla() {};
|
|
|
|
constructor() { %TurbofanStaticAssert(this.bla === bla); }
|
|
|
|
}
|
|
|
|
const bla = C.prototype.bla;
|
|
|
|
function bar(f) { return new f; }
|
|
|
|
var CC = C;
|
|
|
|
function foo() { return bar(CC); }
|
|
|
|
|
|
|
|
%PrepareFunctionForOptimization(C);
|
|
|
|
%PrepareFunctionForOptimization(bla);
|
|
|
|
%PrepareFunctionForOptimization(foo);
|
|
|
|
%PrepareFunctionForOptimization(bar);
|
|
|
|
|
|
|
|
// Make {this.bla} in C megamorphic
|
|
|
|
new class extends C { constructor() { super(); this.a = 1 } }
|
|
|
|
new class extends C { constructor() { super(); this.b = 1 } }
|
|
|
|
new class extends C { constructor() { super(); this.c = 1 } }
|
|
|
|
new class extends C { constructor() { super(); this.d = 1 } }
|
|
|
|
|
|
|
|
foo();
|
2022-02-23 13:48:02 +00:00
|
|
|
%OptimizeFunctionOnNextCall(foo);
|
2019-11-18 13:02:13 +00:00
|
|
|
foo();
|