Bug 793491. There isn't really any reason to have lots of type barriers for different objects at a site, since if we manage to discharge all the barriers the target will probably just be marked as a generic object anyways. So go ahead and just fall back to an AnyObject barrier once we have more than BARRIER_OBJECT_LIMIT barriers on a single pc. r=jandem

This commit is contained in:
Brian Hackett 2012-10-07 23:04:38 -04:00
parent 5dcae470be
commit 0a213b1326

View File

@ -2697,13 +2697,27 @@ ScriptAnalysis::addTypeBarrier(JSContext *cx, const jsbytecode *pc, TypeSet *tar
}
/* Ignore duplicate barriers. */
size_t barrierCount = 0;
TypeBarrier *barrier = code.typeBarriers;
while (barrier) {
if (barrier->target == target && barrier->type == type && !barrier->singleton)
return;
if (barrier->target == target && !barrier->singleton) {
if (barrier->type == type)
return;
if (barrier->type.isAnyObject() && type.isObject())
return;
}
barrier = barrier->next;
barrierCount++;
}
/*
* Use a generic object barrier if the number of barriers on an opcode gets
* excessive: it is unlikely that we will be able to completely discharge
* the barrier anyways without the target being marked as a generic object.
*/
if (barrierCount >= BARRIER_OBJECT_LIMIT && type.isObject())
type = Type::AnyObjectType();
InferSpew(ISpewOps, "typeBarrier: #%u:%05u: %sT%p%s %s",
script_->id(), pc - script_->code,
InferSpewColor(target), target, InferSpewColorReset(),