зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1661256 part 17 - Convert UnaryMathFunction to use DynamicFunction. r=mgaudet
Differential Revision: https://phabricator.services.mozilla.com/D91797
This commit is contained in:
Родитель
ad12c6c649
Коммит
d2db13a608
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include "jslibmath.h" // js::NumberMod
|
||||
#include "jsmath.h" // js::ecmaPow, js::ecmaHypot, js::hypot3, js::hypot4,
|
||||
// js::ecmaAtan2, js::powi
|
||||
// js::ecmaAtan2, js::UnaryMathFunctionType, js::powi
|
||||
#include "builtin/Array.h" // js::ArrayShiftMoveElements
|
||||
#include "builtin/RegExp.h" // js::RegExpPrototypeOptimizableRaw,
|
||||
// js::RegExpInstanceOptimizableRaw
|
||||
|
@ -91,6 +91,8 @@ namespace jit {
|
|||
// List of all ABI function signature which are using a computed function
|
||||
// pointer instead of a statically known function pointer.
|
||||
#define ABIFUNCTIONSIG_LIST(_) \
|
||||
_(float (*)(float)) \
|
||||
_(js::UnaryMathFunctionType) \
|
||||
_(void (*)(JSRuntime * rt, JSObject * *objp)) \
|
||||
_(void (*)(JSRuntime * rt, JSString * *stringp)) \
|
||||
_(void (*)(JSRuntime * rt, ObjectGroup * *groupp)) \
|
||||
|
|
|
@ -4692,7 +4692,8 @@ bool CacheIRCompiler::emitMathFunctionNumberResultShared(
|
|||
|
||||
masm.setupUnalignedABICall(output.scratchReg());
|
||||
masm.passABIArg(inputScratch, MoveOp::DOUBLE);
|
||||
masm.callWithABI(JS_FUNC_TO_DATA_PTR(void*, funPtr), MoveOp::DOUBLE);
|
||||
masm.callWithABI(DynamicFunction<UnaryMathFunctionType>(funPtr),
|
||||
MoveOp::DOUBLE);
|
||||
masm.storeCallFloatResult(inputScratch);
|
||||
|
||||
masm.PopRegsInMask(save);
|
||||
|
|
|
@ -8922,7 +8922,8 @@ void CodeGenerator::visitMathFunctionD(LMathFunctionD* ins) {
|
|||
masm.setupUnalignedABICall(temp);
|
||||
|
||||
masm.passABIArg(input, MoveOp::DOUBLE);
|
||||
masm.callWithABI(JS_FUNC_TO_DATA_PTR(void*, funPtr), MoveOp::DOUBLE);
|
||||
masm.callWithABI(DynamicFunction<UnaryMathFunctionType>(funPtr),
|
||||
MoveOp::DOUBLE);
|
||||
}
|
||||
|
||||
void CodeGenerator::visitMathFunctionF(LMathFunctionF* ins) {
|
||||
|
@ -8933,28 +8934,29 @@ void CodeGenerator::visitMathFunctionF(LMathFunctionF* ins) {
|
|||
masm.setupUnalignedABICall(temp);
|
||||
masm.passABIArg(input, MoveOp::FLOAT32);
|
||||
|
||||
void* funptr = nullptr;
|
||||
using Fn = float (*)(float x);
|
||||
Fn funptr = nullptr;
|
||||
CheckUnsafeCallWithABI check = CheckUnsafeCallWithABI::Check;
|
||||
switch (ins->mir()->function()) {
|
||||
case UnaryMathFunction::Floor:
|
||||
funptr = JS_FUNC_TO_DATA_PTR(void*, floorf);
|
||||
funptr = floorf;
|
||||
check = CheckUnsafeCallWithABI::DontCheckOther;
|
||||
break;
|
||||
case UnaryMathFunction::Round:
|
||||
funptr = JS_FUNC_TO_DATA_PTR(void*, math_roundf_impl);
|
||||
funptr = math_roundf_impl;
|
||||
break;
|
||||
case UnaryMathFunction::Trunc:
|
||||
funptr = JS_FUNC_TO_DATA_PTR(void*, math_truncf_impl);
|
||||
funptr = math_truncf_impl;
|
||||
break;
|
||||
case UnaryMathFunction::Ceil:
|
||||
funptr = JS_FUNC_TO_DATA_PTR(void*, ceilf);
|
||||
funptr = ceilf;
|
||||
check = CheckUnsafeCallWithABI::DontCheckOther;
|
||||
break;
|
||||
default:
|
||||
MOZ_CRASH("Unknown or unsupported float32 math function");
|
||||
}
|
||||
|
||||
masm.callWithABI(funptr, MoveOp::FLOAT32, check);
|
||||
masm.callWithABI(DynamicFunction<Fn>(funptr), MoveOp::FLOAT32, check);
|
||||
}
|
||||
|
||||
void CodeGenerator::visitModD(LModD* ins) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче