2016-10-27 05:59:41 +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-04-28 13:33:43 +00:00
|
|
|
// Flags: --allow-natives-syntax --opt
|
2016-10-27 05:59:41 +00:00
|
|
|
|
|
|
|
(function() {
|
|
|
|
function foo(x, y) { return x << y; }
|
|
|
|
|
2019-03-01 10:19:54 +00:00
|
|
|
%PrepareFunctionForOptimization(foo);
|
2016-10-27 05:59:41 +00:00
|
|
|
foo(1.1, 0.1);
|
|
|
|
foo(0.1, 1.1);
|
2017-06-06 14:06:11 +00:00
|
|
|
foo(true, false);
|
2016-10-27 05:59:41 +00:00
|
|
|
%OptimizeFunctionOnNextCall(foo);
|
|
|
|
foo(undefined, 1.1);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(1.1, undefined);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(null, 1.1);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(1.1, null);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(true, 1.1);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(1.1, true);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(false, 1.1);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(1.1, false);
|
|
|
|
assertOptimized(foo);
|
|
|
|
})();
|
|
|
|
|
|
|
|
(function() {
|
|
|
|
function foo(x, y) { return x >> y; }
|
|
|
|
|
2019-03-01 10:19:54 +00:00
|
|
|
%PrepareFunctionForOptimization(foo);
|
2016-10-27 05:59:41 +00:00
|
|
|
foo(1.1, 0.1);
|
|
|
|
foo(0.1, 1.1);
|
2017-06-06 14:06:11 +00:00
|
|
|
foo(true, false);
|
2016-10-27 05:59:41 +00:00
|
|
|
%OptimizeFunctionOnNextCall(foo);
|
|
|
|
foo(undefined, 1.1);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(1.1, undefined);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(null, 1.1);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(1.1, null);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(true, 1.1);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(1.1, true);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(false, 1.1);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(1.1, false);
|
|
|
|
assertOptimized(foo);
|
|
|
|
})();
|
|
|
|
|
|
|
|
(function() {
|
|
|
|
function foo(x, y) { return x >>> y; }
|
|
|
|
|
2019-03-01 10:19:54 +00:00
|
|
|
%PrepareFunctionForOptimization(foo);
|
2016-10-27 05:59:41 +00:00
|
|
|
foo(1.1, 0.1);
|
|
|
|
foo(0.1, 1.1);
|
2017-06-06 14:06:11 +00:00
|
|
|
foo(true, false);
|
2016-10-27 05:59:41 +00:00
|
|
|
%OptimizeFunctionOnNextCall(foo);
|
|
|
|
foo(undefined, 1.1);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(1.1, undefined);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(null, 1.1);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(1.1, null);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(true, 1.1);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(1.1, true);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(false, 1.1);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(1.1, false);
|
|
|
|
assertOptimized(foo);
|
|
|
|
})();
|
|
|
|
|
|
|
|
(function() {
|
|
|
|
function foo(x, y) { return x ^ y; }
|
|
|
|
|
2019-03-01 10:19:54 +00:00
|
|
|
%PrepareFunctionForOptimization(foo);
|
2016-10-27 05:59:41 +00:00
|
|
|
foo(1.1, 0.1);
|
|
|
|
foo(0.1, 1.1);
|
2017-06-06 14:06:11 +00:00
|
|
|
foo(true, false);
|
2016-10-27 05:59:41 +00:00
|
|
|
%OptimizeFunctionOnNextCall(foo);
|
|
|
|
foo(undefined, 1.1);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(1.1, undefined);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(null, 1.1);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(1.1, null);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(true, 1.1);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(1.1, true);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(false, 1.1);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(1.1, false);
|
|
|
|
assertOptimized(foo);
|
|
|
|
})();
|
|
|
|
|
|
|
|
(function() {
|
|
|
|
function foo(x, y) { return x | y; }
|
|
|
|
|
2019-03-01 10:19:54 +00:00
|
|
|
%PrepareFunctionForOptimization(foo);
|
2016-10-27 05:59:41 +00:00
|
|
|
foo(1.1, 0.1);
|
|
|
|
foo(0.1, 1.1);
|
2017-06-06 14:06:11 +00:00
|
|
|
foo(true, false);
|
2016-10-27 05:59:41 +00:00
|
|
|
%OptimizeFunctionOnNextCall(foo);
|
|
|
|
foo(undefined, 1.1);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(1.1, undefined);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(null, 1.1);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(1.1, null);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(true, 1.1);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(1.1, true);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(false, 1.1);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(1.1, false);
|
|
|
|
assertOptimized(foo);
|
|
|
|
})();
|
|
|
|
|
|
|
|
(function() {
|
|
|
|
function foo(x, y) { return x & y; }
|
|
|
|
|
2019-03-01 10:19:54 +00:00
|
|
|
%PrepareFunctionForOptimization(foo);
|
2016-10-27 05:59:41 +00:00
|
|
|
foo(1.1, 0.1);
|
|
|
|
foo(0.1, 1.1);
|
2017-06-06 14:06:11 +00:00
|
|
|
foo(true, false);
|
2016-10-27 05:59:41 +00:00
|
|
|
%OptimizeFunctionOnNextCall(foo);
|
|
|
|
foo(undefined, 1.1);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(1.1, undefined);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(null, 1.1);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(1.1, null);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(true, 1.1);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(1.1, true);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(false, 1.1);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(1.1, false);
|
|
|
|
assertOptimized(foo);
|
|
|
|
})();
|