Bug 940925 - Don't inspect Baseline binary arithmetic IC if it had unoptimizable operands. r=bhackett

This commit is contained in:
Jan de Mooij 2013-11-20 18:40:57 +01:00
parent 854d8c604e
commit e91fbfe720
3 changed files with 25 additions and 6 deletions

View File

@ -2537,8 +2537,7 @@ DoBinaryArithFallback(JSContext *cx, BaselineFrame *frame, ICBinaryArith_Fallbac
// Check to see if a new stub should be generated.
if (stub->numOptimizedStubs() >= ICBinaryArith_Fallback::MAX_OPTIMIZED_STUBS) {
// TODO: Discard all stubs in this IC and replace with inert megamorphic stub.
// But for now we just bail.
stub->noteUnoptimizableOperands();
return true;
}
@ -2585,8 +2584,10 @@ DoBinaryArithFallback(JSContext *cx, BaselineFrame *frame, ICBinaryArith_Fallbac
}
// Handle only int32 or double.
if (!lhs.isNumber() || !rhs.isNumber())
if (!lhs.isNumber() || !rhs.isNumber()) {
stub->noteUnoptimizableOperands();
return true;
}
JS_ASSERT(ret.isNumber());
@ -2653,6 +2654,7 @@ DoBinaryArithFallback(JSContext *cx, BaselineFrame *frame, ICBinaryArith_Fallbac
}
}
stub->noteUnoptimizableOperands();
return true;
}
#if defined(_MSC_VER)

View File

@ -2419,6 +2419,9 @@ class ICBinaryArith_Fallback : public ICFallbackStub
extra_ = 0;
}
static const uint16_t SAW_DOUBLE_RESULT_BIT = 0x1;
static const uint16_t UNOPTIMIZABLE_OPERANDS_BIT = 0x2;
public:
static const uint32_t MAX_OPTIMIZED_STUBS = 8;
@ -2428,11 +2431,17 @@ class ICBinaryArith_Fallback : public ICFallbackStub
return space->allocate<ICBinaryArith_Fallback>(code);
}
bool sawDoubleResult() {
return extra_;
bool sawDoubleResult() const {
return extra_ & SAW_DOUBLE_RESULT_BIT;
}
void setSawDoubleResult() {
extra_ = 1;
extra_ |= SAW_DOUBLE_RESULT_BIT;
}
bool hadUnoptimizableOperands() const {
return extra_ & UNOPTIMIZABLE_OPERANDS_BIT;
}
void noteUnoptimizableOperands() {
extra_ |= UNOPTIMIZABLE_OPERANDS_BIT;
}
// Compiler for this stub kind.

View File

@ -295,6 +295,14 @@ BaselineInspector::expectedBinaryArithSpecialization(jsbytecode *pc)
MIRType result;
ICStub *stubs[2];
const ICEntry &entry = icEntryFromPC(pc);
ICStub *stub = entry.fallbackStub();
if (stub->isBinaryArith_Fallback() &&
stub->toBinaryArith_Fallback()->hadUnoptimizableOperands())
{
return MIRType_None;
}
stubs[0] = monomorphicStub(pc);
if (stubs[0]) {
if (TryToSpecializeBinaryArithOp(stubs, 1, &result))