Bug 894447 - Avoid unnecessary monitor instructions and bailouts with JSOP_SETELEM accessing named properties and backout bug 894463. r=bhackett

This commit is contained in:
Jan de Mooij 2013-07-17 16:21:22 +02:00
parent d3ee8222e1
commit f704f16388
2 changed files with 14 additions and 12 deletions

View File

@ -6735,18 +6735,25 @@ IonBuilder::jsop_setelem()
return jsop_setelem_typed(arrayType, SetElem_Normal,
object, index, value);
if (!PropertyWriteNeedsTypeBarrier(cx, current, &object, NULL, &value)) {
if (ElementAccessIsDenseNative(object, index)) {
if (ElementAccessIsDenseNative(object, index)) {
do {
if (PropertyWriteNeedsTypeBarrier(cx, current, &object, NULL, &value))
break;
if (!object->resultTypeSet())
break;
types::StackTypeSet::DoubleConversion conversion =
object->resultTypeSet()->convertDoubleElements(cx);
// If AmbiguousDoubleConversion, only handle int32 values for now.
if (conversion != types::StackTypeSet::AmbiguousDoubleConversion ||
value->type() == MIRType_Int32)
if (conversion == types::StackTypeSet::AmbiguousDoubleConversion &&
value->type() != MIRType_Int32)
{
return jsop_setelem_dense(conversion, SetElem_Normal, object, index, value);
break;
}
}
return jsop_setelem_dense(conversion, SetElem_Normal, object, index, value);
} while(false);
}
if (object->type() == MIRType_Magic)

View File

@ -970,14 +970,9 @@ TypeScript::MonitorAssign(JSContext *cx, HandleObject obj, jsid id)
// But if we don't have too many properties yet, don't do anything. The
// idea here is that normal object initialization should not trigger
// deoptimization in most cases, while actual usage as a hashmap should.
// Except for vanilla objects and arrays work around bug 894447 for now
// by deoptimizing more eagerly. Since in those cases we often have a
// pc-keyed TypeObject, this is ok.
TypeObject* type = obj->type();
if (!obj->is<JSObject>() && !obj->is<ArrayObject>() &&
type->getPropertyCount() < 8) {
if (type->getPropertyCount() < 8)
return;
}
MarkTypeObjectUnknownProperties(cx, type);
}
}