From 2e23622f38bccb76014e93a3ac5aecef1ed4d121 Mon Sep 17 00:00:00 2001 From: David Caabeiro Date: Mon, 15 Jul 2013 10:03:14 -0500 Subject: [PATCH] Bug 717379, part 2 - Add JIT support for new ES6 Math functions, except Math.hypot(). r=jorendorff. --HG-- extra : rebase_source : f92507aa60224c3383968c96cfb29c6ba2ae8105 --- js/src/ion/CodeGenerator.cpp | 39 ++++++++++++++++++++++++++++++++++++ js/src/ion/MCallOptimize.cpp | 26 ++++++++++++++++++++++++ js/src/ion/MIR.h | 15 +++++++++++++- 3 files changed, 79 insertions(+), 1 deletion(-) diff --git a/js/src/ion/CodeGenerator.cpp b/js/src/ion/CodeGenerator.cpp index 7d2c44dca9dc..77cf4669c04d 100644 --- a/js/src/ion/CodeGenerator.cpp +++ b/js/src/ion/CodeGenerator.cpp @@ -3571,6 +3571,45 @@ CodeGenerator::visitMathFunctionD(LMathFunctionD *ins) case MMathFunction::ACos: funptr = JS_FUNC_TO_DATA_PTR(void *, js::math_acos_impl); break; + case MMathFunction::Log10: + funptr = JS_FUNC_TO_DATA_PTR(void *, js::math_log10_impl); + break; + case MMathFunction::Log2: + funptr = JS_FUNC_TO_DATA_PTR(void *, js::math_log2_impl); + break; + case MMathFunction::Log1P: + funptr = JS_FUNC_TO_DATA_PTR(void *, js::math_log1p_impl); + break; + case MMathFunction::ExpM1: + funptr = JS_FUNC_TO_DATA_PTR(void *, js::math_expm1_impl); + break; + case MMathFunction::CosH: + funptr = JS_FUNC_TO_DATA_PTR(void *, js::math_cosh_impl); + break; + case MMathFunction::SinH: + funptr = JS_FUNC_TO_DATA_PTR(void *, js::math_sinh_impl); + break; + case MMathFunction::TanH: + funptr = JS_FUNC_TO_DATA_PTR(void *, js::math_tanh_impl); + break; + case MMathFunction::ACosH: + funptr = JS_FUNC_TO_DATA_PTR(void *, js::math_acosh_impl); + break; + case MMathFunction::ASinH: + funptr = JS_FUNC_TO_DATA_PTR(void *, js::math_asinh_impl); + break; + case MMathFunction::ATanH: + funptr = JS_FUNC_TO_DATA_PTR(void *, js::math_atanh_impl); + break; + case MMathFunction::Sign: + funptr = JS_FUNC_TO_DATA_PTR(void *, js::math_sign_impl); + break; + case MMathFunction::Trunc: + funptr = JS_FUNC_TO_DATA_PTR(void *, js::math_trunc_impl); + break; + case MMathFunction::Cbrt: + funptr = JS_FUNC_TO_DATA_PTR(void *, js::math_cbrt_impl); + break; default: MOZ_ASSUME_UNREACHABLE("Unknown math function"); } diff --git a/js/src/ion/MCallOptimize.cpp b/js/src/ion/MCallOptimize.cpp index 0e44338f0058..6426451b6820 100644 --- a/js/src/ion/MCallOptimize.cpp +++ b/js/src/ion/MCallOptimize.cpp @@ -72,6 +72,32 @@ IonBuilder::inlineNativeCall(CallInfo &callInfo, JSNative native) return inlineMathFunction(callInfo, MMathFunction::ASin); if (native == js::math_acos) return inlineMathFunction(callInfo, MMathFunction::ACos); + if (native == js::math_log10) + return inlineMathFunction(callInfo, MMathFunction::Log10); + if (native == js::math_log2) + return inlineMathFunction(callInfo, MMathFunction::Log2); + if (native == js::math_log1p) + return inlineMathFunction(callInfo, MMathFunction::Log1P); + if (native == js::math_expm1) + return inlineMathFunction(callInfo, MMathFunction::ExpM1); + if (native == js::math_cosh) + return inlineMathFunction(callInfo, MMathFunction::CosH); + if (native == js::math_sin) + return inlineMathFunction(callInfo, MMathFunction::SinH); + if (native == js::math_tan) + return inlineMathFunction(callInfo, MMathFunction::TanH); + if (native == js::math_acosh) + return inlineMathFunction(callInfo, MMathFunction::ACosH); + if (native == js::math_asin) + return inlineMathFunction(callInfo, MMathFunction::ASinH); + if (native == js::math_atan) + return inlineMathFunction(callInfo, MMathFunction::ATanH); + if (native == js::math_sign) + return inlineMathFunction(callInfo, MMathFunction::Sign); + if (native == js::math_trunc) + return inlineMathFunction(callInfo, MMathFunction::Trunc); + if (native == js::math_cbrt) + return inlineMathFunction(callInfo, MMathFunction::Cbrt); // String natives. if (native == js_String) diff --git a/js/src/ion/MIR.h b/js/src/ion/MIR.h index 3ad2362e2a0e..b61fac70d931 100644 --- a/js/src/ion/MIR.h +++ b/js/src/ion/MIR.h @@ -3206,7 +3206,20 @@ class MMathFunction Tan, ACos, ASin, - ATan + ATan, + Log10, + Log2, + Log1P, + ExpM1, + CosH, + SinH, + TanH, + ACosH, + ASinH, + ATanH, + Sign, + Trunc, + Cbrt }; private: