зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1438727: [Part 14] Support Double DIV and Double MOD r=tcampbell
--HG-- extra : rebase_source : 6a7e5568bf2b33354c4c49fc1a10adfb0952c452
This commit is contained in:
Родитель
6e05394437
Коммит
6968e15c35
|
@ -5161,7 +5161,8 @@ bool
|
|||
BinaryArithIRGenerator::tryAttachDouble()
|
||||
{
|
||||
if (op_ != JSOP_ADD && op_ != JSOP_SUB &&
|
||||
op_ != JSOP_MUL)
|
||||
op_ != JSOP_MUL && op_ != JSOP_DIV &&
|
||||
op_ != JSOP_MOD)
|
||||
return false;
|
||||
|
||||
if (!lhs_.isDouble() || !rhs_.isDouble() || !res_.isDouble())
|
||||
|
@ -5189,6 +5190,14 @@ BinaryArithIRGenerator::tryAttachDouble()
|
|||
writer.doubleMulResult(lhsId, rhsId);
|
||||
trackAttached("BinaryArith.Double.Mul");
|
||||
break;
|
||||
case JSOP_DIV:
|
||||
writer.doubleDivResult(lhsId, rhsId);
|
||||
trackAttached("BinaryArith.Double.Div");
|
||||
break;
|
||||
case JSOP_MOD:
|
||||
writer.doubleModResult(lhsId, rhsId);
|
||||
trackAttached("BinaryArith.Double.Mod");
|
||||
break;
|
||||
default:
|
||||
MOZ_CRASH("Unhandled Op");
|
||||
}
|
||||
|
|
|
@ -295,6 +295,8 @@ extern const char* CacheKindNames[];
|
|||
_(DoubleAddResult) \
|
||||
_(DoubleSubResult) \
|
||||
_(DoubleMulResult) \
|
||||
_(DoubleDivResult) \
|
||||
_(DoubleModResult) \
|
||||
_(Int32AddResult) \
|
||||
_(Int32SubResult) \
|
||||
_(Int32MulResult) \
|
||||
|
@ -1020,6 +1022,15 @@ class MOZ_RAII CacheIRWriter : public JS::CustomAutoRooter
|
|||
writeOpWithOperandId(CacheOp::DoubleMulResult, lhsId);
|
||||
writeOperandId(rhsId);
|
||||
}
|
||||
void doubleDivResult(ValOperandId lhsId, ValOperandId rhsId) {
|
||||
writeOpWithOperandId(CacheOp::DoubleDivResult, lhsId);
|
||||
writeOperandId(rhsId);
|
||||
}
|
||||
void doubleModResult(ValOperandId lhsId, ValOperandId rhsId) {
|
||||
writeOpWithOperandId(CacheOp::DoubleModResult, lhsId);
|
||||
writeOperandId(rhsId);
|
||||
}
|
||||
|
||||
void int32AddResult(Int32OperandId lhs, Int32OperandId rhs) {
|
||||
writeOpWithOperandId(CacheOp::Int32AddResult, lhs);
|
||||
writeOperandId(rhs);
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include <utility>
|
||||
|
||||
#include "jslibmath.h"
|
||||
#include "jit/IonIC.h"
|
||||
#include "jit/SharedICHelpers.h"
|
||||
|
||||
|
@ -1997,6 +1998,47 @@ CacheIRCompiler::emitDoubleMulResult()
|
|||
|
||||
return true;
|
||||
}
|
||||
bool
|
||||
CacheIRCompiler::emitDoubleDivResult()
|
||||
{
|
||||
AutoOutputRegister output(*this);
|
||||
|
||||
allocator.loadDouble(masm, reader.valOperandId(), FloatReg0);
|
||||
allocator.loadDouble(masm, reader.valOperandId(), FloatReg1);
|
||||
|
||||
masm.divDouble(FloatReg1, FloatReg0);
|
||||
masm.boxDouble(FloatReg0, output.valueReg(), FloatReg0);
|
||||
|
||||
return true;
|
||||
}
|
||||
bool
|
||||
CacheIRCompiler::emitDoubleModResult()
|
||||
{
|
||||
AutoOutputRegister output(*this);
|
||||
AutoScratchRegisterMaybeOutput scratch(allocator, masm, output);
|
||||
|
||||
allocator.loadDouble(masm, reader.valOperandId(), FloatReg0);
|
||||
allocator.loadDouble(masm, reader.valOperandId(), FloatReg1);
|
||||
|
||||
LiveRegisterSet save(GeneralRegisterSet::Volatile(), liveVolatileFloatRegs());
|
||||
masm.PushRegsInMask(save);
|
||||
|
||||
|
||||
masm.setupUnalignedABICall(scratch);
|
||||
masm.passABIArg(FloatReg0, MoveOp::DOUBLE);
|
||||
masm.passABIArg(FloatReg1, MoveOp::DOUBLE);
|
||||
masm.callWithABI(JS_FUNC_TO_DATA_PTR(void*, js::NumberMod),
|
||||
MoveOp::DOUBLE);
|
||||
masm.storeCallFloatResult(FloatReg0);
|
||||
|
||||
LiveRegisterSet ignore;
|
||||
ignore.add(FloatReg0);
|
||||
masm.PopRegsInMaskIgnore(save, ignore);
|
||||
|
||||
masm.boxDouble(FloatReg0, output.valueReg(), FloatReg0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CacheIRCompiler::emitInt32AddResult()
|
||||
|
|
|
@ -55,6 +55,8 @@ namespace jit {
|
|||
_(DoubleAddResult) \
|
||||
_(DoubleSubResult) \
|
||||
_(DoubleMulResult) \
|
||||
_(DoubleDivResult) \
|
||||
_(DoubleModResult) \
|
||||
_(Int32AddResult) \
|
||||
_(Int32SubResult) \
|
||||
_(Int32MulResult) \
|
||||
|
|
Загрузка…
Ссылка в новой задаче