Remove JSObject::containsSlot, bug 710516. r=luke

This commit is contained in:
Brian Hackett 2011-12-15 08:06:00 -08:00
Родитель 1b4574913a
Коммит 1c679d8e79
5 изменённых файлов: 14 добавлений и 35 удалений

Просмотреть файл

@ -1781,8 +1781,8 @@ LookupCompileTimeConstant(JSContext *cx, BytecodeEmitter *bce, JSAtom *atom, Val
* from our variable object here.
*/
if (!shape->writable() && !shape->configurable() &&
shape->hasDefaultGetter() && obj->containsSlot(shape->slot())) {
*constp = obj->getSlot(shape->slot());
shape->hasDefaultGetter() && shape->hasSlot()) {
*constp = obj->nativeGetSlot(shape->slot());
}
}

Просмотреть файл

@ -861,15 +861,6 @@ JS_GetPropertyDesc(JSContext *cx, JSObject *obj, JSScopeProperty *sprop,
}
pd->alias = JSVAL_VOID;
if (obj->containsSlot(shape->slot())) {
for (Shape::Range r = obj->lastProperty()->all(); !r.empty(); r.popFront()) {
const Shape &aprop = r.front();
if (&aprop != shape && aprop.slot() == shape->slot()) {
pd->alias = IdToJsval(aprop.propid());
break;
}
}
}
return JS_TRUE;
}

Просмотреть файл

@ -5028,7 +5028,7 @@ js_FindClassObject(JSContext *cx, JSObject *start, JSProtoKey protoKey,
Value v = UndefinedValue();
if (prop && pobj->isNative()) {
shape = (Shape *) prop;
if (pobj->containsSlot(shape->slot())) {
if (shape->hasSlot()) {
v = pobj->nativeGetSlot(shape->slot());
if (v.isPrimitive())
v.setUndefined();
@ -5285,7 +5285,7 @@ CallAddPropertyHook(JSContext *cx, Class *clasp, JSObject *obj, const Shape *sha
if (!CallJSPropertyOp(cx, clasp->addProperty, obj, shape->propid(), vp))
return false;
if (*vp != nominal) {
if (obj->containsSlot(shape->slot()))
if (shape->hasSlot())
obj->nativeSetSlotWithType(cx, shape, *vp);
}
}
@ -5415,7 +5415,7 @@ DefineNativeProperty(JSContext *cx, JSObject *obj, jsid id, const Value &value,
}
/* Store valueCopy before calling addProperty, in case the latter GC's. */
if (shape->hasSlot() && obj->containsSlot(shape->slot()))
if (shape->hasSlot())
obj->nativeSetSlot(shape->slot(), valueCopy);
/* XXXbe called with lock held */
@ -5850,7 +5850,6 @@ js_NativeSet(JSContext *cx, JSObject *obj, const Shape *shape, bool added, bool
if (shape->hasSlot()) {
uint32 slot = shape->slot();
JS_ASSERT(obj->containsSlot(slot));
/* If shape has a stub setter, just store *vp. */
if (shape->hasDefaultSetter()) {
@ -6332,7 +6331,7 @@ js_SetPropertyHelper(JSContext *cx, JSObject *obj, jsid id, uintN defineHow,
* Note that we store before calling addProperty, to match the order
* in DefineNativeProperty.
*/
if (obj->containsSlot(shape->slot()))
if (shape->hasSlot())
obj->nativeSetSlot(shape->slot(), UndefinedValue());
/* XXXbe called with obj locked */
@ -6464,7 +6463,7 @@ js_DeleteProperty(JSContext *cx, JSObject *obj, jsid id, Value *rval, JSBool str
if (rval->isFalse())
return true;
if (shape->hasSlot() && obj->containsSlot(shape->slot())) {
if (shape->hasSlot()) {
const Value &v = obj->nativeGetSlot(shape->slot());
GCPoke(cx, v);
@ -6517,7 +6516,6 @@ HasDataProperty(JSContext *cx, JSObject *obj, jsid methodid, Value *vp)
{
if (const Shape *shape = obj->nativeLookup(cx, methodid)) {
if (shape->hasDefaultGetterOrIsMethod() && shape->hasSlot()) {
JS_ASSERT(obj->containsSlot(shape->slot()));
*vp = obj->nativeGetSlot(shape->slot());
return true;
}
@ -6959,10 +6957,8 @@ js_PrintObjectSlotName(JSTracer *trc, char *buf, size_t bufsize)
const Shape *shape;
if (obj->isNative()) {
shape = obj->lastProperty();
while (shape->previous() && shape->maybeSlot() != slot)
while (shape && (!shape->hasSlot() || shape->slot() != slot))
shape = shape->previous();
if (shape->maybeSlot() != slot)
shape = NULL;
} else {
shape = NULL;
}
@ -7019,8 +7015,8 @@ js_ClearNative(JSContext *cx, JSObject *obj)
if (shape->isDataDescriptor() &&
shape->writable() &&
shape->hasDefaultSetter() &&
obj->containsSlot(shape->maybeSlot())) {
obj->setSlot(shape->slot(), UndefinedValue());
shape->hasSlot()) {
obj->nativeSetSlot(shape->slot(), UndefinedValue());
}
}
return true;
@ -7287,7 +7283,7 @@ DumpProperty(JSObject *obj, const Shape &shape)
uint32 slot = shape.hasSlot() ? shape.maybeSlot() : SHAPE_INVALID_SLOT;
fprintf(stderr, ": slot %d", slot);
if (obj->containsSlot(slot)) {
if (shape.hasSlot()) {
fprintf(stderr, " = ");
dumpValue(obj->getSlot(slot));
} else if (slot != SHAPE_INVALID_SLOT) {

Просмотреть файл

@ -710,8 +710,6 @@ struct JSObject : js::gc::Cell
inline uint32 slotSpan() const;
inline bool containsSlot(uint32 slot) const;
void rollbackProperties(JSContext *cx, uint32 slotSpan);
#ifdef DEBUG

Просмотреть файл

@ -1141,17 +1141,11 @@ JSObject::slotSpan() const
return lastProperty()->slotSpan();
}
inline bool
JSObject::containsSlot(uint32 slot) const
{
return slot < slotSpan();
}
inline js::HeapValue &
JSObject::nativeGetSlotRef(uintN slot)
{
JS_ASSERT(isNative());
JS_ASSERT(containsSlot(slot));
JS_ASSERT(slot < slotSpan());
return getSlotRef(slot);
}
@ -1159,7 +1153,7 @@ inline const js::Value &
JSObject::nativeGetSlot(uintN slot) const
{
JS_ASSERT(isNative());
JS_ASSERT(containsSlot(slot));
JS_ASSERT(slot < slotSpan());
return getSlot(slot);
}
@ -1183,7 +1177,7 @@ inline void
JSObject::nativeSetSlot(uintN slot, const js::Value &value)
{
JS_ASSERT(isNative());
JS_ASSERT(containsSlot(slot));
JS_ASSERT(slot < slotSpan());
return setSlot(slot, value);
}