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
|
|
|
|
|
|
|
function f(b) {
|
|
|
|
if (b == 1) {
|
|
|
|
let a = a = 20;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-01 08:38:30 +02:00
|
|
|
f(0);
|
|
|
|
assertThrows(() => {f(1)}, ReferenceError);
|
|
|
|
|
|
|
|
%PrepareFunctionForOptimization(f);
|
2017-09-12 11:34:59 +02:00
|
|
|
f(0);
|
|
|
|
f(0);
|
|
|
|
%OptimizeFunctionOnNextCall(f);
|
|
|
|
f(0);
|
|
|
|
assertOptimized(f);
|
|
|
|
// Check that hole checks are handled correctly in optimized code.
|
2018-09-07 17:07:13 +02:00
|
|
|
assertThrows(() => {f(1)}, ReferenceError);
|
2017-09-12 11:34:59 +02:00
|
|
|
assertOptimized(f);
|