2017-09-12 11:34:59 +02:00
|
|
|
// Copyright 2016 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.
|
|
|
|
|
2022-09-21 13:28:42 +02:00
|
|
|
// Flags: --turbofan --allow-natives-syntax --no-always-turbofan
|
2017-09-12 11:34:59 +02:00
|
|
|
|
|
|
|
class A {
|
|
|
|
constructor() { }
|
|
|
|
}
|
|
|
|
class B extends A {
|
|
|
|
constructor(call_super) {
|
|
|
|
super();
|
|
|
|
if (call_super) {
|
|
|
|
super();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-08-01 08:38:30 +02:00
|
|
|
// No feedback case
|
|
|
|
test = new B(0);
|
|
|
|
assertThrows(() => {new B(1)}, ReferenceError);
|
2017-09-12 11:34:59 +02:00
|
|
|
|
2019-08-01 08:38:30 +02:00
|
|
|
// Ensure Feedback
|
|
|
|
%PrepareFunctionForOptimization(B);
|
|
|
|
%EnsureFeedbackVectorForFunction(A);
|
2017-09-12 11:34:59 +02:00
|
|
|
test = new B(0);
|
|
|
|
test = new B(0);
|
2018-09-07 17:07:13 +02:00
|
|
|
assertThrows(() => {new B(1)}, ReferenceError);
|
|
|
|
assertThrows(() => {new B(1)}, ReferenceError);
|
2017-09-12 11:34:59 +02:00
|
|
|
%OptimizeFunctionOnNextCall(B);
|
|
|
|
test = new B(0);
|
|
|
|
assertOptimized(B);
|
|
|
|
// Check that hole checks are handled correctly in optimized code.
|
2018-09-07 17:07:13 +02:00
|
|
|
assertThrows(() => {new B(1)}, ReferenceError);
|
2017-09-12 11:34:59 +02:00
|
|
|
assertOptimized(B);
|