Bug 862103 - Address review comments, r=jandem.

This commit is contained in:
Brian Hackett 2013-04-18 07:39:33 -06:00
parent 598edcfbee
commit 220a7d9c7f
3 changed files with 32 additions and 27 deletions

View File

@ -120,3 +120,28 @@ BaselineInspector::expectedResultType(jsbytecode *pc)
return MIRType_None;
}
}
// Whether a baseline stub kind is suitable for a double comparison that
// converts its operands to doubles.
static bool
CanUseDoubleCompare(ICStub::Kind kind)
{
return kind == ICStub::Compare_Double || kind == ICStub::Compare_NumberWithUndefined;
}
MCompare::CompareType
BaselineInspector::expectedCompareType(jsbytecode *pc)
{
ICStub::Kind kind = monomorphicStubKind(pc);
if (CanUseDoubleCompare(kind))
return MCompare::Compare_Double;
ICStub::Kind first, second;
if (dimorphicStubKind(pc, &first, &second)) {
if (CanUseDoubleCompare(first) && CanUseDoubleCompare(second))
return MCompare::Compare_Double;
}
return MCompare::Compare_Unknown;
}

View File

@ -13,6 +13,7 @@
#include "BaselineJIT.h"
#include "BaselineIC.h"
#include "MIR.h"
namespace js {
namespace ion {
@ -89,6 +90,9 @@ class BaselineInspector
return ICInspectorType(this, pc, ent);
}
ICStub::Kind monomorphicStubKind(jsbytecode *pc);
bool dimorphicStubKind(jsbytecode *pc, ICStub::Kind *pfirst, ICStub::Kind *psecond);
public:
RawShape maybeMonomorphicShapeForPropertyOp(jsbytecode *pc);
@ -96,10 +100,8 @@ class BaselineInspector
return makeICInspector<SetElemICInspector>(pc, ICStub::SetElem_Fallback);
}
ICStub::Kind monomorphicStubKind(jsbytecode *pc);
bool dimorphicStubKind(jsbytecode *pc, ICStub::Kind *pfirst, ICStub::Kind *psecond);
MIRType expectedResultType(jsbytecode *pc);
MCompare::CompareType expectedCompareType(jsbytecode *pc);
};
} // namespace ion

View File

@ -1383,14 +1383,6 @@ MCompare::inputType()
}
}
// Whether a baseline stub kind is suitable for a double comparison that
// converts its operands to doubles.
static bool
CanUseDoubleCompare(ICStub::Kind kind)
{
return kind == ICStub::Compare_Double || kind == ICStub::Compare_NumberWithUndefined;
}
void
MCompare::infer(JSContext *cx, BaselineInspector *inspector, jsbytecode *pc)
{
@ -1505,22 +1497,8 @@ MCompare::infer(JSContext *cx, BaselineInspector *inspector, jsbytecode *pc)
// instruction's type policy to insert fallible unboxes to the appropriate
// input types.
if (!strictEq) {
ICStub::Kind kind = inspector->monomorphicStubKind(pc);
if (CanUseDoubleCompare(kind)) {
compareType_ = Compare_Double;
return;
}
ICStub::Kind first, second;
if (inspector->dimorphicStubKind(pc, &first, &second)) {
if (CanUseDoubleCompare(first) && CanUseDoubleCompare(second)) {
compareType_ = Compare_Double;
return;
}
}
}
if (!strictEq)
compareType_ = inspector->expectedCompareType(pc);
}
MBitNot *