mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-06 09:05:45 +00:00
Bug 654792: Give Shape::shape and Shape::id better names for great justice. (r=jorendorff)
This commit is contained in:
parent
d8991edfc5
commit
b4a0b2d486
@ -4042,11 +4042,11 @@ JS_NextProperty(JSContext *cx, JSObject *iterobj, jsid *idp)
|
||||
shape = shape->previous();
|
||||
|
||||
if (!shape->previous()) {
|
||||
JS_ASSERT(JSID_IS_EMPTY(shape->id));
|
||||
JS_ASSERT(JSID_IS_EMPTY(shape->propid));
|
||||
*idp = JSID_VOID;
|
||||
} else {
|
||||
iterobj->setPrivate(const_cast<Shape *>(shape->previous()));
|
||||
*idp = shape->id;
|
||||
*idp = shape->propid;
|
||||
}
|
||||
} else {
|
||||
/* Non-native case: use the ida enumerated when iterobj was created. */
|
||||
@ -4272,7 +4272,7 @@ JS_CloneFunctionObject(JSContext *cx, JSObject *funobj, JSObject *parent)
|
||||
obj = obj->getParent();
|
||||
}
|
||||
|
||||
if (!obj->getProperty(cx, r.front().id, clone->getFlatClosureUpvars() + i))
|
||||
if (!obj->getProperty(cx, r.front().propid, clone->getFlatClosureUpvars() + i))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -650,7 +650,7 @@ DropWatchPointAndUnlock(JSContext *cx, JSWatchPoint *wp, uintN flag, bool sweepi
|
||||
*/
|
||||
if (!sweeping) {
|
||||
const Shape *shape = wp->shape;
|
||||
const Shape *wprop = wp->object->nativeLookup(shape->id);
|
||||
const Shape *wprop = wp->object->nativeLookup(shape->propid);
|
||||
if (wprop &&
|
||||
wprop->hasSetterValue() == shape->hasSetterValue() &&
|
||||
IsWatchedProperty(cx, wprop)) {
|
||||
@ -739,14 +739,14 @@ js_SweepWatchPoints(JSContext *cx)
|
||||
* NB: LockedFindWatchPoint must be called with rt->debuggerLock acquired.
|
||||
*/
|
||||
static JSWatchPoint *
|
||||
LockedFindWatchPoint(JSRuntime *rt, JSObject *obj, jsid id)
|
||||
LockedFindWatchPoint(JSRuntime *rt, JSObject *obj, jsid propid)
|
||||
{
|
||||
JSWatchPoint *wp;
|
||||
|
||||
for (wp = (JSWatchPoint *)rt->watchPointList.next;
|
||||
&wp->links != &rt->watchPointList;
|
||||
wp = (JSWatchPoint *)wp->links.next) {
|
||||
if (wp->object == obj && wp->shape->id == id)
|
||||
if (wp->object == obj && wp->shape->propid == propid)
|
||||
return wp;
|
||||
}
|
||||
return NULL;
|
||||
@ -782,7 +782,7 @@ js_watch_set(JSContext *cx, JSObject *obj, jsid id, JSBool strict, Value *vp)
|
||||
wp->flags |= JSWP_HELD;
|
||||
DBG_UNLOCK(rt);
|
||||
|
||||
jsid propid = shape->id;
|
||||
jsid propid = shape->propid;
|
||||
shape = obj->nativeLookup(propid);
|
||||
if (!shape) {
|
||||
/*
|
||||
@ -968,12 +968,12 @@ WrapWatchedSetter(JSContext *cx, jsid id, uintN attrs, StrictPropertyOp setter)
|
||||
static const Shape *
|
||||
UpdateWatchpointShape(JSContext *cx, JSWatchPoint *wp, const Shape *newShape)
|
||||
{
|
||||
JS_ASSERT_IF(wp->shape, wp->shape->id == newShape->id);
|
||||
JS_ASSERT_IF(wp->shape, wp->shape->propid == newShape->propid);
|
||||
JS_ASSERT(!IsWatchedProperty(cx, newShape));
|
||||
|
||||
/* Create a watching setter we can substitute for the new shape's setter. */
|
||||
StrictPropertyOp watchingSetter =
|
||||
WrapWatchedSetter(cx, newShape->id, newShape->attributes(), newShape->setter());
|
||||
WrapWatchedSetter(cx, newShape->propid, newShape->attributes(), newShape->setter());
|
||||
if (!watchingSetter)
|
||||
return NULL;
|
||||
|
||||
@ -1017,7 +1017,7 @@ js_SlowPathUpdateWatchpointsForShape(JSContext *cx, JSObject *obj, const Shape *
|
||||
if (IsWatchedProperty(cx, newShape))
|
||||
return newShape;
|
||||
|
||||
JSWatchPoint *wp = FindWatchPoint(cx->runtime, obj, newShape->id);
|
||||
JSWatchPoint *wp = FindWatchPoint(cx->runtime, obj, newShape->propid);
|
||||
if (!wp)
|
||||
return newShape;
|
||||
|
||||
@ -1038,7 +1038,7 @@ UnwrapSetter(JSContext *cx, JSObject *obj, const Shape *shape)
|
||||
return shape->setter();
|
||||
|
||||
/* Look up the watchpoint, from which we can retrieve the underlying setter. */
|
||||
JSWatchPoint *wp = FindWatchPoint(cx->runtime, obj, shape->id);
|
||||
JSWatchPoint *wp = FindWatchPoint(cx->runtime, obj, shape->propid);
|
||||
|
||||
/*
|
||||
* Since we know |shape| is watched, we *must* find a watchpoint: we should never
|
||||
@ -1681,7 +1681,7 @@ JS_PropertyIterator(JSObject *obj, JSScopeProperty **iteratorp)
|
||||
} else {
|
||||
shape = shape->previous();
|
||||
if (!shape->previous()) {
|
||||
JS_ASSERT(JSID_IS_EMPTY(shape->id));
|
||||
JS_ASSERT(JSID_IS_EMPTY(shape->propid));
|
||||
shape = NULL;
|
||||
}
|
||||
}
|
||||
@ -1695,7 +1695,7 @@ JS_GetPropertyDesc(JSContext *cx, JSObject *obj, JSScopeProperty *sprop,
|
||||
{
|
||||
assertSameCompartment(cx, obj);
|
||||
Shape *shape = (Shape *) sprop;
|
||||
pd->id = IdToJsval(shape->id);
|
||||
pd->id = IdToJsval(shape->propid);
|
||||
|
||||
JSBool wasThrowing = cx->isExceptionPending();
|
||||
Value lastException = UndefinedValue();
|
||||
@ -1703,7 +1703,7 @@ JS_GetPropertyDesc(JSContext *cx, JSObject *obj, JSScopeProperty *sprop,
|
||||
lastException = cx->getPendingException();
|
||||
cx->clearPendingException();
|
||||
|
||||
if (!js_GetProperty(cx, obj, shape->id, Valueify(&pd->value))) {
|
||||
if (!js_GetProperty(cx, obj, shape->propid, Valueify(&pd->value))) {
|
||||
if (!cx->isExceptionPending()) {
|
||||
pd->flags = JSPD_ERROR;
|
||||
pd->value = JSVAL_VOID;
|
||||
@ -1737,7 +1737,7 @@ JS_GetPropertyDesc(JSContext *cx, JSObject *obj, JSScopeProperty *sprop,
|
||||
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.id);
|
||||
pd->alias = IdToJsval(aprop.propid);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -417,23 +417,18 @@ MarkRoot(JSTracer *trc, JSXML *thing, const char *name)
|
||||
static void
|
||||
PrintPropertyGetterOrSetter(JSTracer *trc, char *buf, size_t bufsize)
|
||||
{
|
||||
Shape *shape;
|
||||
jsid id;
|
||||
size_t n;
|
||||
const char *name;
|
||||
|
||||
JS_ASSERT(trc->debugPrinter == PrintPropertyGetterOrSetter);
|
||||
shape = (Shape *)trc->debugPrintArg;
|
||||
id = shape->id;
|
||||
JS_ASSERT(!JSID_IS_VOID(id));
|
||||
name = trc->debugPrintIndex ? js_setter_str : js_getter_str;
|
||||
Shape *shape = (Shape *)trc->debugPrintArg;
|
||||
jsid propid = shape->propid;
|
||||
JS_ASSERT(!JSID_IS_VOID(propid));
|
||||
const char *name = trc->debugPrintIndex ? js_setter_str : js_getter_str;
|
||||
|
||||
if (JSID_IS_ATOM(id)) {
|
||||
n = PutEscapedString(buf, bufsize, JSID_TO_ATOM(id), 0);
|
||||
if (JSID_IS_ATOM(propid)) {
|
||||
size_t n = PutEscapedString(buf, bufsize, JSID_TO_ATOM(propid), 0);
|
||||
if (n < bufsize)
|
||||
JS_snprintf(buf + n, bufsize - n, " %s", name);
|
||||
} else if (JSID_IS_INT(shape->id)) {
|
||||
JS_snprintf(buf, bufsize, "%d %s", JSID_TO_INT(id), name);
|
||||
} else if (JSID_IS_INT(shape->propid)) {
|
||||
JS_snprintf(buf, bufsize, "%d %s", JSID_TO_INT(propid), name);
|
||||
} else {
|
||||
JS_snprintf(buf, bufsize, "<object> %s", name);
|
||||
}
|
||||
@ -442,17 +437,13 @@ PrintPropertyGetterOrSetter(JSTracer *trc, char *buf, size_t bufsize)
|
||||
static void
|
||||
PrintPropertyMethod(JSTracer *trc, char *buf, size_t bufsize)
|
||||
{
|
||||
Shape *shape;
|
||||
jsid id;
|
||||
size_t n;
|
||||
|
||||
JS_ASSERT(trc->debugPrinter == PrintPropertyMethod);
|
||||
shape = (Shape *)trc->debugPrintArg;
|
||||
id = shape->id;
|
||||
JS_ASSERT(!JSID_IS_VOID(id));
|
||||
Shape *shape = (Shape *)trc->debugPrintArg;
|
||||
jsid propid = shape->propid;
|
||||
JS_ASSERT(!JSID_IS_VOID(propid));
|
||||
|
||||
JS_ASSERT(JSID_IS_ATOM(id));
|
||||
n = PutEscapedString(buf, bufsize, JSID_TO_ATOM(id), 0);
|
||||
JS_ASSERT(JSID_IS_ATOM(propid));
|
||||
size_t n = PutEscapedString(buf, bufsize, JSID_TO_ATOM(propid), 0);
|
||||
if (n < bufsize)
|
||||
JS_snprintf(buf + n, bufsize - n, " method");
|
||||
}
|
||||
@ -484,14 +475,14 @@ ScanShape(GCMarker *gcmarker, const Shape *shape)
|
||||
restart:
|
||||
JSRuntime *rt = gcmarker->context->runtime;
|
||||
if (rt->gcRegenShapes)
|
||||
shape->shape = js_RegenerateShapeForGC(rt);
|
||||
shape->shapeid = js_RegenerateShapeForGC(rt);
|
||||
|
||||
if (JSID_IS_STRING(shape->id)) {
|
||||
JSString *str = JSID_TO_STRING(shape->id);
|
||||
if (JSID_IS_STRING(shape->propid)) {
|
||||
JSString *str = JSID_TO_STRING(shape->propid);
|
||||
if (!str->isStaticAtom())
|
||||
PushMarkStack(gcmarker, str);
|
||||
} else if (JS_UNLIKELY(JSID_IS_OBJECT(shape->id))) {
|
||||
PushMarkStack(gcmarker, JSID_TO_OBJECT(shape->id));
|
||||
} else if (JS_UNLIKELY(JSID_IS_OBJECT(shape->propid))) {
|
||||
PushMarkStack(gcmarker, JSID_TO_OBJECT(shape->propid));
|
||||
}
|
||||
|
||||
if (shape->hasGetterValue() && shape->getter())
|
||||
@ -556,10 +547,10 @@ ScanObject(GCMarker *gcmarker, JSObject *obj)
|
||||
|
||||
if (gcmarker->context->runtime->gcRegenShapes) {
|
||||
/* We need to regenerate our shape if hasOwnShape(). */
|
||||
uint32 newShape = shape->shape;
|
||||
uint32 newShape = shape->shapeid;
|
||||
if (obj->hasOwnShape()) {
|
||||
newShape = js_RegenerateShapeForGC(gcmarker->context->runtime);
|
||||
JS_ASSERT(newShape != shape->shape);
|
||||
JS_ASSERT(newShape != shape->shapeid);
|
||||
}
|
||||
obj->objShape = newShape;
|
||||
}
|
||||
@ -666,7 +657,7 @@ void
|
||||
MarkChildren(JSTracer *trc, const Shape *shape)
|
||||
{
|
||||
restart:
|
||||
MarkId(trc, shape->id, "id");
|
||||
MarkId(trc, shape->propid, "propid");
|
||||
|
||||
if (shape->hasGetterValue() && shape->getter())
|
||||
MarkObjectWithPrinter(trc, *shape->getterObject(), PrintPropertyGetterOrSetter, shape, 0);
|
||||
|
@ -4338,7 +4338,7 @@ BEGIN_CASE(JSOP_SETMETHOD)
|
||||
* Purge the property cache of the id we may have just
|
||||
* shadowed in obj's scope and proto chains.
|
||||
*/
|
||||
js_PurgeScopeChain(cx, obj, shape->id);
|
||||
js_PurgeScopeChain(cx, obj, shape->propid);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -5822,7 +5822,7 @@ BEGIN_CASE(JSOP_INITMETHOD)
|
||||
|
||||
/* A new object, or one we just extended in a recent initprop op. */
|
||||
JS_ASSERT(!obj->lastProperty() ||
|
||||
obj->shape() == obj->lastProperty()->shape);
|
||||
obj->shape() == obj->lastProperty()->shapeid);
|
||||
obj->extend(cx, shape);
|
||||
|
||||
/*
|
||||
|
@ -221,9 +221,9 @@ EnumerateNativeProperties(JSContext *cx, JSObject *obj, JSObject *pobj, uintN fl
|
||||
for (Shape::Range r = pobj->lastProperty()->all(); !r.empty(); r.popFront()) {
|
||||
const Shape &shape = r.front();
|
||||
|
||||
if (!JSID_IS_DEFAULT_XML_NAMESPACE(shape.id) &&
|
||||
if (!JSID_IS_DEFAULT_XML_NAMESPACE(shape.propid) &&
|
||||
!shape.isAlias() &&
|
||||
!Enumerate(cx, obj, pobj, shape.id, shape.enumerable(),
|
||||
!Enumerate(cx, obj, pobj, shape.propid, shape.enumerable(),
|
||||
shape.isSharedPermanent(), flags, ht, props))
|
||||
{
|
||||
return false;
|
||||
|
@ -3420,7 +3420,7 @@ JSObject::copyPropertiesFrom(JSContext *cx, JSObject *obj)
|
||||
Value v = shape->hasSlot() ? obj->getSlot(shape->slot) : UndefinedValue();
|
||||
if (!cx->compartment->wrap(cx, &v))
|
||||
return false;
|
||||
if (!defineProperty(cx, shape->id, v, getter, setter, attrs))
|
||||
if (!defineProperty(cx, shape->propid, v, getter, setter, attrs))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -3715,7 +3715,7 @@ js_XDRBlockObject(JSXDRState *xdr, JSObject **objp)
|
||||
shape = shapes[i];
|
||||
JS_ASSERT(shape->getter() == block_getProperty);
|
||||
|
||||
jsid propid = shape->id;
|
||||
jsid propid = shape->propid;
|
||||
JS_ASSERT(JSID_IS_ATOM(propid));
|
||||
JSAtom *atom = JSID_TO_ATOM(propid);
|
||||
|
||||
@ -4634,7 +4634,7 @@ CallAddPropertyHook(JSContext *cx, Class *clasp, JSObject *obj, const Shape *sha
|
||||
if (clasp->addProperty != PropertyStub) {
|
||||
Value nominal = *vp;
|
||||
|
||||
if (!CallJSPropertyOp(cx, clasp->addProperty, obj, shape->id, vp))
|
||||
if (!CallJSPropertyOp(cx, clasp->addProperty, obj, shape->propid, vp))
|
||||
return false;
|
||||
if (*vp != nominal) {
|
||||
if (obj->containsSlot(shape->slot))
|
||||
@ -6468,11 +6468,11 @@ js_PrintObjectSlotName(JSTracer *trc, char *buf, size_t bufsize)
|
||||
else
|
||||
JS_snprintf(buf, bufsize, "**UNKNOWN SLOT %ld**", (long)slot);
|
||||
} else {
|
||||
jsid id = shape->id;
|
||||
if (JSID_IS_INT(id)) {
|
||||
JS_snprintf(buf, bufsize, "%ld", (long)JSID_TO_INT(id));
|
||||
} else if (JSID_IS_ATOM(id)) {
|
||||
PutEscapedString(buf, bufsize, JSID_TO_ATOM(id), 0);
|
||||
jsid propid = shape->propid;
|
||||
if (JSID_IS_INT(propid)) {
|
||||
JS_snprintf(buf, bufsize, "%ld", (long)JSID_TO_INT(propid));
|
||||
} else if (JSID_IS_ATOM(propid)) {
|
||||
PutEscapedString(buf, bufsize, JSID_TO_ATOM(propid), 0);
|
||||
} else {
|
||||
JS_snprintf(buf, bufsize, "**FINALIZED ATOM KEY**");
|
||||
}
|
||||
@ -6496,7 +6496,7 @@ js_ClearNative(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
/* Remove all configurable properties from obj. */
|
||||
while (const Shape *shape = LastConfigurableShape(obj)) {
|
||||
if (!obj->removeProperty(cx, shape->id))
|
||||
if (!obj->removeProperty(cx, shape->propid))
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -6720,7 +6720,7 @@ js_DumpId(jsid id)
|
||||
static void
|
||||
DumpProperty(JSObject *obj, const Shape &shape)
|
||||
{
|
||||
jsid id = shape.id;
|
||||
jsid id = shape.propid;
|
||||
uint8 attrs = shape.attributes();
|
||||
|
||||
fprintf(stderr, " ((Shape *) %p) ", (void *) &shape);
|
||||
|
@ -161,7 +161,7 @@ JSObject::initCall(JSContext *cx, const js::Bindings &bindings, JSObject *parent
|
||||
if (bindings.extensibleParents())
|
||||
setOwnShape(js_GenerateShape(cx));
|
||||
else
|
||||
objShape = lastProp->shape;
|
||||
objShape = lastProp->shapeid;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -184,7 +184,7 @@ JSObject::initClonedBlock(JSContext *cx, JSObject *proto, js::StackFrame *frame)
|
||||
if (proto->hasOwnShape())
|
||||
setOwnShape(js_GenerateShape(cx));
|
||||
else
|
||||
objShape = lastProp->shape;
|
||||
objShape = lastProp->shapeid;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -898,7 +898,7 @@ JSObject::setMap(js::Shape *amap)
|
||||
{
|
||||
JS_ASSERT(!hasOwnShape());
|
||||
lastProp = amap;
|
||||
objShape = lastProp->shape;
|
||||
objShape = lastProp->shapeid;
|
||||
}
|
||||
|
||||
inline js::Value &
|
||||
@ -941,7 +941,7 @@ inline void
|
||||
JSObject::clearOwnShape()
|
||||
{
|
||||
flags &= ~OWN_SHAPE;
|
||||
objShape = lastProp->shape;
|
||||
objShape = lastProp->shapeid;
|
||||
}
|
||||
|
||||
inline void
|
||||
@ -973,14 +973,14 @@ JSObject::nativeContains(jsid id)
|
||||
inline bool
|
||||
JSObject::nativeContains(const js::Shape &shape)
|
||||
{
|
||||
return nativeLookup(shape.id) == &shape;
|
||||
return nativeLookup(shape.propid) == &shape;
|
||||
}
|
||||
|
||||
inline const js::Shape *
|
||||
JSObject::lastProperty() const
|
||||
{
|
||||
JS_ASSERT(isNative());
|
||||
JS_ASSERT(!JSID_IS_VOID(lastProp->id));
|
||||
JS_ASSERT(!JSID_IS_VOID(lastProp->propid));
|
||||
return lastProp;
|
||||
}
|
||||
|
||||
@ -1015,8 +1015,8 @@ inline void
|
||||
JSObject::setLastProperty(const js::Shape *shape)
|
||||
{
|
||||
JS_ASSERT(!inDictionaryMode());
|
||||
JS_ASSERT(!JSID_IS_VOID(shape->id));
|
||||
JS_ASSERT_IF(lastProp, !JSID_IS_VOID(lastProp->id));
|
||||
JS_ASSERT(!JSID_IS_VOID(shape->propid));
|
||||
JS_ASSERT_IF(lastProp, !JSID_IS_VOID(lastProp->propid));
|
||||
JS_ASSERT(shape->compartment() == compartment());
|
||||
|
||||
lastProp = const_cast<js::Shape *>(shape);
|
||||
@ -1026,7 +1026,7 @@ inline void
|
||||
JSObject::removeLastProperty()
|
||||
{
|
||||
JS_ASSERT(!inDictionaryMode());
|
||||
JS_ASSERT(!JSID_IS_VOID(lastProp->parent->id));
|
||||
JS_ASSERT(!JSID_IS_VOID(lastProp->parent->propid));
|
||||
|
||||
lastProp = lastProp->parent;
|
||||
}
|
||||
|
@ -344,7 +344,7 @@ ToDisassemblySource(JSContext *cx, jsval v, JSAutoByteString *bytes)
|
||||
while (!r.empty()) {
|
||||
const Shape &shape = r.front();
|
||||
JSAutoByteString bytes;
|
||||
if (!js_AtomToPrintableString(cx, JSID_TO_ATOM(shape.id), &bytes))
|
||||
if (!js_AtomToPrintableString(cx, JSID_TO_ATOM(shape.propid), &bytes))
|
||||
return false;
|
||||
|
||||
r.popFront();
|
||||
@ -1394,9 +1394,9 @@ GetLocal(SprintStack *ss, jsint i)
|
||||
const Shape &shape = r.front();
|
||||
|
||||
if (shape.shortid == slot) {
|
||||
LOCAL_ASSERT(JSID_IS_ATOM(shape.id));
|
||||
LOCAL_ASSERT(JSID_IS_ATOM(shape.propid));
|
||||
|
||||
JSAtom *atom = JSID_TO_ATOM(shape.id);
|
||||
JSAtom *atom = JSID_TO_ATOM(shape.propid);
|
||||
const char *rval = QuoteString(&ss->sprinter, atom, 0);
|
||||
if (!rval)
|
||||
return NULL;
|
||||
@ -2714,7 +2714,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb, JSOp nextop)
|
||||
if (!shape.hasShortID())
|
||||
continue;
|
||||
LOCAL_ASSERT_OUT(shape.shortid < argc);
|
||||
atomv[shape.shortid] = JSID_TO_ATOM(shape.id);
|
||||
atomv[shape.shortid] = JSID_TO_ATOM(shape.propid);
|
||||
}
|
||||
ok = JS_TRUE;
|
||||
for (i = 0; i < argc; i++) {
|
||||
|
@ -1489,7 +1489,7 @@ CheckStrictParameters(JSContext *cx, JSTreeContext *tc)
|
||||
|
||||
/* Start with lastVariable(), not lastArgument(), for destructuring. */
|
||||
for (Shape::Range r = tc->bindings.lastVariable(); !r.empty(); r.popFront()) {
|
||||
jsid id = r.front().id;
|
||||
jsid id = r.front().propid;
|
||||
if (!JSID_IS_ATOM(id))
|
||||
continue;
|
||||
|
||||
@ -3730,7 +3730,7 @@ PopStatement(JSTreeContext *tc)
|
||||
JS_ASSERT(!obj->isClonedBlock());
|
||||
|
||||
for (Shape::Range r = obj->lastProperty()->all(); !r.empty(); r.popFront()) {
|
||||
JSAtom *atom = JSID_TO_ATOM(r.front().id);
|
||||
JSAtom *atom = JSID_TO_ATOM(r.front().propid);
|
||||
|
||||
/* Beware the empty destructuring dummy. */
|
||||
if (atom == tc->parser->context->runtime->atomState.emptyAtom)
|
||||
|
@ -211,7 +211,7 @@ PropertyCache::fill(JSContext *cx, JSObject *obj, uintN scopeIndex, uintN protoI
|
||||
/* Best we can do is to cache shape (still a nice speedup). */
|
||||
vword.setShape(shape);
|
||||
if (adding &&
|
||||
pobj->shape() == shape->shape) {
|
||||
pobj->shape() == shape->shapeid) {
|
||||
/*
|
||||
* Our caller added a new property. We also know that a setter
|
||||
* that js_NativeSet might have run has not mutated pobj, so
|
||||
@ -242,7 +242,7 @@ PropertyCache::fill(JSContext *cx, JSObject *obj, uintN scopeIndex, uintN protoI
|
||||
JS_ASSERT(shape == pobj->lastProperty());
|
||||
JS_ASSERT(!pobj->nativeEmpty());
|
||||
|
||||
kshape = shape->previous()->shape;
|
||||
kshape = shape->previous()->shapeid;
|
||||
|
||||
/*
|
||||
* When adding we predict no prototype object will later gain a
|
||||
|
@ -97,8 +97,8 @@ PropertyTree::insertChild(JSContext *cx, Shape *parent, Shape *child)
|
||||
JS_ASSERT(!parent->inDictionary());
|
||||
JS_ASSERT(!child->parent);
|
||||
JS_ASSERT(!child->inDictionary());
|
||||
JS_ASSERT(!JSID_IS_VOID(parent->id));
|
||||
JS_ASSERT(!JSID_IS_VOID(child->id));
|
||||
JS_ASSERT(!JSID_IS_VOID(parent->propid));
|
||||
JS_ASSERT(!JSID_IS_VOID(child->propid));
|
||||
JS_ASSERT(cx->compartment == compartment);
|
||||
JS_ASSERT(child->compartment() == parent->compartment());
|
||||
|
||||
@ -138,7 +138,7 @@ void
|
||||
Shape::removeChild(Shape *child)
|
||||
{
|
||||
JS_ASSERT(!child->inDictionary());
|
||||
JS_ASSERT(!JSID_IS_VOID(id));
|
||||
JS_ASSERT(!JSID_IS_VOID(propid));
|
||||
|
||||
KidsPointer *kidp = &kids;
|
||||
if (kidp->isShape()) {
|
||||
@ -156,7 +156,7 @@ PropertyTree::getChild(JSContext *cx, Shape *parent, const Shape &child)
|
||||
Shape *shape;
|
||||
|
||||
JS_ASSERT(parent);
|
||||
JS_ASSERT(!JSID_IS_VOID(parent->id));
|
||||
JS_ASSERT(!JSID_IS_VOID(parent->propid));
|
||||
|
||||
/*
|
||||
* The property tree has extremely low fan-out below its root in
|
||||
@ -183,7 +183,7 @@ PropertyTree::getChild(JSContext *cx, Shape *parent, const Shape &child)
|
||||
if (!shape)
|
||||
return NULL;
|
||||
|
||||
new (shape) Shape(child.id, child.rawGetter, child.rawSetter, child.slot, child.attrs,
|
||||
new (shape) Shape(child.propid, child.rawGetter, child.rawSetter, child.slot, child.attrs,
|
||||
child.flags, child.shortid, js_GenerateShape(cx));
|
||||
|
||||
if (!insertChild(cx, parent, shape))
|
||||
@ -210,19 +210,19 @@ KidsPointer::checkConsistency(const Shape *aKid) const
|
||||
void
|
||||
Shape::dump(JSContext *cx, FILE *fp) const
|
||||
{
|
||||
JS_ASSERT(!JSID_IS_VOID(id));
|
||||
JS_ASSERT(!JSID_IS_VOID(propid));
|
||||
|
||||
if (JSID_IS_INT(id)) {
|
||||
fprintf(fp, "[%ld]", (long) JSID_TO_INT(id));
|
||||
} else if (JSID_IS_DEFAULT_XML_NAMESPACE(id)) {
|
||||
if (JSID_IS_INT(propid)) {
|
||||
fprintf(fp, "[%ld]", (long) JSID_TO_INT(propid));
|
||||
} else if (JSID_IS_DEFAULT_XML_NAMESPACE(propid)) {
|
||||
fprintf(fp, "<default XML namespace>");
|
||||
} else {
|
||||
JSLinearString *str;
|
||||
if (JSID_IS_ATOM(id)) {
|
||||
str = JSID_TO_ATOM(id);
|
||||
if (JSID_IS_ATOM(propid)) {
|
||||
str = JSID_TO_ATOM(propid);
|
||||
} else {
|
||||
JS_ASSERT(JSID_IS_OBJECT(id));
|
||||
JSString *s = js_ValueToString(cx, IdToValue(id));
|
||||
JS_ASSERT(JSID_IS_OBJECT(propid));
|
||||
JSString *s = js_ValueToString(cx, IdToValue(propid));
|
||||
fputs("object ", fp);
|
||||
str = s ? s->ensureLinear(cx) : NULL;
|
||||
}
|
||||
@ -298,8 +298,8 @@ Shape::dumpSubtree(JSContext *cx, int level, FILE *fp) const
|
||||
{
|
||||
if (!parent) {
|
||||
JS_ASSERT(level == 0);
|
||||
JS_ASSERT(JSID_IS_EMPTY(id));
|
||||
fprintf(fp, "class %s emptyShape %u\n", clasp->name, shape);
|
||||
JS_ASSERT(JSID_IS_EMPTY(propid));
|
||||
fprintf(fp, "class %s emptyShape %u\n", clasp->name, shapeid);
|
||||
} else {
|
||||
fprintf(fp, "%*sid ", level, "");
|
||||
dump(cx, fp);
|
||||
|
@ -171,7 +171,7 @@ PropertyTable::init(JSRuntime *rt, Shape *lastProp)
|
||||
const Shape &shape = r.front();
|
||||
METER(searches);
|
||||
METER(initSearches);
|
||||
Shape **spp = search(shape.id, true);
|
||||
Shape **spp = search(shape.propid, true);
|
||||
|
||||
/*
|
||||
* Beware duplicate args and arg vs. var conflicts: the youngest shape
|
||||
@ -249,7 +249,7 @@ PropertyTable::search(jsid id, bool adding)
|
||||
|
||||
/* Hit: return entry. */
|
||||
shape = SHAPE_CLEAR_COLLISION(stored);
|
||||
if (shape && shape->id == id) {
|
||||
if (shape && shape->propid == id) {
|
||||
METER(hits);
|
||||
METER(hashHits);
|
||||
return spp;
|
||||
@ -290,7 +290,7 @@ PropertyTable::search(jsid id, bool adding)
|
||||
}
|
||||
|
||||
shape = SHAPE_CLEAR_COLLISION(stored);
|
||||
if (shape && shape->id == id) {
|
||||
if (shape && shape->propid == id) {
|
||||
METER(hits);
|
||||
METER(stepHits);
|
||||
JS_ASSERT(collision_flag);
|
||||
@ -348,7 +348,7 @@ PropertyTable::change(int log2Delta, JSContext *cx)
|
||||
if (shape) {
|
||||
METER(searches);
|
||||
METER(changeSearches);
|
||||
spp = search(shape->id, true);
|
||||
spp = search(shape->propid, true);
|
||||
JS_ASSERT(SHAPE_IS_FREE(*spp));
|
||||
*spp = shape;
|
||||
}
|
||||
@ -382,7 +382,7 @@ PropertyTable::grow(JSContext *cx)
|
||||
Shape *
|
||||
Shape::getChild(JSContext *cx, const js::Shape &child, Shape **listp)
|
||||
{
|
||||
JS_ASSERT(!JSID_IS_VOID(child.id));
|
||||
JS_ASSERT(!JSID_IS_VOID(child.propid));
|
||||
JS_ASSERT(!child.inDictionary());
|
||||
|
||||
if (inDictionary()) {
|
||||
@ -404,7 +404,7 @@ Shape::getChild(JSContext *cx, const js::Shape &child, Shape **listp)
|
||||
if (table) {
|
||||
/* Add newShape to the property table. */
|
||||
METER(searches);
|
||||
Shape **spp = table->search(newShape->id, true);
|
||||
Shape **spp = table->search(newShape->propid, true);
|
||||
|
||||
/*
|
||||
* Beware duplicate formal parameters, allowed by ECMA-262 in
|
||||
@ -454,7 +454,7 @@ Shape::getChild(JSContext *cx, const js::Shape &child, Shape **listp)
|
||||
Shape *
|
||||
JSObject::getChildProperty(JSContext *cx, Shape *parent, Shape &child)
|
||||
{
|
||||
JS_ASSERT(!JSID_IS_VOID(child.id));
|
||||
JS_ASSERT(!JSID_IS_VOID(child.propid));
|
||||
JS_ASSERT(!child.inDictionary());
|
||||
|
||||
/*
|
||||
@ -512,7 +512,7 @@ Shape::newDictionaryShape(JSContext *cx, const Shape &child, Shape **listp)
|
||||
if (!dprop)
|
||||
return NULL;
|
||||
|
||||
new (dprop) Shape(child.id, child.rawGetter, child.rawSetter, child.slot, child.attrs,
|
||||
new (dprop) Shape(child.propid, child.rawGetter, child.rawSetter, child.slot, child.attrs,
|
||||
(child.flags & ~FROZEN) | IN_DICTIONARY, child.shortid,
|
||||
js_GenerateShape(cx), child.slotSpan);
|
||||
|
||||
@ -621,9 +621,9 @@ JSObject::checkShapeConsistency()
|
||||
|
||||
JS_ASSERT(isNative());
|
||||
if (hasOwnShape())
|
||||
JS_ASSERT(objShape != lastProp->shape);
|
||||
JS_ASSERT(objShape != lastProp->shapeid);
|
||||
else
|
||||
JS_ASSERT(objShape == lastProp->shape);
|
||||
JS_ASSERT(objShape == lastProp->shapeid);
|
||||
|
||||
Shape *shape = lastProp;
|
||||
Shape *prev = NULL;
|
||||
@ -639,7 +639,7 @@ JSObject::checkShapeConsistency()
|
||||
for (int n = throttle; --n >= 0 && shape->parent; shape = shape->parent) {
|
||||
JS_ASSERT_IF(shape != lastProp, !shape->hasTable());
|
||||
|
||||
Shape **spp = table->search(shape->id, false);
|
||||
Shape **spp = table->search(shape->propid, false);
|
||||
JS_ASSERT(SHAPE_FETCH(spp) == shape);
|
||||
}
|
||||
} else {
|
||||
@ -666,7 +666,7 @@ JSObject::checkShapeConsistency()
|
||||
PropertyTable *table = shape->getTable();
|
||||
JS_ASSERT(shape->parent);
|
||||
for (Shape::Range r(shape); !r.empty(); r.popFront()) {
|
||||
Shape **spp = table->search(r.front().id, false);
|
||||
Shape **spp = table->search(r.front().propid, false);
|
||||
JS_ASSERT(SHAPE_FETCH(spp) == &r.front());
|
||||
}
|
||||
}
|
||||
@ -791,7 +791,7 @@ CheckCanChangeAttrs(JSContext *cx, JSObject *obj, const Shape *shape, uintN *att
|
||||
/* Reject attempts to remove a slot from the permanent data property. */
|
||||
if (shape->isDataDescriptor() && shape->hasSlot() &&
|
||||
(*attrsp & (JSPROP_GETTER | JSPROP_SETTER | JSPROP_SHARED))) {
|
||||
obj->reportNotConfigurable(cx, shape->id);
|
||||
obj->reportNotConfigurable(cx, shape->propid);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -874,7 +874,7 @@ JSObject::putProperty(JSContext *cx, jsid id,
|
||||
if (shape != lastProp && !inDictionaryMode()) {
|
||||
if (!toDictionaryMode(cx))
|
||||
return NULL;
|
||||
spp = nativeSearch(shape->id);
|
||||
spp = nativeSearch(shape->propid);
|
||||
shape = SHAPE_FETCH(spp);
|
||||
}
|
||||
|
||||
@ -927,7 +927,7 @@ JSObject::putProperty(JSContext *cx, jsid id,
|
||||
* we regenerate only lastProp->shape. We will clearOwnShape(), which
|
||||
* sets objShape to lastProp->shape.
|
||||
*/
|
||||
lastProp->shape = js_GenerateShape(cx);
|
||||
lastProp->shapeid = js_GenerateShape(cx);
|
||||
clearOwnShape();
|
||||
} else {
|
||||
/*
|
||||
@ -983,7 +983,7 @@ JSObject::changeProperty(JSContext *cx, const Shape *shape, uintN attrs, uintN m
|
||||
PropertyOp getter, StrictPropertyOp setter)
|
||||
{
|
||||
JS_ASSERT_IF(inDictionaryMode(), !lastProp->frozen());
|
||||
JS_ASSERT(!JSID_IS_VOID(shape->id));
|
||||
JS_ASSERT(!JSID_IS_VOID(shape->propid));
|
||||
JS_ASSERT(nativeContains(*shape));
|
||||
|
||||
attrs |= shape->attrs & mask;
|
||||
@ -1038,7 +1038,7 @@ JSObject::changeProperty(JSContext *cx, const Shape *shape, uintN attrs, uintN m
|
||||
updateFlags(shape);
|
||||
|
||||
/* See the corresponding code in putProperty. */
|
||||
lastProp->shape = js_GenerateShape(cx);
|
||||
lastProp->shapeid = js_GenerateShape(cx);
|
||||
clearOwnShape();
|
||||
|
||||
shape = js_UpdateWatchpointsForShape(cx, this, shape);
|
||||
@ -1049,14 +1049,15 @@ JSObject::changeProperty(JSContext *cx, const Shape *shape, uintN attrs, uintN m
|
||||
JS_ASSERT(shape == mutableShape);
|
||||
newShape = mutableShape;
|
||||
} else if (shape == lastProp) {
|
||||
Shape child(shape->id, getter, setter, shape->slot, attrs, shape->flags, shape->shortid);
|
||||
Shape child(shape->propid, getter, setter, shape->slot, attrs, shape->flags,
|
||||
shape->shortid);
|
||||
|
||||
newShape = getChildProperty(cx, shape->parent, child);
|
||||
#ifdef DEBUG
|
||||
if (newShape) {
|
||||
JS_ASSERT(newShape == lastProp);
|
||||
if (newShape->hasTable()) {
|
||||
Shape **spp = nativeSearch(shape->id);
|
||||
Shape **spp = nativeSearch(shape->propid);
|
||||
JS_ASSERT(SHAPE_FETCH(spp) == newShape);
|
||||
}
|
||||
}
|
||||
@ -1068,8 +1069,9 @@ JSObject::changeProperty(JSContext *cx, const Shape *shape, uintN attrs, uintN m
|
||||
* removeProperty because it will free an allocated shape->slot, and
|
||||
* putProperty won't re-allocate it.
|
||||
*/
|
||||
Shape child(shape->id, getter, setter, shape->slot, attrs, shape->flags, shape->shortid);
|
||||
newShape = putProperty(cx, child.id, child.rawGetter, child.rawSetter, child.slot,
|
||||
Shape child(shape->propid, getter, setter, shape->slot, attrs, shape->flags,
|
||||
shape->shortid);
|
||||
newShape = putProperty(cx, child.propid, child.rawGetter, child.rawSetter, child.slot,
|
||||
child.attrs, child.flags, child.shortid);
|
||||
#ifdef DEBUG
|
||||
if (newShape)
|
||||
@ -1110,7 +1112,7 @@ JSObject::removeProperty(JSContext *cx, jsid id)
|
||||
if (shape != lastProp && !inDictionaryMode()) {
|
||||
if (!toDictionaryMode(cx))
|
||||
return false;
|
||||
spp = nativeSearch(shape->id);
|
||||
spp = nativeSearch(shape->propid);
|
||||
shape = SHAPE_FETCH(spp);
|
||||
}
|
||||
|
||||
@ -1288,7 +1290,7 @@ JSObject::generateOwnShape(JSContext *cx)
|
||||
void
|
||||
JSObject::deletingShapeChange(JSContext *cx, const Shape &shape)
|
||||
{
|
||||
JS_ASSERT(!JSID_IS_VOID(shape.id));
|
||||
JS_ASSERT(!JSID_IS_VOID(shape.propid));
|
||||
generateOwnShape(cx);
|
||||
}
|
||||
|
||||
@ -1297,7 +1299,7 @@ JSObject::methodShapeChange(JSContext *cx, const Shape &shape)
|
||||
{
|
||||
const Shape *result = &shape;
|
||||
|
||||
JS_ASSERT(!JSID_IS_VOID(shape.id));
|
||||
JS_ASSERT(!JSID_IS_VOID(shape.propid));
|
||||
if (shape.isMethod()) {
|
||||
#ifdef DEBUG
|
||||
const Value &prev = nativeGetSlot(shape.slot);
|
||||
@ -1313,7 +1315,7 @@ JSObject::methodShapeChange(JSContext *cx, const Shape &shape)
|
||||
* despecializing from a method memoized in the property tree to a
|
||||
* plain old function-valued property.
|
||||
*/
|
||||
result = putProperty(cx, shape.id, NULL, shape.rawSetter, shape.slot,
|
||||
result = putProperty(cx, shape.propid, NULL, shape.rawSetter, shape.slot,
|
||||
shape.attrs,
|
||||
shape.getFlags() & ~Shape::METHOD,
|
||||
shape.shortid);
|
||||
@ -1345,7 +1347,7 @@ JSObject::methodShapeChange(JSContext *cx, uint32 slot)
|
||||
} else {
|
||||
for (Shape::Range r = lastProp->all(); !r.empty(); r.popFront()) {
|
||||
const Shape &shape = r.front();
|
||||
JS_ASSERT(!JSID_IS_VOID(shape.id));
|
||||
JS_ASSERT(!JSID_IS_VOID(shape.propid));
|
||||
if (shape.slot == slot)
|
||||
return methodShapeChange(cx, shape) != NULL;
|
||||
}
|
||||
@ -1362,7 +1364,7 @@ JSObject::protoShapeChange(JSContext *cx)
|
||||
void
|
||||
JSObject::shadowingShapeChange(JSContext *cx, const Shape &shape)
|
||||
{
|
||||
JS_ASSERT(!JSID_IS_VOID(shape.id));
|
||||
JS_ASSERT(!JSID_IS_VOID(shape.propid));
|
||||
generateOwnShape(cx);
|
||||
}
|
||||
|
||||
|
@ -298,7 +298,7 @@ struct Shape : public js::gc::Cell
|
||||
friend class js::Bindings;
|
||||
friend bool IsShapeAboutToBeFinalized(JSContext *cx, const js::Shape *shape);
|
||||
|
||||
mutable uint32 shape; /* shape identifier */
|
||||
mutable uint32 shapeid; /* shape identifier */
|
||||
uint32 slotSpan; /* one more than maximum live slot number */
|
||||
|
||||
/*
|
||||
@ -316,7 +316,7 @@ struct Shape : public js::gc::Cell
|
||||
|
||||
inline void freeTable(JSContext *cx);
|
||||
|
||||
jsid id;
|
||||
jsid propid;
|
||||
|
||||
protected:
|
||||
union {
|
||||
@ -450,7 +450,7 @@ struct Shape : public js::gc::Cell
|
||||
Range(const Shape *shape) : cursor(shape) { }
|
||||
|
||||
bool empty() const {
|
||||
JS_ASSERT_IF(!cursor->parent, JSID_IS_EMPTY(cursor->id));
|
||||
JS_ASSERT_IF(!cursor->parent, JSID_IS_EMPTY(cursor->propid));
|
||||
return !cursor->parent;
|
||||
}
|
||||
|
||||
@ -498,7 +498,7 @@ struct Shape : public js::gc::Cell
|
||||
bool frozen() const { return (flags & FROZEN) != 0; }
|
||||
void setFrozen() { flags |= FROZEN; }
|
||||
|
||||
bool isEmptyShape() const { JS_ASSERT_IF(!parent, JSID_IS_EMPTY(id)); return !parent; }
|
||||
bool isEmptyShape() const { JS_ASSERT_IF(!parent, JSID_IS_EMPTY(propid)); return !parent; }
|
||||
|
||||
public:
|
||||
/* Public bits stored in shape->flags. */
|
||||
@ -686,7 +686,7 @@ struct EmptyShape : public js::Shape
|
||||
*/
|
||||
#define SHAPE_USERID(shape) \
|
||||
((shape)->hasShortID() ? INT_TO_JSID((shape)->shortid) \
|
||||
: (shape)->id)
|
||||
: (shape)->propid)
|
||||
|
||||
extern uint32
|
||||
js_GenerateShape(JSRuntime *rt);
|
||||
@ -764,7 +764,7 @@ Shape::search(JSRuntime *rt, js::Shape **startp, jsid id, bool adding)
|
||||
*/
|
||||
js::Shape **spp;
|
||||
for (spp = startp; js::Shape *shape = *spp; spp = &shape->parent) {
|
||||
if (shape->id == id) {
|
||||
if (shape->propid == id) {
|
||||
METER(hits);
|
||||
return spp;
|
||||
}
|
||||
|
@ -114,14 +114,14 @@ JSObject::updateShape(JSContext *cx)
|
||||
if (hasOwnShape())
|
||||
setOwnShape(js_GenerateShape(cx));
|
||||
else
|
||||
objShape = lastProp->shape;
|
||||
objShape = lastProp->shapeid;
|
||||
}
|
||||
|
||||
inline void
|
||||
JSObject::updateFlags(const js::Shape *shape, bool isDefinitelyAtom)
|
||||
{
|
||||
jsuint index;
|
||||
if (!isDefinitelyAtom && js_IdIsIndex(shape->id, &index))
|
||||
if (!isDefinitelyAtom && js_IdIsIndex(shape->propid, &index))
|
||||
setIndexed();
|
||||
|
||||
if (shape->isMethod())
|
||||
@ -160,12 +160,12 @@ StringObject::init(JSContext *cx, JSString *str)
|
||||
}
|
||||
|
||||
inline
|
||||
Shape::Shape(jsid id, js::PropertyOp getter, js::StrictPropertyOp setter, uint32 slot, uintN attrs,
|
||||
uintN flags, intN shortid, uint32 shape, uint32 slotSpan)
|
||||
: shape(shape),
|
||||
Shape::Shape(jsid propid, js::PropertyOp getter, js::StrictPropertyOp setter, uint32 slot,
|
||||
uintN attrs, uintN flags, intN shortid, uint32 shapeid, uint32 slotSpan)
|
||||
: shapeid(shapeid),
|
||||
slotSpan(slotSpan),
|
||||
numLinearSearches(0),
|
||||
id(id),
|
||||
propid(propid),
|
||||
rawGetter(getter),
|
||||
rawSetter(setter),
|
||||
slot(slot),
|
||||
@ -182,10 +182,10 @@ Shape::Shape(jsid id, js::PropertyOp getter, js::StrictPropertyOp setter, uint32
|
||||
|
||||
inline
|
||||
Shape::Shape(JSCompartment *comp, Class *aclasp)
|
||||
: shape(js_GenerateShape(comp->rt)),
|
||||
: shapeid(js_GenerateShape(comp->rt)),
|
||||
slotSpan(JSSLOT_FREE(aclasp)),
|
||||
numLinearSearches(0),
|
||||
id(JSID_EMPTY),
|
||||
propid(JSID_EMPTY),
|
||||
clasp(aclasp),
|
||||
rawSetter(NULL),
|
||||
slot(SHAPE_INVALID_SLOT),
|
||||
@ -198,11 +198,11 @@ Shape::Shape(JSCompartment *comp, Class *aclasp)
|
||||
}
|
||||
|
||||
inline
|
||||
Shape::Shape(uint32 shape)
|
||||
: shape(shape),
|
||||
Shape::Shape(uint32 shapeid)
|
||||
: shapeid(shapeid),
|
||||
slotSpan(0),
|
||||
numLinearSearches(0),
|
||||
id(JSID_EMPTY),
|
||||
propid(JSID_EMPTY),
|
||||
clasp(NULL),
|
||||
rawSetter(NULL),
|
||||
slot(SHAPE_INVALID_SLOT),
|
||||
@ -229,16 +229,16 @@ Shape::hash() const
|
||||
hash = JS_ROTATE_LEFT32(hash, 4) ^ attrs;
|
||||
hash = JS_ROTATE_LEFT32(hash, 4) ^ shortid;
|
||||
hash = JS_ROTATE_LEFT32(hash, 4) ^ slot;
|
||||
hash = JS_ROTATE_LEFT32(hash, 4) ^ JSID_BITS(id);
|
||||
hash = JS_ROTATE_LEFT32(hash, 4) ^ JSID_BITS(propid);
|
||||
return hash;
|
||||
}
|
||||
|
||||
inline bool
|
||||
Shape::matches(const js::Shape *other) const
|
||||
{
|
||||
JS_ASSERT(!JSID_IS_VOID(id));
|
||||
JS_ASSERT(!JSID_IS_VOID(other->id));
|
||||
return id == other->id &&
|
||||
JS_ASSERT(!JSID_IS_VOID(propid));
|
||||
JS_ASSERT(!JSID_IS_VOID(other->propid));
|
||||
return propid == other->propid &&
|
||||
matchesParamsAfterId(other->rawGetter, other->rawSetter, other->slot, other->attrs,
|
||||
other->flags, other->shortid);
|
||||
}
|
||||
@ -247,7 +247,7 @@ inline bool
|
||||
Shape::matchesParamsAfterId(js::PropertyOp agetter, js::StrictPropertyOp asetter, uint32 aslot,
|
||||
uintN aattrs, uintN aflags, intN ashortid) const
|
||||
{
|
||||
JS_ASSERT(!JSID_IS_VOID(id));
|
||||
JS_ASSERT(!JSID_IS_VOID(propid));
|
||||
return rawGetter == agetter &&
|
||||
rawSetter == asetter &&
|
||||
slot == aslot &&
|
||||
@ -259,13 +259,13 @@ Shape::matchesParamsAfterId(js::PropertyOp agetter, js::StrictPropertyOp asetter
|
||||
inline bool
|
||||
Shape::get(JSContext* cx, JSObject *receiver, JSObject* obj, JSObject *pobj, js::Value* vp) const
|
||||
{
|
||||
JS_ASSERT(!JSID_IS_VOID(this->id));
|
||||
JS_ASSERT(!JSID_IS_VOID(propid));
|
||||
JS_ASSERT(!hasDefaultGetter());
|
||||
|
||||
if (hasGetterValue()) {
|
||||
JS_ASSERT(!isMethod());
|
||||
js::Value fval = getterValue();
|
||||
return js::ExternalGetOrSet(cx, receiver, id, fval, JSACC_READ, 0, 0, vp);
|
||||
return js::ExternalGetOrSet(cx, receiver, propid, fval, JSACC_READ, 0, 0, vp);
|
||||
}
|
||||
|
||||
if (isMethod()) {
|
||||
@ -289,7 +289,7 @@ Shape::set(JSContext* cx, JSObject* obj, bool strict, js::Value* vp) const
|
||||
|
||||
if (attrs & JSPROP_SETTER) {
|
||||
js::Value fval = setterValue();
|
||||
return js::ExternalGetOrSet(cx, obj, id, fval, JSACC_WRITE, 1, vp, vp);
|
||||
return js::ExternalGetOrSet(cx, obj, propid, fval, JSACC_WRITE, 1, vp, vp);
|
||||
}
|
||||
|
||||
if (attrs & JSPROP_GETTER)
|
||||
@ -308,12 +308,12 @@ Shape::removeFromDictionary(JSObject *obj) const
|
||||
JS_ASSERT(inDictionary());
|
||||
JS_ASSERT(obj->inDictionaryMode());
|
||||
JS_ASSERT(listp);
|
||||
JS_ASSERT(!JSID_IS_VOID(id));
|
||||
JS_ASSERT(!JSID_IS_VOID(propid));
|
||||
|
||||
JS_ASSERT(obj->lastProp->inDictionary());
|
||||
JS_ASSERT(obj->lastProp->listp == &obj->lastProp);
|
||||
JS_ASSERT_IF(obj->lastProp != this, !JSID_IS_VOID(obj->lastProp->id));
|
||||
JS_ASSERT_IF(obj->lastProp->parent, !JSID_IS_VOID(obj->lastProp->parent->id));
|
||||
JS_ASSERT_IF(obj->lastProp != this, !JSID_IS_VOID(obj->lastProp->propid));
|
||||
JS_ASSERT_IF(obj->lastProp->parent, !JSID_IS_VOID(obj->lastProp->parent->propid));
|
||||
|
||||
if (parent)
|
||||
parent->listp = listp;
|
||||
@ -330,12 +330,12 @@ Shape::insertIntoDictionary(js::Shape **dictp)
|
||||
*/
|
||||
JS_ASSERT(inDictionary());
|
||||
JS_ASSERT(!listp);
|
||||
JS_ASSERT(!JSID_IS_VOID(id));
|
||||
JS_ASSERT(!JSID_IS_VOID(propid));
|
||||
|
||||
JS_ASSERT_IF(*dictp, !(*dictp)->frozen());
|
||||
JS_ASSERT_IF(*dictp, (*dictp)->inDictionary());
|
||||
JS_ASSERT_IF(*dictp, (*dictp)->listp == dictp);
|
||||
JS_ASSERT_IF(*dictp, !JSID_IS_VOID((*dictp)->id));
|
||||
JS_ASSERT_IF(*dictp, !JSID_IS_VOID((*dictp)->propid));
|
||||
JS_ASSERT_IF(*dictp, compartment() == (*dictp)->compartment());
|
||||
|
||||
setParent(*dictp);
|
||||
|
@ -206,10 +206,10 @@ Bindings::getLocalNameArray(JSContext *cx, JSArenaPool *pool)
|
||||
}
|
||||
|
||||
JSAtom *atom;
|
||||
if (JSID_IS_ATOM(shape.id)) {
|
||||
atom = JSID_TO_ATOM(shape.id);
|
||||
if (JSID_IS_ATOM(shape.propid)) {
|
||||
atom = JSID_TO_ATOM(shape.propid);
|
||||
} else {
|
||||
JS_ASSERT(JSID_IS_INT(shape.id));
|
||||
JS_ASSERT(JSID_IS_INT(shape.propid));
|
||||
JS_ASSERT(shape.getter() == GetCallArg);
|
||||
atom = NULL;
|
||||
}
|
||||
|
@ -8152,7 +8152,7 @@ TraceRecorder::callProp(JSObject* obj, JSProperty* prop, jsid id, Value*& vp,
|
||||
// should. See bug 514046, for which this code is future-proof. Remove
|
||||
// this comment when that bug is fixed (so, FIXME: 514046).
|
||||
DebugOnly<JSBool> rv =
|
||||
js_GetPropertyHelper(cx, obj, shape->id,
|
||||
js_GetPropertyHelper(cx, obj, shape->propid,
|
||||
(op == JSOP_CALLNAME)
|
||||
? JSGET_NO_METHOD_BARRIER
|
||||
: JSGET_METHOD_BARRIER,
|
||||
@ -12692,7 +12692,7 @@ GetPropertyWithNativeGetter(JSContext* cx, JSObject* obj, Shape* shape, Value* v
|
||||
#ifdef DEBUG
|
||||
JSProperty* prop;
|
||||
JSObject* pobj;
|
||||
JS_ASSERT(obj->lookupProperty(cx, shape->id, &pobj, &prop));
|
||||
JS_ASSERT(obj->lookupProperty(cx, shape->propid, &pobj, &prop));
|
||||
JS_ASSERT(prop == (JSProperty*) shape);
|
||||
#endif
|
||||
|
||||
|
@ -236,7 +236,7 @@ stubs::SetName(VMFrame &f, JSAtom *origAtom)
|
||||
* Purge the property cache of the id we may have just
|
||||
* shadowed in obj's scope and proto chains.
|
||||
*/
|
||||
js_PurgeScopeChain(cx, obj, shape->id);
|
||||
js_PurgeScopeChain(cx, obj, shape->propid);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2085,7 +2085,7 @@ InitPropOrMethod(VMFrame &f, JSAtom *atom, JSOp op)
|
||||
|
||||
/* A new object, or one we just extended in a recent initprop op. */
|
||||
JS_ASSERT(!obj->lastProperty() ||
|
||||
obj->shape() == obj->lastProperty()->shape);
|
||||
obj->shape() == obj->lastProperty()->shapeid);
|
||||
obj->extend(cx, shape);
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user