v8/test/mjsunit/math-deopt.js
Sigurd Schneider fb0144f6f9 [turbofan] Move Math.* builtins to JSCallReducer
This CL also adds speculation to all Math builtins,
and refactors the JSCallReducer.

Bug: v8:7250, v8:7240
Change-Id: Icdaddb767e875bb191939d907f65c7a8dcf79b8b
Reviewed-on: https://chromium-review.googlesource.com/873916
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51426}
2018-02-21 12:21:20 +00:00

71 lines
1.2 KiB
JavaScript

// Copyright 2018 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 --no-always-opt
(()=> {
function f(a) {
return Math.abs(a);
}
f(1);
f(1);
%OptimizeFunctionOnNextCall(f);
f("100");
%OptimizeFunctionOnNextCall(f);
f("100");
assertOptimized(f);
})();
(()=> {
function f(a) {
return Math.min(1,a);
}
f(1);
f(1);
%OptimizeFunctionOnNextCall(f);
f("100");
%OptimizeFunctionOnNextCall(f);
f("100");
assertOptimized(f);
})();
(()=> {
function f(a) {
return Math.pow(a,10);
}
f(1);
f(1);
%OptimizeFunctionOnNextCall(f);
f("100");
%OptimizeFunctionOnNextCall(f);
f("100");
assertOptimized(f);
})();
(()=> {
function f(a) {
return Math.clz32(a);
}
f(1);
f(1);
%OptimizeFunctionOnNextCall(f);
f("100");
%OptimizeFunctionOnNextCall(f);
f("100");
assertOptimized(f);
})();
(()=> {
function f(a) {
return Math.imul(a, 10);
}
f(1);
f(1);
%OptimizeFunctionOnNextCall(f);
f("100");
%OptimizeFunctionOnNextCall(f);
f("100");
assertOptimized(f);
})();