Bug 1019983 - Don't optimize compare based on baseline caches when more types are seen than present in the cache, r=jandem

This commit is contained in:
Hannes Verschore 2014-07-04 19:43:24 +02:00
parent 4ffc41a6b9
commit 59a8c1f0c5
3 changed files with 16 additions and 0 deletions

View File

@ -1969,6 +1969,8 @@ DoCompareFallback(JSContext *cx, BaselineFrame *frame, ICCompare_Fallback *stub_
}
}
stub->noteUnoptimizableAccess();
return true;
}

View File

@ -1966,6 +1966,14 @@ class ICCompare_Fallback : public ICFallbackStub
return space->allocate<ICCompare_Fallback>(code);
}
static const size_t UNOPTIMIZABLE_ACCESS_BIT = 0;
void noteUnoptimizableAccess() {
extra_ |= (1u << UNOPTIMIZABLE_ACCESS_BIT);
}
bool hadUnoptimizableAccess() const {
return extra_ & (1u << UNOPTIMIZABLE_ACCESS_BIT);
}
// Compiler for this stub kind.
class Compiler : public ICStubCompiler {
protected:

View File

@ -226,6 +226,12 @@ BaselineInspector::expectedCompareType(jsbytecode *pc)
if (!first && !dimorphicStub(pc, &first, &second))
return MCompare::Compare_Unknown;
if (ICStub *fallback = second ? second->next() : first->next()) {
JS_ASSERT(fallback->isFallback());
if (fallback->toCompare_Fallback()->hadUnoptimizableAccess())
return MCompare::Compare_Unknown;
}
if (CanUseInt32Compare(first->kind()) && (!second || CanUseInt32Compare(second->kind()))) {
ICCompare_Int32WithBoolean *coerce =
first->isCompare_Int32WithBoolean()