[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;
ObjectKind nkind = CombineObjectKind(object, kind);
/*
* 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)
return;
elementTypes->add(cx,
ArenaNew<TypeConstraintFreezeObjectKind>(cx->compartment->types.pool,
object, &kind, script), false);
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.
*/
TypeSet *elementTypes = object->getProperty(cx, JSID_VOID, false);
if (!elementTypes)
return;
elementTypes->add(cx,
ArenaNew<TypeConstraintFreezeObjectKind>(cx->compartment->types.pool,
object, &kind, script), false);
}
if (nkind == kind) {
/* New object with the same kind we are interested in. */