Backed out changeset 6227aa557e54, Windows bustage, will investigate at leisure after tree is fixed. r=redness

This commit is contained in:
Jeff Walden 2012-08-31 11:51:04 -07:00
parent b6dd9426f4
commit f6784176f3
6 changed files with 40 additions and 51 deletions

View File

@ -2037,8 +2037,9 @@ JS_EnumerateStandardClasses(JSContext *cx, JSObject *objArg)
* Since ES5 15.1.1.3 undefined can't be deleted.
*/
RootedPropertyName undefinedName(cx, cx->runtime->atomState.typeAtoms[JSTYPE_VOID]);
RootedId undefinedId(cx, NameToId(undefinedName));
RootedValue undefinedValue(cx, UndefinedValue());
if (!obj->nativeContains(cx, undefinedName) &&
if (!obj->nativeContains(cx, undefinedId) &&
!JSObject::defineProperty(cx, obj, undefinedName, undefinedValue,
JS_PropertyStub, JS_StrictPropertyStub,
JSPROP_PERMANENT | JSPROP_READONLY)) {
@ -2113,10 +2114,11 @@ AddNameToArray(JSContext *cx, PropertyName *name, JSIdArray *ida, int *ip)
}
static JSIdArray *
EnumerateIfResolved(JSContext *cx, Handle<JSObject*> obj, Handle<PropertyName*> name,
JSIdArray *ida, int *ip, JSBool *foundp)
EnumerateIfResolved(JSContext *cx, JSHandleObject obj, PropertyName *name, JSIdArray *ida,
int *ip, JSBool *foundp)
{
*foundp = obj->nativeContains(cx, name);
RootedId id(cx, NameToId(name));
*foundp = obj->nativeContains(cx, id);
if (*foundp)
ida = AddNameToArray(cx, name, ida, ip);
return ida;
@ -2128,6 +2130,7 @@ JS_EnumerateResolvedStandardClasses(JSContext *cx, JSObject *objArg, JSIdArray *
RootedObject obj(cx, objArg);
JSRuntime *rt;
int i, j, k;
PropertyName *name;
JSBool found;
JSClassInitializerOp init;
@ -2145,7 +2148,7 @@ JS_EnumerateResolvedStandardClasses(JSContext *cx, JSObject *objArg, JSIdArray *
}
/* Check whether 'undefined' has been resolved and enumerate it if so. */
Rooted<PropertyName*> name(cx, rt->atomState.typeAtoms[JSTYPE_VOID]);
name = rt->atomState.typeAtoms[JSTYPE_VOID];
ida = EnumerateIfResolved(cx, obj, name, ida, &i, &found);
if (!ida)
return NULL;

View File

@ -312,6 +312,12 @@ struct JSObject : public js::ObjectImpl
*/
bool setSlotSpan(JSContext *cx, uint32_t span);
inline bool nativeContains(JSContext *cx, js::HandleId id);
inline bool nativeContains(JSContext *cx, js::HandleShape shape);
inline bool nativeContainsNoAllocation(jsid id);
inline bool nativeContainsNoAllocation(const js::Shape &shape);
/* Upper bound on the number of elements in an object. */
static const uint32_t NELEMENTS_LIMIT = JS_BIT(28);

View File

@ -927,6 +927,30 @@ JSObject::nativeSetSlotWithType(JSContext *cx, js::Shape *shape, const js::Value
js::types::AddTypePropertyId(cx, this, shape->propid(), value);
}
inline bool
JSObject::nativeContains(JSContext *cx, js::HandleId id)
{
return nativeLookup(cx, id) != NULL;
}
inline bool
JSObject::nativeContains(JSContext *cx, js::HandleShape shape)
{
return nativeLookup(cx, shape->propid()) == shape;
}
inline bool
JSObject::nativeContainsNoAllocation(jsid id)
{
return nativeLookupNoAllocation(id) != NULL;
}
inline bool
JSObject::nativeContainsNoAllocation(const js::Shape &shape)
{
return nativeLookupNoAllocation(shape.propid()) == &shape;
}
inline bool
JSObject::nativeEmpty() const
{

View File

@ -163,8 +163,8 @@ PropertyCache::fullTest(JSContext *cx, jsbytecode *pc, JSObject **objp, JSObject
if (pobj->lastProperty() == entry->pshape) {
#ifdef DEBUG
Rooted<PropertyName*> name(cx, GetNameFromBytecode(cx, script, pc, op));
JS_ASSERT(pobj->nativeContainsNoAllocation(name));
PropertyName *name = GetNameFromBytecode(cx, script, pc, op);
JS_ASSERT(pobj->nativeContainsNoAllocation(NameToId(name)));
#endif
*pobjp = pobj;
return NULL;

View File

@ -64,42 +64,6 @@ js::ObjectImpl::nativeLookupNoAllocation(PropertyName *name)
return nativeLookupNoAllocation(PropertyId(name));
}
inline bool
js::ObjectImpl::nativeContains(JSContext *cx, Handle<jsid> id)
{
return nativeLookup(cx, id) != NULL;
}
inline bool
js::ObjectImpl::nativeContains(JSContext *cx, Handle<PropertyName*> name)
{
return nativeLookup(cx, name) != NULL;
}
inline bool
js::ObjectImpl::nativeContains(JSContext *cx, Handle<Shape*> shape)
{
return nativeLookup(cx, shape->propid()) == shape;
}
inline bool
js::ObjectImpl::nativeContainsNoAllocation(jsid id)
{
return nativeLookupNoAllocation(id) != NULL;
}
inline bool
js::ObjectImpl::nativeContainsNoAllocation(PropertyName *name)
{
return nativeLookupNoAllocation(name) != NULL;
}
inline bool
js::ObjectImpl::nativeContainsNoAllocation(Shape &shape)
{
return nativeLookupNoAllocation(shape.propid()) == &shape;
}
inline bool
js::ObjectImpl::isExtensible() const
{

View File

@ -1156,14 +1156,6 @@ class ObjectImpl : public gc::Cell
inline Shape * nativeLookupNoAllocation(PropertyId pid);
inline Shape * nativeLookupNoAllocation(PropertyName *name);
inline bool nativeContains(JSContext *cx, Handle<jsid> id);
inline bool nativeContains(JSContext *cx, Handle<PropertyName*> name);
inline bool nativeContains(JSContext *cx, Handle<Shape*> shape);
inline bool nativeContainsNoAllocation(jsid id);
inline bool nativeContainsNoAllocation(PropertyName *name);
inline bool nativeContainsNoAllocation(Shape &shape);
inline Class *getClass() const;
inline JSClass *getJSClass() const;
inline bool hasClass(const Class *c) const;