[foozzie] Add suppression for Math.pow

Bug: chromium:1063568
Change-Id: I69ae644cc02549eb6c8c3b6169e9b1db2ee4e27e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2144067
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67220}
This commit is contained in:
Michael Achenbach 2020-04-19 11:22:36 +02:00 committed by Commit Bot
parent df4df03103
commit a8183a63cf
2 changed files with 22 additions and 0 deletions

View File

@ -80,3 +80,12 @@ else {
// Realm.eval is just eval.
assertEquals(1477662728716, Realm.eval(Realm.create(), `Date.now()`));
// Test suppressions when Math.pow is optimized.
function callPow(v) {
return Math.pow(v, -0.5);
}
%PrepareFunctionForOptimization(callPow);
const unoptimized = callPow(6996);
%OptimizeFunctionOnNextCall(callPow);
assertEquals(unoptimized, callPow(6996));

View File

@ -21,6 +21,19 @@ var prettyPrinted = function prettyPrinted(msg) { return msg; };
}
})();
// Mock Math.pow. Work around an optimization for -0.5.
(function() {
const origMathPow = Math.pow;
Math.pow = function(a, b) {
if (b === -0.5) {
return 0;
} else {
return origMathPow(a, b);
}
}
})();
// Mock Date.
(function() {
let index = 0;