v8/test/mjsunit/regress/regress-6989.js
Benedikt Meurer 5e725575d7 [ic] Fix undefined/null receivers not leaving UNINITIALIZED state.
The (KEYED_)LOAD/STORE_ICs didn't properly leave the UNINITIALIZED as
long as the receiver was always null/undefined. This leads to
deoptimization loops in TurboFan, because the compiler always put in a
SOFT deoptimization at this point.

Bug: v8:6989
Change-Id: I1a32bfb722f121f8b593e8972e657290d7b0531d
Reviewed-on: https://chromium-review.googlesource.com/735319
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48854}
2017-10-24 06:40:56 +00:00

86 lines
1.9 KiB
JavaScript

// Copyright 2017 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 --opt
(function() {
function foo(o) { o["x"] = 1; }
assertThrows(() => foo(undefined));
assertThrows(() => foo(undefined));
%OptimizeFunctionOnNextCall(foo);
assertThrows(() => foo(undefined));
assertOptimized(foo);
})();
(function() {
function foo(o) { o["x"] = 1; }
assertThrows(() => foo(null));
assertThrows(() => foo(null));
%OptimizeFunctionOnNextCall(foo);
assertThrows(() => foo(null));
assertOptimized(foo);
})();
(function() {
function foo(o) { return o["x"]; }
assertThrows(() => foo(undefined));
assertThrows(() => foo(undefined));
%OptimizeFunctionOnNextCall(foo);
assertThrows(() => foo(undefined));
assertOptimized(foo);
})();
(function() {
function foo(o) { return o["x"]; }
assertThrows(() => foo(null));
assertThrows(() => foo(null));
%OptimizeFunctionOnNextCall(foo);
assertThrows(() => foo(null));
assertOptimized(foo);
})();
(function() {
function foo(o) { o.x = 1; }
assertThrows(() => foo(undefined));
assertThrows(() => foo(undefined));
%OptimizeFunctionOnNextCall(foo);
assertThrows(() => foo(undefined));
assertOptimized(foo);
})();
(function() {
function foo(o) { o.x = 1; }
assertThrows(() => foo(null));
assertThrows(() => foo(null));
%OptimizeFunctionOnNextCall(foo);
assertThrows(() => foo(null));
assertOptimized(foo);
})();
(function() {
function foo(o) { return o.x; }
assertThrows(() => foo(undefined));
assertThrows(() => foo(undefined));
%OptimizeFunctionOnNextCall(foo);
assertThrows(() => foo(undefined));
assertOptimized(foo);
})();
(function() {
function foo(o) { return o.x; }
assertThrows(() => foo(null));
assertThrows(() => foo(null));
%OptimizeFunctionOnNextCall(foo);
assertThrows(() => foo(null));
assertOptimized(foo);
})();