mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 786880 - Move nativeContains into ObjectImpl. r=bhackett
--HG-- extra : rebase_source : bcf9310c68cf67bd093a13108c791cf817ed9e40
This commit is contained in:
parent
09d4300426
commit
6a5abe7484
@ -2037,9 +2037,8 @@ 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, undefinedId) &&
|
||||
if (!obj->nativeContains(cx, undefinedName) &&
|
||||
!JSObject::defineProperty(cx, obj, undefinedName, undefinedValue,
|
||||
JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JSPROP_PERMANENT | JSPROP_READONLY)) {
|
||||
@ -2114,11 +2113,10 @@ AddNameToArray(JSContext *cx, PropertyName *name, JSIdArray *ida, int *ip)
|
||||
}
|
||||
|
||||
static JSIdArray *
|
||||
EnumerateIfResolved(JSContext *cx, JSHandleObject obj, PropertyName *name, JSIdArray *ida,
|
||||
int *ip, JSBool *foundp)
|
||||
EnumerateIfResolved(JSContext *cx, Handle<JSObject*> obj, Handle<PropertyName*> name,
|
||||
JSIdArray *ida, int *ip, JSBool *foundp)
|
||||
{
|
||||
RootedId id(cx, NameToId(name));
|
||||
*foundp = obj->nativeContains(cx, id);
|
||||
*foundp = obj->nativeContains(cx, name);
|
||||
if (*foundp)
|
||||
ida = AddNameToArray(cx, name, ida, ip);
|
||||
return ida;
|
||||
@ -2130,7 +2128,6 @@ JS_EnumerateResolvedStandardClasses(JSContext *cx, JSObject *objArg, JSIdArray *
|
||||
RootedObject obj(cx, objArg);
|
||||
JSRuntime *rt;
|
||||
int i, j, k;
|
||||
PropertyName *name;
|
||||
JSBool found;
|
||||
JSClassInitializerOp init;
|
||||
|
||||
@ -2148,7 +2145,7 @@ JS_EnumerateResolvedStandardClasses(JSContext *cx, JSObject *objArg, JSIdArray *
|
||||
}
|
||||
|
||||
/* Check whether 'undefined' has been resolved and enumerate it if so. */
|
||||
name = rt->atomState.typeAtoms[JSTYPE_VOID];
|
||||
Rooted<PropertyName*> name(cx, rt->atomState.typeAtoms[JSTYPE_VOID]);
|
||||
ida = EnumerateIfResolved(cx, obj, name, ida, &i, &found);
|
||||
if (!ida)
|
||||
return NULL;
|
||||
|
@ -312,12 +312,6 @@ 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);
|
||||
|
||||
|
@ -935,30 +935,6 @@ 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
|
||||
{
|
||||
|
@ -163,8 +163,8 @@ PropertyCache::fullTest(JSContext *cx, jsbytecode *pc, JSObject **objp, JSObject
|
||||
|
||||
if (pobj->lastProperty() == entry->pshape) {
|
||||
#ifdef DEBUG
|
||||
PropertyName *name = GetNameFromBytecode(cx, script, pc, op);
|
||||
JS_ASSERT(pobj->nativeContainsNoAllocation(NameToId(name)));
|
||||
Rooted<PropertyName*> name(cx, GetNameFromBytecode(cx, script, pc, op));
|
||||
JS_ASSERT(pobj->nativeContainsNoAllocation(name));
|
||||
#endif
|
||||
*pobjp = pobj;
|
||||
return NULL;
|
||||
|
@ -64,6 +64,42 @@ js::ObjectImpl::nativeLookupNoAllocation(PropertyName *name)
|
||||
return nativeLookupNoAllocation(PropertyId(name));
|
||||
}
|
||||
|
||||
inline bool
|
||||
js::ObjectImpl::nativeContains(JSContext *cx, JS::Handle<jsid> id)
|
||||
{
|
||||
return nativeLookup(cx, id) != NULL;
|
||||
}
|
||||
|
||||
inline bool
|
||||
js::ObjectImpl::nativeContains(JSContext *cx, JS::Handle<PropertyName*> name)
|
||||
{
|
||||
return nativeLookup(cx, name) != NULL;
|
||||
}
|
||||
|
||||
inline bool
|
||||
js::ObjectImpl::nativeContains(JSContext *cx, JS::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
|
||||
{
|
||||
|
@ -1162,6 +1162,14 @@ 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;
|
||||
|
Loading…
Reference in New Issue
Block a user