blob: b4a33c59c92c5f3bda9465c4e7e2a9888c2d79d4 [file] [log] [blame]
// 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);
})();