mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 900257: Inline Math.fround in IonMonkey; r=sstangl
This commit is contained in:
parent
e89c5e6c6b
commit
0e8b83129e
@ -516,6 +516,7 @@ class IonBuilder : public MIRGenerator
|
||||
InliningStatus inlineMathPow(CallInfo &callInfo);
|
||||
InliningStatus inlineMathRandom(CallInfo &callInfo);
|
||||
InliningStatus inlineMathImul(CallInfo &callInfo);
|
||||
InliningStatus inlineMathFRound(CallInfo &callInfo);
|
||||
InliningStatus inlineMathFunction(CallInfo &callInfo, MMathFunction::Function function);
|
||||
|
||||
// String natives.
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "builtin/ParallelArray.h"
|
||||
#include "builtin/TestingFunctions.h"
|
||||
#include "jit/IonBuilder.h"
|
||||
#include "jit/Lowering.h"
|
||||
#include "jit/MIR.h"
|
||||
#include "jit/MIRGraph.h"
|
||||
|
||||
@ -55,6 +56,8 @@ IonBuilder::inlineNativeCall(CallInfo &callInfo, JSNative native)
|
||||
return inlineMathRandom(callInfo);
|
||||
if (native == js::math_imul)
|
||||
return inlineMathImul(callInfo);
|
||||
if (native == js::math_fround)
|
||||
return inlineMathFRound(callInfo);
|
||||
if (native == js::math_sin)
|
||||
return inlineMathFunction(callInfo, MMathFunction::Sin);
|
||||
if (native == js::math_cos)
|
||||
@ -811,6 +814,33 @@ IonBuilder::inlineMathImul(CallInfo &callInfo)
|
||||
return InliningStatus_Inlined;
|
||||
}
|
||||
|
||||
IonBuilder::InliningStatus
|
||||
IonBuilder::inlineMathFRound(CallInfo &callInfo)
|
||||
{
|
||||
if (!LIRGenerator::allowFloat32Optimizations())
|
||||
return InliningStatus_NotInlined;
|
||||
|
||||
if (callInfo.argc() != 1 || callInfo.constructing())
|
||||
return InliningStatus_NotInlined;
|
||||
|
||||
// MIRType can't be Float32, as this point, as getInlineReturnType uses JSVal types
|
||||
// to infer the returned MIR type.
|
||||
MIRType returnType = getInlineReturnType();
|
||||
if (!IsNumberType(returnType))
|
||||
return InliningStatus_NotInlined;
|
||||
|
||||
MIRType arg = callInfo.getArg(0)->type();
|
||||
if (!IsNumberType(arg))
|
||||
return InliningStatus_NotInlined;
|
||||
|
||||
callInfo.unwrapArgs();
|
||||
|
||||
MToFloat32 *ins = MToFloat32::New(callInfo.getArg(0));
|
||||
current->add(ins);
|
||||
current->push(ins);
|
||||
return InliningStatus_Inlined;
|
||||
}
|
||||
|
||||
IonBuilder::InliningStatus
|
||||
IonBuilder::inlineMathMinMax(CallInfo &callInfo, bool max)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user