[INFER] Avoid constructing unnecessary FreezeObjectKind constraints, bug 643249.

This commit is contained in:
Brian Hackett 2011-03-20 10:47:47 -07:00
parent b6044f527e
commit 140d584eed
2 changed files with 25 additions and 10 deletions

View File

@ -0,0 +1,13 @@
{
function x() {}
}
for (i = 0; i < 10; i++) {
_someglobal_ = /a/;
(function() {
return function() {
return _someglobal_
} ()
} () == /a/);
gc();
_someglobal_ = new Function.__lookupSetter__;
}

View File

@ -1465,16 +1465,18 @@ public:
TypeObject *object = (TypeObject *) type; TypeObject *object = (TypeObject *) type;
ObjectKind nkind = CombineObjectKind(object, kind); ObjectKind nkind = CombineObjectKind(object, kind);
/* if (nkind != OBJECT_UNKNOWN) {
* Add a constraint on the element type of the object to pick up /*
* changes in the object's array-ness or any unknown properties. * Add a constraint on the element type of the object to pick up
*/ * changes in the object's array-ness or any unknown properties.
TypeSet *elementTypes = object->getProperty(cx, JSID_VOID, false); */
if (!elementTypes) TypeSet *elementTypes = object->getProperty(cx, JSID_VOID, false);
return; if (!elementTypes)
elementTypes->add(cx, return;
ArenaNew<TypeConstraintFreezeObjectKind>(cx->compartment->types.pool, elementTypes->add(cx,
object, &kind, script), false); ArenaNew<TypeConstraintFreezeObjectKind>(cx->compartment->types.pool,
object, &kind, script), false);
}
if (nkind == kind) { if (nkind == kind) {
/* New object with the same kind we are interested in. */ /* New object with the same kind we are interested in. */