[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,6 +1465,7 @@ 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 * Add a constraint on the element type of the object to pick up
* changes in the object's array-ness or any unknown properties. * changes in the object's array-ness or any unknown properties.
@ -1475,6 +1476,7 @@ public:
elementTypes->add(cx, elementTypes->add(cx,
ArenaNew<TypeConstraintFreezeObjectKind>(cx->compartment->types.pool, ArenaNew<TypeConstraintFreezeObjectKind>(cx->compartment->types.pool,
object, &kind, script), false); 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. */