зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1561732: Remove sincos optimization r=mgaudet
Differential Revision: https://phabricator.services.mozilla.com/D36976 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
2cf9034d70
Коммит
64cafcc6db
|
@ -9184,32 +9184,6 @@ void CodeGenerator::visitStringConvertCase(LStringConvertCase* lir) {
|
|||
}
|
||||
}
|
||||
|
||||
void CodeGenerator::visitSinCos(LSinCos* lir) {
|
||||
Register temp = ToRegister(lir->temp());
|
||||
Register params = ToRegister(lir->temp2());
|
||||
FloatRegister input = ToFloatRegister(lir->input());
|
||||
FloatRegister outputSin = ToFloatRegister(lir->outputSin());
|
||||
FloatRegister outputCos = ToFloatRegister(lir->outputCos());
|
||||
|
||||
masm.reserveStack(sizeof(double) * 2);
|
||||
masm.moveStackPtrTo(params);
|
||||
|
||||
masm.setupUnalignedABICall(temp);
|
||||
|
||||
masm.passABIArg(input, MoveOp::DOUBLE);
|
||||
masm.passABIArg(
|
||||
MoveOperand(params, sizeof(double), MoveOperand::EFFECTIVE_ADDRESS),
|
||||
MoveOp::GENERAL);
|
||||
masm.passABIArg(MoveOperand(params, 0, MoveOperand::EFFECTIVE_ADDRESS),
|
||||
MoveOp::GENERAL);
|
||||
|
||||
masm.callWithABI(JS_FUNC_TO_DATA_PTR(void*, js::math_sincos_impl));
|
||||
|
||||
masm.loadDouble(Address(masm.getStackPointer(), 0), outputCos);
|
||||
masm.loadDouble(Address(masm.getStackPointer(), sizeof(double)), outputSin);
|
||||
masm.freeStack(sizeof(double) * 2);
|
||||
}
|
||||
|
||||
void CodeGenerator::visitStringSplit(LStringSplit* lir) {
|
||||
pushArg(Imm32(INT32_MAX));
|
||||
pushArg(ToRegister(lir->separator()));
|
||||
|
|
|
@ -1046,122 +1046,6 @@ void IonScript::purgeICs(Zone* zone) {
|
|||
namespace js {
|
||||
namespace jit {
|
||||
|
||||
static void OptimizeSinCos(MIRGraph& graph) {
|
||||
// Now, we are looking for:
|
||||
// var y = sin(x);
|
||||
// var z = cos(x);
|
||||
// Graph before:
|
||||
// - 1 op
|
||||
// - 6 mathfunction op1 Sin
|
||||
// - 7 mathfunction op1 Cos
|
||||
// Graph will look like:
|
||||
// - 1 op
|
||||
// - 5 sincos op1
|
||||
// - 6 mathfunction sincos5 Sin
|
||||
// - 7 mathfunction sincos5 Cos
|
||||
for (MBasicBlockIterator block(graph.begin()); block != graph.end();
|
||||
block++) {
|
||||
for (MInstructionIterator iter(block->begin()), end(block->end());
|
||||
iter != end;) {
|
||||
MInstruction* ins = *iter++;
|
||||
if (!ins->isMathFunction() || ins->isRecoveredOnBailout()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
MMathFunction* insFunc = ins->toMathFunction();
|
||||
if (insFunc->function() != MMathFunction::Sin &&
|
||||
insFunc->function() != MMathFunction::Cos) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check if sin/cos is already optimized.
|
||||
if (insFunc->getOperand(0)->type() == MIRType::SinCosDouble) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// insFunc is either a |sin(x)| or |cos(x)| instruction. The
|
||||
// following loop iterates over the uses of |x| to check if both
|
||||
// |sin(x)| and |cos(x)| instructions exist.
|
||||
bool hasSin = false;
|
||||
bool hasCos = false;
|
||||
for (MUseDefIterator uses(insFunc->input()); uses; uses++) {
|
||||
if (!uses.def()->isInstruction()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// We should replacing the argument of the sin/cos just when it
|
||||
// is dominated by the |block|.
|
||||
if (!block->dominates(uses.def()->block())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
MInstruction* insUse = uses.def()->toInstruction();
|
||||
if (!insUse->isMathFunction() || insUse->isRecoveredOnBailout()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
MMathFunction* mathIns = insUse->toMathFunction();
|
||||
if (!hasSin && mathIns->function() == MMathFunction::Sin) {
|
||||
hasSin = true;
|
||||
JitSpew(JitSpew_Sincos, "Found sin in block %d.",
|
||||
mathIns->block()->id());
|
||||
} else if (!hasCos && mathIns->function() == MMathFunction::Cos) {
|
||||
hasCos = true;
|
||||
JitSpew(JitSpew_Sincos, "Found cos in block %d.",
|
||||
mathIns->block()->id());
|
||||
}
|
||||
|
||||
if (hasCos && hasSin) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasCos || !hasSin) {
|
||||
JitSpew(JitSpew_Sincos, "No sin/cos pair found.");
|
||||
continue;
|
||||
}
|
||||
|
||||
JitSpew(JitSpew_Sincos,
|
||||
"Found, at least, a pair sin/cos. Adding sincos in block %d",
|
||||
block->id());
|
||||
// Adding the MSinCos and replacing the parameters of the
|
||||
// sin(x)/cos(x) to sin(sincos(x))/cos(sincos(x)).
|
||||
MSinCos* insSinCos = MSinCos::New(graph.alloc(), insFunc->input());
|
||||
insSinCos->setImplicitlyUsedUnchecked();
|
||||
block->insertBefore(insFunc, insSinCos);
|
||||
for (MUseDefIterator uses(insFunc->input()); uses;) {
|
||||
MDefinition* def = uses.def();
|
||||
uses++;
|
||||
if (!def->isInstruction()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// We should replacing the argument of the sin/cos just when it
|
||||
// is dominated by the |block|.
|
||||
if (!block->dominates(def->block())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
MInstruction* insUse = def->toInstruction();
|
||||
if (!insUse->isMathFunction() || insUse->isRecoveredOnBailout()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
MMathFunction* mathIns = insUse->toMathFunction();
|
||||
if (mathIns->function() != MMathFunction::Sin &&
|
||||
mathIns->function() != MMathFunction::Cos) {
|
||||
continue;
|
||||
}
|
||||
|
||||
mathIns->replaceOperand(0, insSinCos);
|
||||
JitSpew(JitSpew_Sincos, "Replacing %s by sincos in block %d",
|
||||
mathIns->function() == MMathFunction::Sin ? "sin" : "cos",
|
||||
mathIns->block()->id());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool OptimizeMIR(MIRGenerator* mir) {
|
||||
MIRGraph& graph = mir->graph();
|
||||
GraphSpewer& gs = mir->graphSpewer();
|
||||
|
@ -1522,17 +1406,6 @@ bool OptimizeMIR(MIRGenerator* mir) {
|
|||
}
|
||||
}
|
||||
|
||||
if (mir->optimizationInfo().sincosEnabled()) {
|
||||
AutoTraceLog log(logger, TraceLogger_Sincos);
|
||||
OptimizeSinCos(graph);
|
||||
gs.spewPass("Sincos optimization");
|
||||
AssertExtendedGraphCoherency(graph);
|
||||
|
||||
if (mir->shouldCancel("Sincos optimization")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// BCE marks bounds checks as dead, so do BCE before DCE.
|
||||
if (mir->compilingWasm()) {
|
||||
if (!EliminateBoundsChecks(mir, graph)) {
|
||||
|
|
|
@ -3234,7 +3234,6 @@ static bool IsResumableMIRType(MIRType type) {
|
|||
case MIRType::Shape:
|
||||
case MIRType::ObjectGroup:
|
||||
case MIRType::Doublex2: // NYI, see also RSimdBox::recover
|
||||
case MIRType::SinCosDouble:
|
||||
case MIRType::Int64:
|
||||
case MIRType::RefOrNull:
|
||||
return false;
|
||||
|
|
|
@ -31,7 +31,6 @@ void OptimizationInfo::initNormalOptimizationInfo() {
|
|||
rangeAnalysis_ = true;
|
||||
reordering_ = true;
|
||||
scalarReplacement_ = true;
|
||||
sincos_ = true;
|
||||
sink_ = true;
|
||||
|
||||
registerAllocator_ = RegisterAllocator_Backtracking;
|
||||
|
@ -73,7 +72,6 @@ void OptimizationInfo::initWasmOptimizationInfo() {
|
|||
edgeCaseAnalysis_ = false;
|
||||
eliminateRedundantChecks_ = false;
|
||||
scalarReplacement_ = false; // wasm has no objects.
|
||||
sincos_ = false;
|
||||
sink_ = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -97,9 +97,6 @@ class OptimizationInfo {
|
|||
// Toggles whether Truncation based on Range Analysis is used.
|
||||
bool autoTruncate_;
|
||||
|
||||
// Toggles whether sincos is used.
|
||||
bool sincos_;
|
||||
|
||||
// Toggles whether sink is used.
|
||||
bool sink_;
|
||||
|
||||
|
@ -179,7 +176,6 @@ class OptimizationInfo {
|
|||
rangeAnalysis_(false),
|
||||
reordering_(false),
|
||||
autoTruncate_(false),
|
||||
sincos_(false),
|
||||
sink_(false),
|
||||
registerAllocator_(RegisterAllocator_Backtracking),
|
||||
inlineMaxBytecodePerCallSiteHelperThread_(0),
|
||||
|
@ -228,8 +224,6 @@ class OptimizationInfo {
|
|||
return autoTruncate_ && rangeAnalysisEnabled();
|
||||
}
|
||||
|
||||
bool sincosEnabled() const { return sincos_ && !JitOptions.disableSincos; }
|
||||
|
||||
bool sinkEnabled() const { return sink_ && !JitOptions.disableSink; }
|
||||
|
||||
bool eaaEnabled() const { return eaa_ && !JitOptions.disableEaa; }
|
||||
|
|
|
@ -459,7 +459,6 @@ enum class MIRType : uint8_t {
|
|||
MagicUninitializedLexical, // JS_UNINITIALIZED_LEXICAL magic value.
|
||||
// Types above are specialized.
|
||||
Value,
|
||||
SinCosDouble, // Optimizing a sin/cos to sincos.
|
||||
ObjectOrNull,
|
||||
None, // Invalid, used as a placeholder.
|
||||
Slots, // A slots vector
|
||||
|
@ -602,8 +601,6 @@ static inline const char* StringFromMIRType(MIRType type) {
|
|||
return "MagicUninitializedLexical";
|
||||
case MIRType::Value:
|
||||
return "Value";
|
||||
case MIRType::SinCosDouble:
|
||||
return "SinCosDouble";
|
||||
case MIRType::ObjectOrNull:
|
||||
return "ObjectOrNull";
|
||||
case MIRType::None:
|
||||
|
|
|
@ -122,14 +122,6 @@ DefaultJitOptions::DefaultJitOptions() {
|
|||
// Toggles whether CacheIR stubs are used.
|
||||
SET_DEFAULT(disableCacheIR, false);
|
||||
|
||||
// Toggles whether sincos optimization is globally disabled.
|
||||
// See bug984018: The MacOS is the only one that has the sincos fast.
|
||||
#if defined(XP_MACOSX)
|
||||
SET_DEFAULT(disableSincos, false);
|
||||
#else
|
||||
SET_DEFAULT(disableSincos, true);
|
||||
#endif
|
||||
|
||||
// Toggles whether sink code motion is globally disabled.
|
||||
SET_DEFAULT(disableSink, true);
|
||||
|
||||
|
|
|
@ -57,7 +57,6 @@ struct DefaultJitOptions {
|
|||
bool disableRecoverIns;
|
||||
bool disableScalarReplacement;
|
||||
bool disableCacheIR;
|
||||
bool disableSincos;
|
||||
bool disableSink;
|
||||
bool disableOptimizationLevels;
|
||||
bool baselineInterpreter;
|
||||
|
|
|
@ -359,7 +359,6 @@ static void PrintHelpAndExit(int status = 0) {
|
|||
" licm Loop invariant code motion\n"
|
||||
" flac Fold linear arithmetic constants\n"
|
||||
" eaa Effective address analysis\n"
|
||||
" sincos Replace sin/cos by sincos\n"
|
||||
" sink Sink transformation\n"
|
||||
" regalloc Register allocation\n"
|
||||
" inline Inlining\n"
|
||||
|
@ -447,8 +446,6 @@ void jit::CheckLogging() {
|
|||
EnableChannel(JitSpew_FLAC);
|
||||
} else if (IsFlag(found, "eaa")) {
|
||||
EnableChannel(JitSpew_EAA);
|
||||
} else if (IsFlag(found, "sincos")) {
|
||||
EnableChannel(JitSpew_Sincos);
|
||||
} else if (IsFlag(found, "sink")) {
|
||||
EnableChannel(JitSpew_Sink);
|
||||
} else if (IsFlag(found, "regalloc")) {
|
||||
|
|
|
@ -33,8 +33,6 @@ namespace jit {
|
|||
_(AliasSummaries) \
|
||||
/* Information during GVN */ \
|
||||
_(GVN) \
|
||||
/* Information during sincos */ \
|
||||
_(Sincos) \
|
||||
/* Information during sinking */ \
|
||||
_(Sink) \
|
||||
/* Information during Range analysis */ \
|
||||
|
|
|
@ -367,8 +367,6 @@ static const char* DefTypeName(LDefinition::Type type) {
|
|||
return "simd128int";
|
||||
case LDefinition::SIMD128FLOAT:
|
||||
return "simd128float";
|
||||
case LDefinition::SINCOS:
|
||||
return "sincos";
|
||||
# ifdef JS_NUNBOX32
|
||||
case LDefinition::TYPE:
|
||||
return "t";
|
||||
|
|
|
@ -410,7 +410,6 @@ class LDefinition {
|
|||
DOUBLE, // 64-bit floating-point value (FPU).
|
||||
SIMD128INT, // 128-bit SIMD integer vector (FPU).
|
||||
SIMD128FLOAT, // 128-bit SIMD floating point vector (FPU).
|
||||
SINCOS,
|
||||
#ifdef JS_NUNBOX32
|
||||
// A type virtual register must be followed by a payload virtual
|
||||
// register, as both will be tracked as a single gcthing.
|
||||
|
@ -538,8 +537,6 @@ class LDefinition {
|
|||
case MIRType::Value:
|
||||
return LDefinition::BOX;
|
||||
#endif
|
||||
case MIRType::SinCosDouble:
|
||||
return LDefinition::SINCOS;
|
||||
case MIRType::Slots:
|
||||
case MIRType::Elements:
|
||||
return LDefinition::SLOTS;
|
||||
|
|
|
@ -1568,14 +1568,7 @@ void LIRGenerator::visitSign(MSign* ins) {
|
|||
|
||||
void LIRGenerator::visitMathFunction(MMathFunction* ins) {
|
||||
MOZ_ASSERT(IsFloatingPointType(ins->type()));
|
||||
MOZ_ASSERT_IF(ins->input()->type() != MIRType::SinCosDouble,
|
||||
ins->type() == ins->input()->type());
|
||||
|
||||
if (ins->input()->type() == MIRType::SinCosDouble) {
|
||||
MOZ_ASSERT(ins->type() == MIRType::Double);
|
||||
redefine(ins, ins->input(), ins->function());
|
||||
return;
|
||||
}
|
||||
MOZ_ASSERT(ins->type() == ins->input()->type());
|
||||
|
||||
LInstruction* lir;
|
||||
if (ins->type() == MIRType::Double) {
|
||||
|
@ -3409,18 +3402,6 @@ void LIRGenerator::visitArrayJoin(MArrayJoin* ins) {
|
|||
assignSafepoint(lir, ins);
|
||||
}
|
||||
|
||||
void LIRGenerator::visitSinCos(MSinCos* ins) {
|
||||
MOZ_ASSERT(ins->type() == MIRType::SinCosDouble);
|
||||
MOZ_ASSERT(ins->input()->type() == MIRType::Double ||
|
||||
ins->input()->type() == MIRType::Float32 ||
|
||||
ins->input()->type() == MIRType::Int32);
|
||||
|
||||
LSinCos* lir = new (alloc()) LSinCos(useRegisterAtStart(ins->input()),
|
||||
tempFixed(CallTempNonArgRegs[0]),
|
||||
tempFixed(CallTempNonArgRegs[1]));
|
||||
defineSinCos(lir, ins);
|
||||
}
|
||||
|
||||
void LIRGenerator::visitStringSplit(MStringSplit* ins) {
|
||||
MOZ_ASSERT(ins->type() == MIRType::Object);
|
||||
MOZ_ASSERT(ins->string()->type() == MIRType::String);
|
||||
|
|
|
@ -5231,9 +5231,6 @@ class MMathFunction : public MUnaryInstruction,
|
|||
MOZ_MUST_USE bool writeRecoverData(
|
||||
CompactBufferWriter& writer) const override;
|
||||
bool canRecoverOnBailout() const override {
|
||||
if (input()->type() == MIRType::SinCosDouble) {
|
||||
return false;
|
||||
}
|
||||
switch (function_) {
|
||||
case Sin:
|
||||
case Log:
|
||||
|
@ -5801,26 +5798,6 @@ class MStringConvertCase : public MUnaryInstruction,
|
|||
Mode mode() const { return mode_; }
|
||||
};
|
||||
|
||||
class MSinCos : public MUnaryInstruction, public FloatingPointPolicy<0>::Data {
|
||||
explicit MSinCos(MDefinition* input) : MUnaryInstruction(classOpcode, input) {
|
||||
setResultType(MIRType::SinCosDouble);
|
||||
specialization_ = MIRType::Double;
|
||||
setMovable();
|
||||
}
|
||||
|
||||
public:
|
||||
INSTRUCTION_HEADER(SinCos)
|
||||
|
||||
static MSinCos* New(TempAllocator& alloc, MDefinition* input) {
|
||||
return new (alloc) MSinCos(input);
|
||||
}
|
||||
AliasSet getAliasSet() const override { return AliasSet::None(); }
|
||||
bool congruentTo(const MDefinition* ins) const override {
|
||||
return congruentIfOperandsEqual(ins);
|
||||
}
|
||||
bool possiblyCalls() const override { return true; }
|
||||
};
|
||||
|
||||
class MStringSplit : public MBinaryInstruction,
|
||||
public MixPolicy<StringPolicy<0>, StringPolicy<1>>::Data {
|
||||
CompilerObjectGroup group_;
|
||||
|
|
|
@ -88,7 +88,6 @@ class StackSlotAllocator {
|
|||
#endif
|
||||
case LDefinition::DOUBLE:
|
||||
return 8;
|
||||
case LDefinition::SINCOS:
|
||||
case LDefinition::SIMD128INT:
|
||||
case LDefinition::SIMD128FLOAT:
|
||||
return 16;
|
||||
|
|
|
@ -601,7 +601,7 @@ template <unsigned Op>
|
|||
bool DoublePolicy<Op>::staticAdjustInputs(TempAllocator& alloc,
|
||||
MInstruction* def) {
|
||||
MDefinition* in = def->getOperand(Op);
|
||||
if (in->type() == MIRType::Double || in->type() == MIRType::SinCosDouble) {
|
||||
if (in->type() == MIRType::Double) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -2843,26 +2843,6 @@ class LStringConvertCase : public LCallInstructionHelper<1, 1, 0> {
|
|||
const LAllocation* string() { return this->getOperand(0); }
|
||||
};
|
||||
|
||||
// Calculates sincos(x) and returns two values (sin/cos).
|
||||
class LSinCos : public LCallInstructionHelper<2, 1, 2> {
|
||||
public:
|
||||
LIR_HEADER(SinCos)
|
||||
|
||||
LSinCos(const LAllocation& input, const LDefinition& temp,
|
||||
const LDefinition& temp2)
|
||||
: LCallInstructionHelper(classOpcode) {
|
||||
setOperand(0, input);
|
||||
setTemp(0, temp);
|
||||
setTemp(1, temp2);
|
||||
}
|
||||
const LAllocation* input() { return getOperand(0); }
|
||||
const LDefinition* outputSin() { return getDef(0); }
|
||||
const LDefinition* outputCos() { return getDef(1); }
|
||||
const LDefinition* temp() { return getTemp(0); }
|
||||
const LDefinition* temp2() { return getTemp(1); }
|
||||
const MSinCos* mir() const { return mir_->toSinCos(); }
|
||||
};
|
||||
|
||||
class LStringSplit : public LCallInstructionHelper<1, 2, 0> {
|
||||
public:
|
||||
LIR_HEADER(StringSplit)
|
||||
|
|
|
@ -316,42 +316,6 @@ void LIRGeneratorShared::defineReturn(LInstruction* lir, MDefinition* mir) {
|
|||
add(lir);
|
||||
}
|
||||
|
||||
template <size_t Ops, size_t Temps>
|
||||
void LIRGeneratorShared::defineSinCos(LInstructionHelper<2, Ops, Temps>* lir,
|
||||
MDefinition* mir,
|
||||
LDefinition::Policy policy) {
|
||||
MOZ_ASSERT(lir->isCall());
|
||||
|
||||
uint32_t vreg = getVirtualRegister();
|
||||
lir->setDef(
|
||||
0, LDefinition(vreg, LDefinition::DOUBLE, LFloatReg(ReturnDoubleReg)));
|
||||
#if defined(JS_CODEGEN_ARM)
|
||||
lir->setDef(1, LDefinition(vreg + VREG_INCREMENT, LDefinition::DOUBLE,
|
||||
LFloatReg(FloatRegister(FloatRegisters::d1,
|
||||
FloatRegister::Double))));
|
||||
#elif defined(JS_CODEGEN_ARM64)
|
||||
lir->setDef(1, LDefinition(vreg + VREG_INCREMENT, LDefinition::DOUBLE,
|
||||
LFloatReg(FloatRegister(FloatRegisters::d1,
|
||||
FloatRegisters::Double))));
|
||||
#elif defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
|
||||
lir->setDef(1, LDefinition(vreg + VREG_INCREMENT, LDefinition::DOUBLE,
|
||||
LFloatReg(f2)));
|
||||
#elif defined(JS_CODEGEN_NONE)
|
||||
MOZ_CRASH();
|
||||
#elif defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
|
||||
lir->setDef(1, LDefinition(vreg + VREG_INCREMENT, LDefinition::DOUBLE,
|
||||
LFloatReg(xmm1)));
|
||||
#else
|
||||
# error "Unsupported architecture for SinCos"
|
||||
#endif
|
||||
|
||||
getVirtualRegister();
|
||||
|
||||
lir->setMir(mir);
|
||||
mir->setVirtualRegister(vreg);
|
||||
add(lir);
|
||||
}
|
||||
|
||||
// In LIR, we treat booleans and integers as the same low-level type (INTEGER).
|
||||
// When snapshotting, we recover the actual JS type from MIR. This function
|
||||
// checks that when making redefinitions, we don't accidentally coerce two
|
||||
|
@ -367,30 +331,6 @@ static inline bool IsCompatibleLIRCoercion(MIRType to, MIRType from) {
|
|||
return false;
|
||||
}
|
||||
|
||||
// We can redefine the sin(x) and cos(x) function to return the sincos result.
|
||||
void LIRGeneratorShared::redefine(MDefinition* def, MDefinition* as,
|
||||
MMathFunction::Function func) {
|
||||
MOZ_ASSERT(def->isMathFunction());
|
||||
MOZ_ASSERT(def->type() == MIRType::Double &&
|
||||
as->type() == MIRType::SinCosDouble);
|
||||
MOZ_ASSERT(MMathFunction::Sin == func || MMathFunction::Cos == func);
|
||||
|
||||
ensureDefined(as);
|
||||
MMathFunction* math = def->toMathFunction();
|
||||
|
||||
MOZ_ASSERT(math->function() == MMathFunction::Cos ||
|
||||
math->function() == MMathFunction::Sin);
|
||||
|
||||
// The sincos returns two values:
|
||||
// - VREG: it returns the sin's value of the sincos;
|
||||
// - VREG + VREG_INCREMENT: it returns the cos' value of the sincos.
|
||||
if (math->function() == MMathFunction::Sin) {
|
||||
def->setVirtualRegister(as->virtualRegister());
|
||||
} else {
|
||||
def->setVirtualRegister(as->virtualRegister() + VREG_INCREMENT);
|
||||
}
|
||||
}
|
||||
|
||||
void LIRGeneratorShared::redefine(MDefinition* def, MDefinition* as) {
|
||||
MOZ_ASSERT(IsCompatibleLIRCoercion(def->type(), as->type()));
|
||||
|
||||
|
|
|
@ -181,11 +181,6 @@ class LIRGeneratorShared {
|
|||
LInstructionHelper<INT64_PIECES, Ops, Temps>* lir, MDefinition* mir,
|
||||
const LInt64Allocation& output);
|
||||
|
||||
template <size_t Ops, size_t Temps>
|
||||
inline void defineSinCos(LInstructionHelper<2, Ops, Temps>* lir,
|
||||
MDefinition* mir,
|
||||
LDefinition::Policy policy = LDefinition::REGISTER);
|
||||
|
||||
inline void defineReturn(LInstruction* lir, MDefinition* mir);
|
||||
|
||||
template <size_t X>
|
||||
|
@ -251,10 +246,6 @@ class LIRGeneratorShared {
|
|||
// virtual register as |as|.
|
||||
inline void redefine(MDefinition* ins, MDefinition* as);
|
||||
|
||||
// Redefine a sin/cos call to sincos.
|
||||
inline void redefine(MDefinition* def, MDefinition* as,
|
||||
MMathFunction::Function func);
|
||||
|
||||
template <typename LClass, typename... Args>
|
||||
inline LClass* allocateVariadic(uint32_t numOperands, Args&&... args);
|
||||
|
||||
|
|
|
@ -615,18 +615,6 @@ bool js::math_sin(JSContext* cx, unsigned argc, Value* vp) {
|
|||
return math_function<math_sin_impl>(cx, argc, vp);
|
||||
}
|
||||
|
||||
void js::math_sincos_impl(double x, double* sin, double* cos) {
|
||||
AutoUnsafeCallWithABI unsafe;
|
||||
#if defined(HAVE_SINCOS)
|
||||
sincos(x, sin, cos);
|
||||
#elif defined(HAVE___SINCOS)
|
||||
__sincos(x, sin, cos);
|
||||
#else
|
||||
*sin = js::math_sin_impl(x);
|
||||
*cos = js::math_cos_impl(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
double js::math_sqrt_impl(double x) {
|
||||
AutoUnsafeCallWithABI unsafe(UnsafeABIStrictness::AllowPendingExceptions);
|
||||
return sqrt(x);
|
||||
|
|
|
@ -63,8 +63,6 @@ extern bool math_pow(JSContext* cx, unsigned argc, js::Value* vp);
|
|||
extern bool minmax_impl(JSContext* cx, bool max, js::HandleValue a,
|
||||
js::HandleValue b, js::MutableHandleValue res);
|
||||
|
||||
extern void math_sincos_impl(double x, double* sin, double* cos);
|
||||
|
||||
extern bool math_imul_handle(JSContext* cx, HandleValue lhs, HandleValue rhs,
|
||||
MutableHandleValue res);
|
||||
|
||||
|
|
|
@ -990,8 +990,6 @@ fi
|
|||
dnl Checks for math functions.
|
||||
dnl ========================================================
|
||||
AC_CHECK_LIB(m, sin)
|
||||
AC_CHECK_LIB(m, sincos, AC_DEFINE(HAVE_SINCOS))
|
||||
AC_CHECK_LIB(m, __sincos, AC_DEFINE(HAVE___SINCOS))
|
||||
|
||||
AC_CACHE_CHECK(
|
||||
[for res_ninit()],
|
||||
|
|
|
@ -10333,16 +10333,6 @@ static bool SetContextOptions(JSContext* cx, const OptionParser& op) {
|
|||
}
|
||||
}
|
||||
|
||||
if (const char* str = op.getStringOption("ion-sincos")) {
|
||||
if (strcmp(str, "on") == 0) {
|
||||
jit::JitOptions.disableSincos = false;
|
||||
} else if (strcmp(str, "off") == 0) {
|
||||
jit::JitOptions.disableSincos = true;
|
||||
} else {
|
||||
return OptionFailure("ion-sincos", str);
|
||||
}
|
||||
}
|
||||
|
||||
if (const char* str = op.getStringOption("ion-sink")) {
|
||||
if (strcmp(str, "on") == 0) {
|
||||
jit::JitOptions.disableSink = false;
|
||||
|
@ -10993,15 +10983,6 @@ int main(int argc, char** argv, char** envp) {
|
|||
"Profile guided optimization (default: on, off to disable)") ||
|
||||
!op.addStringOption('\0', "ion-range-analysis", "on/off",
|
||||
"Range analysis (default: on, off to disable)") ||
|
||||
#if defined(__APPLE__)
|
||||
!op.addStringOption(
|
||||
'\0', "ion-sincos", "on/off",
|
||||
"Replace sin(x)/cos(x) to sincos(x) (default: on, off to disable)") ||
|
||||
#else
|
||||
!op.addStringOption(
|
||||
'\0', "ion-sincos", "on/off",
|
||||
"Replace sin(x)/cos(x) to sincos(x) (default: off, on to enable)") ||
|
||||
#endif
|
||||
!op.addStringOption('\0', "ion-sink", "on/off",
|
||||
"Sink code motion (default: off, on to enable)") ||
|
||||
!op.addStringOption('\0', "ion-optimization-levels", "on/off",
|
||||
|
|
|
@ -204,7 +204,6 @@ void TraceLoggerThreadState::enableIonLogging() {
|
|||
enabledTextIds[TraceLogger_AliasAnalysis] = true;
|
||||
enabledTextIds[TraceLogger_GVN] = true;
|
||||
enabledTextIds[TraceLogger_LICM] = true;
|
||||
enabledTextIds[TraceLogger_Sincos] = true;
|
||||
enabledTextIds[TraceLogger_RangeAnalysis] = true;
|
||||
enabledTextIds[TraceLogger_LoopUnrolling] = true;
|
||||
enabledTextIds[TraceLogger_FoldLinearArithConstants] = true;
|
||||
|
@ -1143,7 +1142,7 @@ bool TraceLoggerThreadState::init() {
|
|||
"ScalarReplacement,\n"
|
||||
" DominatorTree, PhiAnalysis, MakeLoopsContiguous, "
|
||||
"ApplyTypes,\n"
|
||||
" EagerSimdUnbox, AliasAnalysis, GVN, LICM, Sincos, "
|
||||
" EagerSimdUnbox, AliasAnalysis, GVN, LICM, "
|
||||
"RangeAnalysis,\n"
|
||||
" LoopUnrolling, FoldLinearArithConstants, "
|
||||
"EffectiveAddressAnalysis,\n"
|
||||
|
|
|
@ -61,7 +61,6 @@
|
|||
_(AliasAnalysis) \
|
||||
_(GVN) \
|
||||
_(LICM) \
|
||||
_(Sincos) \
|
||||
_(RangeAnalysis) \
|
||||
_(LoopUnrolling) \
|
||||
_(Sink) \
|
||||
|
|
Загрузка…
Ссылка в новой задаче