From 2aa78ac4c7a3d9c9582ccb3270c334b3eb790610 Mon Sep 17 00:00:00 2001 From: Jan de Mooij Date: Sat, 7 Feb 2015 15:25:27 +0100 Subject: [PATCH] Bug 1129883 - Remove OBJECT_FLAG_NURSERY_PROTO ObjectGroup flag. r=bhackett --- js/src/jit/IonBuilder.cpp | 20 ++++++-------------- js/src/jit/MIR.cpp | 8 ++------ js/src/jsinfer.cpp | 23 +---------------------- js/src/jsinfer.h | 2 -- js/src/vm/ObjectGroup.cpp | 13 ++----------- js/src/vm/ObjectGroup.h | 12 ++---------- 6 files changed, 13 insertions(+), 65 deletions(-) diff --git a/js/src/jit/IonBuilder.cpp b/js/src/jit/IonBuilder.cpp index 09261341f6d..a35e751ab17 100644 --- a/js/src/jit/IonBuilder.cpp +++ b/js/src/jit/IonBuilder.cpp @@ -5539,7 +5539,7 @@ IonBuilder::createThisScriptedSingleton(JSFunction *target, MDefinition *callee) return nullptr; if (!templateObject->is() && !templateObject->is()) 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) { diff --git a/js/src/jit/MIR.cpp b/js/src/jit/MIR.cpp index c853014a049..baba48cc77d 100644 --- a/js/src/jit/MIR.cpp +++ b/js/src/jit/MIR.cpp @@ -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; diff --git a/js/src/jsinfer.cpp b/js/src/jsinfer.cpp index 7124c822746..06130703197 100644 --- a/js/src/jsinfer.cpp +++ b/js/src/jsinfer.cpp @@ -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); diff --git a/js/src/jsinfer.h b/js/src/jsinfer.h index a90c49e6c87..253a61d41a8 100644 --- a/js/src/jsinfer.h +++ b/js/src/jsinfer.h @@ -966,8 +966,6 @@ struct TypeSetObjectKey const Class *clasp(); TaggedProto proto(); - TaggedProto protoMaybeInNursery(); - bool hasTenuredProto(); TypeNewScript *newScript(); bool unknownProperties(); diff --git a/js/src/vm/ObjectGroup.cpp b/js/src/vm/ObjectGroup.cpp index f1713e4b73f..a36ea633a07 100644 --- a/js/src/vm/ObjectGroup.cpp +++ b/js/src/vm/ObjectGroup.cpp @@ -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 } 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; diff --git a/js/src/vm/ObjectGroup.h b/js/src/vm/ObjectGroup.h index 6dcb6b9b26d..e869f76b3f5 100644 --- a/js/src/vm/ObjectGroup.h +++ b/js/src/vm/ObjectGroup.h @@ -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() {