Commit 369e0d58 authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[wasm] Enable optimization of Math.pow intrinsic.

R=clemensh@chromium.org
TEST=mjsunit/wasm/asm-wasm-math-intrinsic
BUG=v8:8505

Change-Id: I883c9ad174f7fda5ec5dd24e71ca674de51239b3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1782160Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63521}
parent 1e88fece
...@@ -6397,10 +6397,7 @@ std::pair<WasmImportCallKind, Handle<JSReceiver>> ResolveWasmImportCall( ...@@ -6397,10 +6397,7 @@ std::pair<WasmImportCallKind, Handle<JSReceiver>> ResolveWasmImportCall(
COMPARE_SIG_FOR_BUILTIN_F64(Exp); COMPARE_SIG_FOR_BUILTIN_F64(Exp);
COMPARE_SIG_FOR_BUILTIN_F64(Log); COMPARE_SIG_FOR_BUILTIN_F64(Log);
COMPARE_SIG_FOR_BUILTIN_F64(Atan2); COMPARE_SIG_FOR_BUILTIN_F64(Atan2);
//=========================================================== COMPARE_SIG_FOR_BUILTIN_F64(Pow);
// TODO(8505): Math.pow for wasm does not match JS.
// COMPARE_SIG_FOR_BUILTIN_F64(Pow);
//===========================================================
COMPARE_SIG_FOR_BUILTIN_F32_F64(Min); COMPARE_SIG_FOR_BUILTIN_F32_F64(Min);
COMPARE_SIG_FOR_BUILTIN_F32_F64(Max); COMPARE_SIG_FOR_BUILTIN_F32_F64(Max);
COMPARE_SIG_FOR_BUILTIN_F32_F64(Abs); COMPARE_SIG_FOR_BUILTIN_F32_F64(Abs);
......
...@@ -54,9 +54,6 @@ ...@@ -54,9 +54,6 @@
# Issue 3784: setters-on-elements is flaky # Issue 3784: setters-on-elements is flaky
'setters-on-elements': [PASS, FAIL], 'setters-on-elements': [PASS, FAIL],
# Issue 8505: Math.pow is incorrect for asm.js
'regress/wasm/regress-8505': [SKIP],
# Issue 9380: Memory leaks of shared WebAssembly.Memory objects # Issue 9380: Memory leaks of shared WebAssembly.Memory objects
'wasm/shared-memory-worker-gc': [SKIP], 'wasm/shared-memory-worker-gc': [SKIP],
......
...@@ -150,18 +150,18 @@ function assertBinop(name, math_func, wasm_func) { ...@@ -150,18 +150,18 @@ function assertBinop(name, math_func, wasm_func) {
} }
let stdlib = this; let stdlib = this;
function Module_exp(stdlib) { function Module_pow(stdlib) {
"use asm"; "use asm";
var Stdlib = stdlib.Math.exp; var Stdlib = stdlib.Math.pow;
function NAME(a, b) { function pow(a, b) {
a = +a; a = +a;
b = +b; b = +b;
return +Stdlib(a, b); return +Stdlib(a, b);
} }
return {exp: exp}; return {pow: pow};
} }
function wasmBinop(name, sig) { function wasmBinop(name, sig) {
...@@ -181,8 +181,8 @@ function wasmBinop(name, sig) { ...@@ -181,8 +181,8 @@ function wasmBinop(name, sig) {
} }
function asmBinop(name) { function asmBinop(name) {
let instance = Module_exp(stdlib); let instance = Module_pow(stdlib);
assertTrue(%IsAsmWasmCode(Module_exp)); assertTrue(%IsAsmWasmCode(Module_pow));
let asm_func = instance[name]; let asm_func = instance[name];
if (typeof asm_func != "function") throw "asm[" + full_name + "] not found"; if (typeof asm_func != "function") throw "asm[" + full_name + "] not found";
...@@ -190,7 +190,7 @@ function asmBinop(name) { ...@@ -190,7 +190,7 @@ function asmBinop(name) {
} }
(function TestF64() { (function TestF64() {
let name = 'exp'; let name = 'pow';
let math_func = Math[name]; let math_func = Math[name];
let wasm_func = wasmBinop(name, kSig_d_dd); let wasm_func = wasmBinop(name, kSig_d_dd);
......
...@@ -246,7 +246,6 @@ function assertBinop(name, math_func, asm_func) { ...@@ -246,7 +246,6 @@ function assertBinop(name, math_func, asm_func) {
]; ];
for (name of f64_intrinsics) { for (name of f64_intrinsics) {
if (name == 'pow') continue; // TODO(8505): asm.js correctness
let math_func = Math[name]; let math_func = Math[name];
let f32 = false; let f32 = false;
print('Testing (f64) Math.' + name); print('Testing (f64) Math.' + name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment