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-08-10 07:54:33 +00:00
|
|
|
// Flags: --opt --allow-natives-syntax --no-always-opt
|
2017-06-06 09:00:22 +00:00
|
|
|
|
|
|
|
function f(b) {
|
|
|
|
if (b == 1) {
|
|
|
|
let a = a = 20;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-03 14:32:12 +00:00
|
|
|
f(0);
|
|
|
|
assertThrows(() => {f(1)}, ReferenceError);
|
|
|
|
|
|
|
|
%PrepareFunctionForOptimization(f);
|
2017-06-06 09:00:22 +00:00
|
|
|
f(0);
|
|
|
|
f(0);
|
|
|
|
%OptimizeFunctionOnNextCall(f);
|
|
|
|
f(0);
|
|
|
|
assertOptimized(f);
|
|
|
|
// Check that hole checks are handled correctly in optimized code.
|
2018-06-06 05:51:02 +00:00
|
|
|
assertThrows(() => {f(1)}, ReferenceError);
|
2017-06-06 09:00:22 +00:00
|
|
|
assertOptimized(f);
|