mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 21:35:39 +00:00
Backed out changeset 727ea6823984 (bug 931328) for Windows jit-test failures.
--HG-- rename : js/src/jit-test/tests/basic/hypot-approx.js => js/src/tests/ecma_6/Math/hypot-approx.js rename : js/src/jit-test/tests/basic/hypot-exact.js => js/src/tests/ecma_6/Math/hypot-exact.js
This commit is contained in:
parent
d8f8555bea
commit
b2e80f8950
@ -3001,21 +3001,6 @@ bool CodeGenerator::visitAtan2D(LAtan2D *lir)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CodeGenerator::visitHypot(LHypot *lir)
|
||||
{
|
||||
Register temp = ToRegister(lir->temp());
|
||||
FloatRegister x = ToFloatRegister(lir->x());
|
||||
FloatRegister y = ToFloatRegister(lir->y());
|
||||
|
||||
masm.setupUnalignedABICall(2, temp);
|
||||
masm.passABIArg(x);
|
||||
masm.passABIArg(y);
|
||||
masm.callWithABI(JS_FUNC_TO_DATA_PTR(void *, hypot), MacroAssembler::DOUBLE);
|
||||
|
||||
JS_ASSERT(ToFloatRegister(lir->output()) == ReturnFloatReg);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CodeGenerator::visitNewParallelArray(LNewParallelArray *lir)
|
||||
{
|
||||
|
@ -179,7 +179,6 @@ class CodeGenerator : public CodeGeneratorSpecific
|
||||
bool visitSetPropertyPolymorphicT(LSetPropertyPolymorphicT *ins);
|
||||
bool visitAbsI(LAbsI *lir);
|
||||
bool visitAtan2D(LAtan2D *lir);
|
||||
bool visitHypot(LHypot *lir);
|
||||
bool visitPowI(LPowI *lir);
|
||||
bool visitPowD(LPowD *lir);
|
||||
bool visitRandom(LRandom *lir);
|
||||
|
@ -550,7 +550,6 @@ class IonBuilder : public MIRGenerator
|
||||
InliningStatus inlineMathRound(CallInfo &callInfo);
|
||||
InliningStatus inlineMathSqrt(CallInfo &callInfo);
|
||||
InliningStatus inlineMathAtan2(CallInfo &callInfo);
|
||||
InliningStatus inlineMathHypot(CallInfo &callInfo);
|
||||
InliningStatus inlineMathMinMax(CallInfo &callInfo, bool max);
|
||||
InliningStatus inlineMathPow(CallInfo &callInfo);
|
||||
InliningStatus inlineMathRandom(CallInfo &callInfo);
|
||||
|
@ -2369,33 +2369,6 @@ class LAtan2D : public LCallInstructionHelper<1, 2, 1>
|
||||
}
|
||||
};
|
||||
|
||||
class LHypot : public LCallInstructionHelper<1, 2, 1>
|
||||
{
|
||||
public:
|
||||
LIR_HEADER(Hypot)
|
||||
LHypot(const LAllocation &x, const LAllocation &y, const LDefinition &temp) {
|
||||
setOperand(0, x);
|
||||
setOperand(1, y);
|
||||
setTemp(0, temp);
|
||||
}
|
||||
|
||||
const LAllocation *x() {
|
||||
return getOperand(0);
|
||||
}
|
||||
|
||||
const LAllocation *y() {
|
||||
return getOperand(1);
|
||||
}
|
||||
|
||||
const LDefinition *temp() {
|
||||
return getTemp(0);
|
||||
}
|
||||
|
||||
const LDefinition *output() {
|
||||
return getDef(0);
|
||||
}
|
||||
};
|
||||
|
||||
// Double raised to an integer power.
|
||||
class LPowI : public LCallInstructionHelper<1, 2, 1>
|
||||
{
|
||||
|
@ -105,7 +105,6 @@
|
||||
_(SqrtD) \
|
||||
_(SqrtF) \
|
||||
_(Atan2D) \
|
||||
_(Hypot) \
|
||||
_(PowI) \
|
||||
_(PowD) \
|
||||
_(Random) \
|
||||
|
@ -1221,19 +1221,6 @@ LIRGenerator::visitAtan2(MAtan2 *ins)
|
||||
return defineReturn(lir, ins);
|
||||
}
|
||||
|
||||
bool
|
||||
LIRGenerator::visitHypot(MHypot *ins)
|
||||
{
|
||||
MDefinition *x = ins->x();
|
||||
JS_ASSERT(x->type() == MIRType_Double);
|
||||
|
||||
MDefinition *y = ins->y();
|
||||
JS_ASSERT(y->type() == MIRType_Double);
|
||||
|
||||
LHypot *lir = new LHypot(useRegisterAtStart(x), useRegisterAtStart(y), tempFixed(CallTempReg0));
|
||||
return defineReturn(lir, ins);
|
||||
}
|
||||
|
||||
bool
|
||||
LIRGenerator::visitPow(MPow *ins)
|
||||
{
|
||||
|
@ -136,7 +136,6 @@ class LIRGenerator : public LIRGeneratorSpecific
|
||||
bool visitAbs(MAbs *ins);
|
||||
bool visitSqrt(MSqrt *ins);
|
||||
bool visitAtan2(MAtan2 *ins);
|
||||
bool visitHypot(MHypot *ins);
|
||||
bool visitPow(MPow *ins);
|
||||
bool visitRandom(MRandom *ins);
|
||||
bool visitMathFunction(MMathFunction *ins);
|
||||
|
@ -47,8 +47,6 @@ IonBuilder::inlineNativeCall(CallInfo &callInfo, JSNative native)
|
||||
return inlineMathSqrt(callInfo);
|
||||
if (native == math_atan2)
|
||||
return inlineMathAtan2(callInfo);
|
||||
if (native == js::math_hypot)
|
||||
return inlineMathHypot(callInfo);
|
||||
if (native == js_math_max)
|
||||
return inlineMathMinMax(callInfo, true /* max */);
|
||||
if (native == js_math_min)
|
||||
@ -675,32 +673,6 @@ IonBuilder::inlineMathAtan2(CallInfo &callInfo)
|
||||
return InliningStatus_Inlined;
|
||||
}
|
||||
|
||||
IonBuilder::InliningStatus
|
||||
IonBuilder::inlineMathHypot(CallInfo &callInfo)
|
||||
{
|
||||
if (callInfo.constructing())
|
||||
return InliningStatus_NotInlined;
|
||||
|
||||
if (callInfo.argc() != 2)
|
||||
return InliningStatus_NotInlined;
|
||||
|
||||
if (getInlineReturnType() != MIRType_Double)
|
||||
return InliningStatus_NotInlined;
|
||||
|
||||
MIRType argType0 = callInfo.getArg(0)->type();
|
||||
MIRType argType1 = callInfo.getArg(1)->type();
|
||||
|
||||
if (!IsNumberType(argType0) || !IsNumberType(argType1))
|
||||
return InliningStatus_NotInlined;
|
||||
|
||||
callInfo.unwrapArgs();
|
||||
|
||||
MHypot *hypot = MHypot::New(callInfo.getArg(0), callInfo.getArg(1));
|
||||
current->add(hypot);
|
||||
current->push(hypot);
|
||||
return InliningStatus_Inlined;
|
||||
}
|
||||
|
||||
IonBuilder::InliningStatus
|
||||
IonBuilder::inlineMathPow(CallInfo &callInfo)
|
||||
{
|
||||
|
@ -3586,49 +3586,6 @@ class MAtan2
|
||||
}
|
||||
};
|
||||
|
||||
// Inline implementation of Math.hypot().
|
||||
class MHypot
|
||||
: public MBinaryInstruction,
|
||||
public MixPolicy<DoublePolicy<0>, DoublePolicy<1> >
|
||||
{
|
||||
MHypot(MDefinition *y, MDefinition *x)
|
||||
: MBinaryInstruction(x, y)
|
||||
{
|
||||
setResultType(MIRType_Double);
|
||||
setMovable();
|
||||
}
|
||||
|
||||
public:
|
||||
INSTRUCTION_HEADER(Hypot)
|
||||
static MHypot *New(MDefinition *x, MDefinition *y) {
|
||||
return new MHypot(y, x);
|
||||
}
|
||||
|
||||
MDefinition *x() const {
|
||||
return getOperand(0);
|
||||
}
|
||||
|
||||
MDefinition *y() const {
|
||||
return getOperand(1);
|
||||
}
|
||||
|
||||
TypePolicy *typePolicy() {
|
||||
return this;
|
||||
}
|
||||
|
||||
bool congruentTo(MDefinition *ins) const {
|
||||
return congruentIfOperandsEqual(ins);
|
||||
}
|
||||
|
||||
AliasSet getAliasSet() const {
|
||||
return AliasSet::None();
|
||||
}
|
||||
|
||||
bool possiblyCalls() const {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
// Inline implementation of Math.pow().
|
||||
class MPow
|
||||
: public MBinaryInstruction,
|
||||
|
@ -59,7 +59,6 @@ namespace jit {
|
||||
_(Abs) \
|
||||
_(Sqrt) \
|
||||
_(Atan2) \
|
||||
_(Hypot) \
|
||||
_(Pow) \
|
||||
_(PowHalf) \
|
||||
_(Random) \
|
||||
|
@ -153,7 +153,6 @@ class ParallelSafetyVisitor : public MInstructionVisitor
|
||||
SAFE_OP(Abs)
|
||||
SAFE_OP(Sqrt)
|
||||
UNSAFE_OP(Atan2)
|
||||
UNSAFE_OP(Hypot)
|
||||
CUSTOM_OP(MathFunction)
|
||||
SPECIALIZED_OP(Add, PERMIT_NUMERIC)
|
||||
SPECIALIZED_OP(Sub, PERMIT_NUMERIC)
|
||||
|
@ -1280,20 +1280,6 @@ js::math_hypot(JSContext *cx, unsigned argc, Value *vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
// IonMonkey calls the system hypot function directly if two arguments are
|
||||
// given. Do that here as well to get the same results.
|
||||
if (args.length() == 2) {
|
||||
double x, y;
|
||||
if (!ToNumber(cx, args[0], &x))
|
||||
return false;
|
||||
if (!ToNumber(cx, args[1], &y))
|
||||
return false;
|
||||
|
||||
double result = hypot(x, y);
|
||||
args.rval().setNumber(result);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isInfinite = false;
|
||||
bool isNaN = false;
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
loadRelativeToScript("../../../tests/ecma_6/Math/shell.js");
|
||||
|
||||
for (var i = -20; i < 20; i++) {
|
||||
assertEq(Math.hypot(+0, i), Math.abs(i));
|
||||
assertEq(Math.hypot(-0, i), Math.abs(i));
|
||||
@ -23,3 +21,5 @@ assertNear(Math.hypot(1e3, 1e-3, 1e3, 1e-3), 1414.2135623738021555);
|
||||
|
||||
for (var i = 1, j = 1; i < 2; i += 0.05, j += 0.05)
|
||||
assertNear(Math.hypot(i, j), Math.sqrt(i * i + j * j));
|
||||
|
||||
reportCompare(0, 0, "ok");
|
@ -55,3 +55,6 @@ assertEq(Math.hypot(+0, +0, -0), +0);
|
||||
|
||||
// The length property of the hypot function is 2.
|
||||
assertEq(Math.hypot.length, 2);
|
||||
|
||||
|
||||
reportCompare(0, 0, "ok");
|
Loading…
Reference in New Issue
Block a user