2017-06-06 09:00:22 +00: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.
|
|
|
|
|
2017-06-22 13:46:04 +00:00
|
|
|
// Flags: --opt --allow-natives-syntax --no-always-opt
|
2017-06-06 09:00:22 +00:00
|
|
|
|
|
|
|
class A {
|
|
|
|
constructor() { }
|
|
|
|
}
|
|
|
|
class B extends A {
|
|
|
|
constructor(call_super) {
|
|
|
|
super();
|
|
|
|
if (call_super) {
|
|
|
|
super();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-05-03 14:32:12 +00:00
|
|
|
// No feedback case
|
|
|
|
test = new B(0);
|
|
|
|
assertThrows(() => {new B(1)}, ReferenceError);
|
2017-06-06 09:00:22 +00:00
|
|
|
|
2019-05-03 14:32:12 +00:00
|
|
|
// Ensure Feedback
|
|
|
|
%PrepareFunctionForOptimization(B);
|
|
|
|
%EnsureFeedbackVectorForFunction(A);
|
2017-06-06 09:00:22 +00:00
|
|
|
test = new B(0);
|
|
|
|
test = new B(0);
|
2018-06-06 05:51:02 +00:00
|
|
|
assertThrows(() => {new B(1)}, ReferenceError);
|
|
|
|
assertThrows(() => {new B(1)}, ReferenceError);
|
2017-06-06 09:00:22 +00:00
|
|
|
%OptimizeFunctionOnNextCall(B);
|
|
|
|
test = new B(0);
|
|
|
|
assertOptimized(B);
|
|
|
|
// Check that hole checks are handled correctly in optimized code.
|
2018-06-06 05:51:02 +00:00
|
|
|
assertThrows(() => {new B(1)}, ReferenceError);
|
2017-06-06 09:00:22 +00:00
|
|
|
assertOptimized(B);
|