mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 20:35:50 +00:00
Bug 576034 - Remove aliased property implementation details. r=jorendorff
--HG-- extra : rebase_source : 8d87c5b809937b97643b382d49cfae2eee5581a6
This commit is contained in:
parent
4c2d4c84ae
commit
30dcca107a
@ -3971,7 +3971,7 @@ JS_NextProperty(JSContext *cx, JSObject *iterobj, jsid *idp)
|
||||
JS_ASSERT(iterobj->getParent()->isNative());
|
||||
shape = (Shape *) iterobj->getPrivate();
|
||||
|
||||
while (shape->previous() && (!shape->enumerable() || shape->isAlias()))
|
||||
while (shape->previous() && !shape->enumerable())
|
||||
shape = shape->previous();
|
||||
|
||||
if (!shape->previous()) {
|
||||
|
@ -208,7 +208,6 @@ EnumerateNativeProperties(JSContext *cx, JSObject *obj, JSObject *pobj, uintN fl
|
||||
const Shape &shape = r.front();
|
||||
|
||||
if (!JSID_IS_DEFAULT_XML_NAMESPACE(shape.propid) &&
|
||||
!shape.isAlias() &&
|
||||
!Enumerate(cx, obj, pobj, shape.propid, shape.enumerable(), flags, ht, props))
|
||||
{
|
||||
return false;
|
||||
|
@ -6499,7 +6499,6 @@ DumpProperty(JSObject *obj, const Shape &shape)
|
||||
if (attrs & JSPROP_READONLY) fprintf(stderr, "readonly ");
|
||||
if (attrs & JSPROP_PERMANENT) fprintf(stderr, "permanent ");
|
||||
if (attrs & JSPROP_SHARED) fprintf(stderr, "shared ");
|
||||
if (shape.isAlias()) fprintf(stderr, "alias ");
|
||||
if (shape.isMethod()) fprintf(stderr, "method=%p ", (void *) &shape.methodObject());
|
||||
|
||||
if (shape.hasGetterValue())
|
||||
|
@ -267,7 +267,6 @@ Shape::dump(JSContext *cx, FILE *fp) const
|
||||
int first = 1;
|
||||
fputs("(", fp);
|
||||
#define DUMP_FLAG(name, display) if (flags & name) fputs(" " #display + first, fp), first = 0
|
||||
DUMP_FLAG(ALIAS, alias);
|
||||
DUMP_FLAG(HAS_SHORTID, has_shortid);
|
||||
DUMP_FLAG(METHOD, method);
|
||||
DUMP_FLAG(IN_DICTIONARY, in_dictionary);
|
||||
|
@ -402,25 +402,21 @@ JSObject::getChildProperty(JSContext *cx, Shape *parent, Shape &child)
|
||||
JS_ASSERT(!child.inDictionary());
|
||||
|
||||
/*
|
||||
* Aliases share another property's slot, passed in the |slot| parameter.
|
||||
* Shared properties have no slot. Unshared properties that do not alias
|
||||
* another property's slot allocate a slot here, but may lose it due to a
|
||||
* JS_ClearScope call.
|
||||
* Shared properties have no slot. Unshared properties allocate a slot here
|
||||
* but may lose it due to a JS_ClearScope call.
|
||||
*/
|
||||
if (!child.isAlias()) {
|
||||
if (child.attrs & JSPROP_SHARED) {
|
||||
child.slot = SHAPE_INVALID_SLOT;
|
||||
} else {
|
||||
/*
|
||||
* We may have set slot from a nearly-matching shape, above. If so,
|
||||
* we're overwriting that nearly-matching shape, so we can reuse
|
||||
* its slot -- we don't need to allocate a new one. Similarly, we
|
||||
* use a specific slot if provided by the caller.
|
||||
* we're overwriting that nearly-matching shape, so we can reuse its
|
||||
* slot -- we don't need to allocate a new one. Similarly, we use a
|
||||
* specific slot if provided by the caller.
|
||||
*/
|
||||
if (child.slot == SHAPE_INVALID_SLOT && !allocSlot(cx, &child.slot))
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
Shape *shape;
|
||||
|
||||
@ -772,7 +768,7 @@ JSObject::putProperty(JSContext *cx, jsid id,
|
||||
* copy the existing shape's slot into slot so we can match shape, if all
|
||||
* other members match.
|
||||
*/
|
||||
bool hadSlot = !shape->isAlias() && shape->hasSlot();
|
||||
bool hadSlot = shape->hasSlot();
|
||||
uint32 oldSlot = shape->slot;
|
||||
if (!(attrs & JSPROP_SHARED) && slot == SHAPE_INVALID_SLOT && hadSlot)
|
||||
slot = oldSlot;
|
||||
@ -810,7 +806,7 @@ JSObject::putProperty(JSContext *cx, jsid id,
|
||||
*/
|
||||
if (inDictionaryMode()) {
|
||||
/* FIXME bug 593129 -- slot allocation and JSObject *this must move out of here! */
|
||||
if (slot == SHAPE_INVALID_SLOT && !(attrs & JSPROP_SHARED) && !(flags & Shape::ALIAS)) {
|
||||
if (slot == SHAPE_INVALID_SLOT && !(attrs & JSPROP_SHARED)) {
|
||||
if (!allocSlot(cx, &slot))
|
||||
return NULL;
|
||||
}
|
||||
@ -928,7 +924,7 @@ JSObject::changeProperty(JSContext *cx, const Shape *shape, uintN attrs, uintN m
|
||||
if (inDictionaryMode()) {
|
||||
/* FIXME bug 593129 -- slot allocation and JSObject *this must move out of here! */
|
||||
uint32 slot = shape->slot;
|
||||
if (slot == SHAPE_INVALID_SLOT && !(attrs & JSPROP_SHARED) && !(flags & Shape::ALIAS)) {
|
||||
if (slot == SHAPE_INVALID_SLOT && !(attrs & JSPROP_SHARED)) {
|
||||
if (!allocSlot(cx, &slot))
|
||||
return NULL;
|
||||
}
|
||||
@ -996,7 +992,7 @@ JSObject::removeProperty(JSContext *cx, jsid id)
|
||||
|
||||
/* First, if shape is unshared and not has a slot, free its slot number. */
|
||||
bool addedToFreelist = false;
|
||||
bool hadSlot = !shape->isAlias() && shape->hasSlot();
|
||||
bool hadSlot = shape->hasSlot();
|
||||
if (hadSlot) {
|
||||
addedToFreelist = freeSlot(cx, shape->slot);
|
||||
JS_ATOMIC_INCREMENT(&cx->runtime->propertyRemovals);
|
||||
|
@ -489,7 +489,9 @@ struct Shape : public js::gc::Cell
|
||||
IN_DICTIONARY = 0x02,
|
||||
|
||||
/* Prevent unwanted mutation of shared Bindings::lastBinding nodes. */
|
||||
FROZEN = 0x04
|
||||
FROZEN = 0x04,
|
||||
|
||||
UNUSED_BITS = 0x38
|
||||
};
|
||||
|
||||
Shape(jsid id, js::PropertyOp getter, js::StrictPropertyOp setter, uint32 slot, uintN attrs,
|
||||
@ -510,14 +512,12 @@ struct Shape : public js::gc::Cell
|
||||
public:
|
||||
/* Public bits stored in shape->flags. */
|
||||
enum {
|
||||
ALIAS = 0x20,
|
||||
HAS_SHORTID = 0x40,
|
||||
METHOD = 0x80,
|
||||
PUBLIC_FLAGS = ALIAS | HAS_SHORTID | METHOD
|
||||
PUBLIC_FLAGS = HAS_SHORTID | METHOD
|
||||
};
|
||||
|
||||
uintN getFlags() const { return flags & PUBLIC_FLAGS; }
|
||||
bool isAlias() const { return (flags & ALIAS) != 0; }
|
||||
bool hasShortID() const { return (flags & HAS_SHORTID) != 0; }
|
||||
bool isMethod() const { return (flags & METHOD) != 0; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user