Bug 1129883 - Remove OBJECT_FLAG_NURSERY_PROTO ObjectGroup flag. r=bhackett

This commit is contained in:
Jan de Mooij 2015-02-07 15:25:27 +01:00
parent dbbbebaaac
commit 2aa78ac4c7
6 changed files with 13 additions and 65 deletions

View File

@ -5539,7 +5539,7 @@ IonBuilder::createThisScriptedSingleton(JSFunction *target, MDefinition *callee)
return nullptr;
if (!templateObject->is<PlainObject>() && !templateObject->is<UnboxedPlainObject>())
return nullptr;
if (!templateObject->hasTenuredProto() || templateObject->getProto() != proto)
if (templateObject->getProto() != proto)
return nullptr;
types::TypeSetObjectKey *templateObjectKey = types::TypeSetObjectKey::get(templateObject->group());
@ -6923,8 +6923,6 @@ IonBuilder::testSingletonProperty(JSObject *obj, PropertyName *name)
if (ClassHasResolveHook(compartment, obj->getClass(), name))
return nullptr;
if (!obj->hasTenuredProto())
return nullptr;
obj = obj->getProto();
}
@ -7002,8 +7000,6 @@ IonBuilder::testSingletonPropertyTypes(MDefinition *obj, JSObject *singleton, Pr
if (property.isOwnProperty(constraints()))
return false;
if (!key->hasTenuredProto())
return false;
if (JSObject *proto = key->proto().toObjectOrNull()) {
// Test this type.
if (testSingletonProperty(proto, name) != singleton)
@ -9408,7 +9404,7 @@ IonBuilder::objectsHaveCommonPrototype(types::TemporaryTypeSet *types, PropertyN
}
}
JSObject *proto = key->protoMaybeInNursery().toObjectOrNull();
JSObject *proto = key->proto().toObjectOrNull();
if (proto == foundProto)
break;
if (!proto) {
@ -9445,9 +9441,9 @@ IonBuilder::freezePropertiesForCommonPrototype(types::TemporaryTypeSet *types, P
// Don't mark the proto. It will be held down by the shape
// guard. This allows us to use properties found on prototypes
// with properties unknown to TI.
if (key->protoMaybeInNursery() == TaggedProto(foundProto))
if (key->proto() == TaggedProto(foundProto))
break;
key = types::TypeSetObjectKey::get(key->protoMaybeInNursery().toObjectOrNull());
key = types::TypeSetObjectKey::get(key->proto().toObjectOrNull());
}
}
}
@ -9542,7 +9538,7 @@ IonBuilder::annotateGetPropertyCache(MDefinition *obj, MGetPropertyCache *getPro
if (!group)
continue;
types::TypeSetObjectKey *key = types::TypeSetObjectKey::get(group);
if (key->unknownProperties() || !key->hasTenuredProto() || !key->proto().isObject())
if (key->unknownProperties() || !key->proto().isObject())
continue;
const Class *clasp = key->clasp();
@ -11840,12 +11836,8 @@ HasOnProtoChain(types::CompilerConstraintList *constraints, types::TypeSetObject
MOZ_ASSERT(protoObject);
while (true) {
if (!key->hasStableClassAndProto(constraints) ||
!key->clasp()->isNative() ||
!key->hasTenuredProto())
{
if (!key->hasStableClassAndProto(constraints) || !key->clasp()->isNative())
return false;
}
JSObject *proto = key->proto().toObjectOrNull();
if (!proto) {

View File

@ -4435,10 +4435,8 @@ jit::PropertyReadNeedsTypeBarrier(JSContext *propertycx,
JSObject *obj;
if (key->isSingleton())
obj = key->singleton();
else if (key->hasTenuredProto())
obj = key->proto().toObjectOrNull();
else
obj = nullptr;
obj = key->proto().toObjectOrNull();
while (obj) {
if (!obj->getClass()->isNative())
@ -4462,8 +4460,6 @@ jit::PropertyReadNeedsTypeBarrier(JSContext *propertycx,
}
}
if (!obj->hasTenuredProto())
break;
obj = obj->getProto();
}
}
@ -4526,7 +4522,7 @@ jit::PropertyReadOnPrototypeNeedsTypeBarrier(types::CompilerConstraintList *cons
if (!key)
continue;
while (true) {
if (!key->hasStableClassAndProto(constraints) || !key->hasTenuredProto())
if (!key->hasStableClassAndProto(constraints))
return BarrierKind::TypeSet;
if (!key->proto().isObject())
break;

View File

@ -1069,28 +1069,9 @@ TypeSetObjectKey::clasp()
TaggedProto
TypeSetObjectKey::proto()
{
MOZ_ASSERT(hasTenuredProto());
return isGroup() ? group()->proto() : singleton()->getTaggedProto();
}
TaggedProto
TypeSetObjectKey::protoMaybeInNursery()
{
return isGroup() ? group()->proto() : singleton()->getTaggedProto();
}
bool
JSObject::hasTenuredProto() const
{
return group_->hasTenuredProto();
}
bool
TypeSetObjectKey::hasTenuredProto()
{
return isGroup() ? group()->hasTenuredProto() : singleton()->hasTenuredProto();
}
TypeNewScript *
TypeSetObjectKey::newScript()
{
@ -2205,7 +2186,7 @@ TemporaryTypeSet::getCommonPrototype(CompilerConstraintList *constraints)
if (!key)
continue;
if (key->unknownProperties() || !key->hasTenuredProto())
if (key->unknownProperties())
return nullptr;
TaggedProto nproto = key->proto();
@ -2272,8 +2253,6 @@ PrototypeHasIndexedProperty(CompilerConstraintList *constraints, JSObject *obj)
HeapTypeSetKey index = key->property(JSID_VOID);
if (index.nonData(constraints) || index.isOwnProperty(constraints))
return true;
if (!obj->hasTenuredProto())
return true;
obj = obj->getProto();
} while (obj);

View File

@ -966,8 +966,6 @@ struct TypeSetObjectKey
const Class *clasp();
TaggedProto proto();
TaggedProto protoMaybeInNursery();
bool hasTenuredProto();
TypeNewScript *newScript();
bool unknownProperties();

View File

@ -56,13 +56,9 @@ ObjectGroup::setProtoUnchecked(TaggedProto proto)
}
void
ObjectGroup::setProto(JSContext *cx, TaggedProto proto)
ObjectGroup::setProto(TaggedProto proto)
{
MOZ_ASSERT(singleton());
if (proto.isObject() && IsInsideNursery(proto.toObject()))
addFlags(OBJECT_FLAG_NURSERY_PROTO);
setProtoUnchecked(proto);
}
@ -289,7 +285,7 @@ JSObject::splicePrototype(JSContext *cx, const Class *clasp, Handle<TaggedProto>
}
group->setClasp(clasp);
group->setProto(cx, proto);
group->setProto(proto);
return true;
}
@ -1322,11 +1318,6 @@ ObjectGroupCompartment::makeGroup(ExclusiveContext *cx, const Class *clasp,
{
MOZ_ASSERT_IF(proto.isObject(), cx->isInsideCurrentCompartment(proto.toObject()));
if (cx->isJSContext()) {
if (proto.isObject() && IsInsideNursery(proto.toObject()))
initialFlags |= OBJECT_FLAG_NURSERY_PROTO;
}
ObjectGroup *group = NewObjectGroup(cx);
if (!group)
return nullptr;

View File

@ -123,11 +123,7 @@ enum : uint32_t {
/* Whether this group is associated with some allocation site. */
OBJECT_FLAG_FROM_ALLOCATION_SITE = 0x1,
/*
* If set, the object's prototype might be in the nursery and can't be
* used during Ion compilation (which may be occurring off thread).
*/
OBJECT_FLAG_NURSERY_PROTO = 0x2,
/* (0x2 and 0x4 are unused) */
/* Mask/shift for the number of properties in propertySet */
OBJECT_FLAG_PROPERTY_COUNT_MASK = 0xfff8,
@ -255,7 +251,7 @@ class ObjectGroup : public gc::TenuredCell
HeapPtrObject &protoRaw() { return proto_; }
HeapPtrObject &singletonRaw() { return singleton_; }
void setProto(JSContext *cx, TaggedProto proto);
void setProto(TaggedProto proto);
void setProtoUnchecked(TaggedProto proto);
void initSingleton(JSObject *singleton) {
@ -419,10 +415,6 @@ class ObjectGroup : public gc::TenuredCell
return hasAnyFlags(OBJECT_FLAG_PRE_TENURE) && !unknownProperties();
}
bool hasTenuredProto() {
return !(flags() & OBJECT_FLAG_NURSERY_PROTO);
}
gc::InitialHeap initialHeap(types::CompilerConstraintList *constraints);
bool canPreTenure() {