mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 556353 - Remove OBJ_IS_NATIVE, HAS_FUNCTION_CLASS. r=brendan.
This commit is contained in:
parent
0c54c01325
commit
795d4b8ad2
@ -20,7 +20,7 @@ BEGIN_TEST(testLookup_bug522590)
|
||||
CHECK(JS_LookupProperty(cx, xobj, "f", r.addr()));
|
||||
CHECK(JSVAL_IS_OBJECT(r));
|
||||
JSObject *funobj = JSVAL_TO_OBJECT(r);
|
||||
CHECK(HAS_FUNCTION_CLASS(funobj));
|
||||
CHECK(funobj->isFunction());
|
||||
CHECK(!js::IsInternalFunctionObject(funobj));
|
||||
CHECK(GET_FUNCTION_PRIVATE(cx, funobj) != (JSFunction *) funobj);
|
||||
|
||||
|
@ -2770,7 +2770,7 @@ JS_SealObject(JSContext *cx, JSObject *obj, JSBool deep)
|
||||
if (obj->isDenseArray() && !js_MakeArraySlow(cx, obj))
|
||||
return JS_FALSE;
|
||||
|
||||
if (!OBJ_IS_NATIVE(obj)) {
|
||||
if (!obj->isNative()) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
|
||||
JSMSG_CANT_SEAL_OBJECT,
|
||||
OBJ_GET_CLASS(cx, obj)->name);
|
||||
@ -2851,7 +2851,7 @@ DefinePropertyById(JSContext *cx, JSObject *obj, jsid id, jsval value,
|
||||
JSPropertyOp getter, JSPropertyOp setter, uintN attrs,
|
||||
uintN flags, intN tinyid)
|
||||
{
|
||||
if (flags != 0 && OBJ_IS_NATIVE(obj)) {
|
||||
if (flags != 0 && obj->isNative()) {
|
||||
JSAutoResolveFlags rf(cx, JSRESOLVE_QUALIFIED | JSRESOLVE_DECLARING);
|
||||
return !!js_DefineNativeProperty(cx, obj, id, value, getter, setter,
|
||||
attrs, flags, tinyid, NULL);
|
||||
@ -2894,7 +2894,7 @@ DefineUCProperty(JSContext *cx, JSObject *obj,
|
||||
atom = js_AtomizeChars(cx, name, AUTO_NAMELEN(name, namelen), 0);
|
||||
if (!atom)
|
||||
return JS_FALSE;
|
||||
if (flags != 0 && OBJ_IS_NATIVE(obj)) {
|
||||
if (flags != 0 && obj->isNative()) {
|
||||
JSAutoResolveFlags rf(cx, JSRESOLVE_QUALIFIED | JSRESOLVE_DECLARING);
|
||||
return !!js_DefineNativeProperty(cx, obj, ATOM_TO_JSID(atom), value,
|
||||
getter, setter, attrs, flags, tinyid,
|
||||
@ -3045,7 +3045,7 @@ JS_AliasProperty(JSContext *cx, JSObject *obj, const char *name,
|
||||
js_ReportIsNotDefined(cx, name);
|
||||
return JS_FALSE;
|
||||
}
|
||||
if (obj2 != obj || !OBJ_IS_NATIVE(obj)) {
|
||||
if (obj2 != obj || !obj->isNative()) {
|
||||
obj2->dropProperty(cx, prop);
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_ALIAS,
|
||||
alias, name, OBJ_GET_CLASS(cx, obj2)->name);
|
||||
@ -3077,7 +3077,7 @@ LookupResult(JSContext *cx, JSObject *obj, JSObject *obj2, JSProperty *prop,
|
||||
}
|
||||
|
||||
JSBool ok = JS_TRUE;
|
||||
if (OBJ_IS_NATIVE(obj2)) {
|
||||
if (obj2->isNative()) {
|
||||
JSScopeProperty *sprop = (JSScopeProperty *) prop;
|
||||
|
||||
if (sprop->isMethod()) {
|
||||
@ -3127,7 +3127,7 @@ GetPropertyAttributesById(JSContext *cx, JSObject *obj, jsid id, uintN flags,
|
||||
|
||||
ok = obj2->getAttributes(cx, id, prop, &desc->attrs);
|
||||
if (ok) {
|
||||
if (OBJ_IS_NATIVE(obj2)) {
|
||||
if (obj2->isNative()) {
|
||||
JSScopeProperty *sprop = (JSScopeProperty *) prop;
|
||||
|
||||
desc->getter = sprop->getter();
|
||||
@ -3257,7 +3257,7 @@ AlreadyHasOwnPropertyHelper(JSContext *cx, JSObject *obj, jsid id,
|
||||
{
|
||||
JSScope *scope;
|
||||
|
||||
if (!OBJ_IS_NATIVE(obj)) {
|
||||
if (!obj->isNative()) {
|
||||
JSObject *obj2;
|
||||
JSProperty *prop;
|
||||
|
||||
@ -3381,7 +3381,7 @@ JS_LookupPropertyWithFlagsById(JSContext *cx, JSObject *obj, jsid id,
|
||||
JSProperty *prop;
|
||||
|
||||
CHECK_REQUEST(cx);
|
||||
ok = OBJ_IS_NATIVE(obj)
|
||||
ok = obj->isNative()
|
||||
? js_LookupPropertyWithFlags(cx, obj, id, flags, objp, &prop) >= 0
|
||||
: obj->lookupProperty(cx, id, objp, &prop);
|
||||
if (ok)
|
||||
@ -3727,7 +3727,7 @@ JS_AliasElement(JSContext *cx, JSObject *obj, const char *name, jsint alias)
|
||||
js_ReportIsNotDefined(cx, name);
|
||||
return JS_FALSE;
|
||||
}
|
||||
if (obj2 != obj || !OBJ_IS_NATIVE(obj)) {
|
||||
if (obj2 != obj || !obj->isNative()) {
|
||||
char numBuf[12];
|
||||
obj2->dropProperty(cx, prop);
|
||||
JS_snprintf(numBuf, sizeof numBuf, "%ld", (long)alias);
|
||||
@ -3959,7 +3959,7 @@ JS_NewPropertyIterator(JSContext *cx, JSObject *obj)
|
||||
if (!iterobj)
|
||||
return NULL;
|
||||
|
||||
if (OBJ_IS_NATIVE(obj)) {
|
||||
if (obj->isNative()) {
|
||||
/* Native case: start with the last property in obj's own scope. */
|
||||
scope = OBJ_SCOPE(obj);
|
||||
pdata = scope->lastProperty();
|
||||
@ -3999,7 +3999,7 @@ JS_NextProperty(JSContext *cx, JSObject *iterobj, jsid *idp)
|
||||
if (i < 0) {
|
||||
/* Native case: private data is a property tree node pointer. */
|
||||
obj = iterobj->getParent();
|
||||
JS_ASSERT(OBJ_IS_NATIVE(obj));
|
||||
JS_ASSERT(obj->isNative());
|
||||
scope = OBJ_SCOPE(obj);
|
||||
sprop = (JSScopeProperty *) iterobj->getPrivate();
|
||||
|
||||
|
@ -790,7 +790,7 @@ array_getProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
|
||||
return JS_FALSE;
|
||||
|
||||
if (prop) {
|
||||
if (OBJ_IS_NATIVE(obj2)) {
|
||||
if (obj2->isNative()) {
|
||||
sprop = (JSScopeProperty *) prop;
|
||||
if (!js_NativeGet(cx, obj, obj2, sprop, JSGET_METHOD_BARRIER, vp))
|
||||
return JS_FALSE;
|
||||
@ -889,7 +889,7 @@ js_PrototypeHasIndexedProperties(JSContext *cx, JSObject *obj)
|
||||
* a native object (possibly a slow array) that has indexed properties,
|
||||
* return true.
|
||||
*/
|
||||
if (!OBJ_IS_NATIVE(obj))
|
||||
if (!obj->isNative())
|
||||
return JS_TRUE;
|
||||
if (OBJ_SCOPE(obj)->hadIndexedProperties())
|
||||
return JS_TRUE;
|
||||
|
@ -68,8 +68,8 @@ JSObject::isArray() const
|
||||
}
|
||||
|
||||
/*
|
||||
* Dense arrays are not native (OBJ_IS_NATIVE(cx, aobj) for a dense array aobj
|
||||
* results in false, meaning aobj->map does not point to a JSScope).
|
||||
* Dense arrays are not native -- aobj->isNative() for a dense array aobj
|
||||
* results in false, meaning aobj->map does not point to a JSScope.
|
||||
*
|
||||
* But Array methods are called via aobj.sort(), e.g., and the interpreter and
|
||||
* the trace recorder must consult the property cache in order to perform well.
|
||||
|
@ -328,8 +328,8 @@ JS_DEFINE_CALLINFO_2(extern, STRING, js_BooleanIntToString, CONTEXT, INT32, 1, A
|
||||
JSObject* FASTCALL
|
||||
js_NewNullClosure(JSContext* cx, JSObject* funobj, JSObject* proto, JSObject* parent)
|
||||
{
|
||||
JS_ASSERT(HAS_FUNCTION_CLASS(funobj));
|
||||
JS_ASSERT(HAS_FUNCTION_CLASS(proto));
|
||||
JS_ASSERT(funobj->isFunction());
|
||||
JS_ASSERT(proto->isFunction());
|
||||
JS_ASSERT(JS_ON_TRACE(cx));
|
||||
|
||||
JSFunction *fun = (JSFunction*) funobj;
|
||||
|
@ -631,7 +631,7 @@ js_watch_set(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
/* NB: wp is held, so we can safely dereference it still. */
|
||||
ok = wp->handler(cx, obj, propid,
|
||||
SPROP_HAS_VALID_SLOT(sprop, scope)
|
||||
? obj->lockAndGetSlot(cx, sprop->slot)
|
||||
? obj->getSlotMT(cx, sprop->slot)
|
||||
: JSVAL_VOID,
|
||||
vp, wp->closure);
|
||||
if (ok) {
|
||||
@ -846,7 +846,7 @@ JS_SetWatchPoint(JSContext *cx, JSObject *obj, jsval idval,
|
||||
if (origobj != obj && !obj->checkAccess(cx, propid, JSACC_WATCH, &v, &attrs))
|
||||
return JS_FALSE;
|
||||
|
||||
if (!OBJ_IS_NATIVE(obj)) {
|
||||
if (!obj->isNative()) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_WATCH,
|
||||
OBJ_GET_CLASS(cx, obj)->name);
|
||||
return JS_FALSE;
|
||||
@ -874,7 +874,7 @@ JS_SetWatchPoint(JSContext *cx, JSObject *obj, jsval idval,
|
||||
uintN attrs, flags;
|
||||
intN shortid;
|
||||
|
||||
if (OBJ_IS_NATIVE(pobj)) {
|
||||
if (pobj->isNative()) {
|
||||
value = SPROP_HAS_VALID_SLOT(sprop, OBJ_SCOPE(pobj))
|
||||
? LOCKED_OBJ_GET_SLOT(pobj, sprop->slot)
|
||||
: JSVAL_VOID;
|
||||
@ -1242,7 +1242,7 @@ JS_GetFrameFunctionObject(JSContext *cx, JSStackFrame *fp)
|
||||
if (!fp->fun)
|
||||
return NULL;
|
||||
|
||||
JS_ASSERT(HAS_FUNCTION_CLASS(fp->callee()));
|
||||
JS_ASSERT(fp->callee()->isFunction());
|
||||
JS_ASSERT(fp->callee()->getPrivate() == fp->fun);
|
||||
return fp->callee();
|
||||
}
|
||||
@ -1501,7 +1501,7 @@ JS_GetPropertyDescArray(JSContext *cx, JSObject *obj, JSPropertyDescArray *pda)
|
||||
JSScopeProperty *sprop;
|
||||
|
||||
clasp = OBJ_GET_CLASS(cx, obj);
|
||||
if (!OBJ_IS_NATIVE(obj) || (clasp->flags & JSCLASS_NEW_ENUMERATE)) {
|
||||
if (!obj->isNative() || (clasp->flags & JSCLASS_NEW_ENUMERATE)) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
|
||||
JSMSG_CANT_DESCRIBE_PROPS, clasp->name);
|
||||
return JS_FALSE;
|
||||
@ -1652,7 +1652,7 @@ JS_GetObjectTotalSize(JSContext *cx, JSObject *obj)
|
||||
nbytes += ((uint32)obj->dslots[-1] - JS_INITIAL_NSLOTS + 1)
|
||||
* sizeof obj->dslots[0];
|
||||
}
|
||||
if (OBJ_IS_NATIVE(obj)) {
|
||||
if (obj->isNative()) {
|
||||
scope = OBJ_SCOPE(obj);
|
||||
if (!scope->isSharedEmpty()) {
|
||||
nbytes += sizeof *scope;
|
||||
|
@ -2458,7 +2458,7 @@ js_NewFunction(JSContext *cx, JSObject *funobj, JSNative native, uintN nargs,
|
||||
JSFunction *fun;
|
||||
|
||||
if (funobj) {
|
||||
JS_ASSERT(HAS_FUNCTION_CLASS(funobj));
|
||||
JS_ASSERT(funobj->isFunction());
|
||||
funobj->setParent(parent);
|
||||
} else {
|
||||
funobj = js_NewObject(cx, &js_FunctionClass, NULL, parent);
|
||||
|
@ -248,20 +248,18 @@ JSObject::isFunction() const
|
||||
return getClass() == &js_FunctionClass;
|
||||
}
|
||||
|
||||
#define HAS_FUNCTION_CLASS(obj) (obj)->isFunction()
|
||||
|
||||
/*
|
||||
* NB: jsapi.h and jsobj.h must be included before any call to this macro.
|
||||
*/
|
||||
#define VALUE_IS_FUNCTION(cx, v) \
|
||||
(!JSVAL_IS_PRIMITIVE(v) && HAS_FUNCTION_CLASS(JSVAL_TO_OBJECT(v)))
|
||||
(!JSVAL_IS_PRIMITIVE(v) && JSVAL_TO_OBJECT(v)->isFunction())
|
||||
|
||||
/*
|
||||
* Macro to access the private slot of the function object after the slot is
|
||||
* initialized.
|
||||
*/
|
||||
#define GET_FUNCTION_PRIVATE(cx, funobj) \
|
||||
(JS_ASSERT(HAS_FUNCTION_CLASS(funobj)), \
|
||||
(JS_ASSERT((funobj)->isFunction()), \
|
||||
(JSFunction *) (funobj)->getPrivate())
|
||||
|
||||
namespace js {
|
||||
@ -274,7 +272,7 @@ namespace js {
|
||||
inline bool
|
||||
IsInternalFunctionObject(JSObject *funobj)
|
||||
{
|
||||
JS_ASSERT(HAS_FUNCTION_CLASS(funobj));
|
||||
JS_ASSERT(funobj->isFunction());
|
||||
JSFunction *fun = (JSFunction *) funobj->getPrivate();
|
||||
return funobj == fun && (fun->flags & JSFUN_LAMBDA) && !funobj->getParent();
|
||||
}
|
||||
|
@ -2550,7 +2550,7 @@ FinalizeObject(JSContext *cx, JSObject *obj, unsigned thingKind)
|
||||
jsdtrace_object_finalize(obj);
|
||||
#endif
|
||||
|
||||
if (JS_LIKELY(OBJ_IS_NATIVE(obj))) {
|
||||
if (JS_LIKELY(obj->isNative())) {
|
||||
JSScope *scope = OBJ_SCOPE(obj);
|
||||
if (scope->isSharedEmpty())
|
||||
static_cast<JSEmptyScope *>(scope)->dropFromGC(cx);
|
||||
|
@ -1313,7 +1313,7 @@ js_LockObj(JSContext *cx, JSObject *obj)
|
||||
JSScope *scope;
|
||||
JSTitle *title;
|
||||
|
||||
JS_ASSERT(OBJ_IS_NATIVE(obj));
|
||||
JS_ASSERT(obj->isNative());
|
||||
|
||||
/*
|
||||
* We must test whether the GC is calling and return without mutating any
|
||||
@ -1345,7 +1345,7 @@ js_LockObj(JSContext *cx, JSObject *obj)
|
||||
void
|
||||
js_UnlockObj(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
JS_ASSERT(OBJ_IS_NATIVE(obj));
|
||||
JS_ASSERT(obj->isNative());
|
||||
js_UnlockTitle(cx, &OBJ_SCOPE(obj)->title);
|
||||
}
|
||||
|
||||
|
@ -149,8 +149,8 @@ struct JSTitle {
|
||||
|
||||
/*
|
||||
* NB: The JS_LOCK_OBJ and JS_UNLOCK_OBJ macros work *only* on native objects
|
||||
* (objects for which OBJ_IS_NATIVE returns true). All uses of these macros in
|
||||
* the engine are predicated on OBJ_IS_NATIVE or equivalent checks. These uses
|
||||
* (objects for which obj->isNative() returns true). All uses of these macros in
|
||||
* the engine are predicated on obj->isNative or equivalent checks. These uses
|
||||
* are for optimizations above the JSObjectOps layer, under which object locks
|
||||
* normally hide.
|
||||
*/
|
||||
|
@ -251,7 +251,7 @@ js_SetProtoOrParent(JSContext *cx, JSObject *obj, uint32 slot, JSObject *pobj,
|
||||
JS_ASSERT_IF(!checkForCycles, obj != pobj);
|
||||
|
||||
if (slot == JSSLOT_PROTO) {
|
||||
if (OBJ_IS_NATIVE(obj)) {
|
||||
if (obj->isNative()) {
|
||||
JS_LOCK_OBJ(cx, obj);
|
||||
bool ok = !!js_GetMutableScope(cx, obj);
|
||||
JS_UNLOCK_OBJ(cx, obj);
|
||||
@ -265,7 +265,7 @@ js_SetProtoOrParent(JSContext *cx, JSObject *obj, uint32 slot, JSObject *pobj,
|
||||
* case any entries were filled by looking up through obj.
|
||||
*/
|
||||
JSObject *oldproto = obj;
|
||||
while (oldproto && OBJ_IS_NATIVE(oldproto)) {
|
||||
while (oldproto && oldproto->isNative()) {
|
||||
JS_LOCK_OBJ(cx, oldproto);
|
||||
JSScope *scope = OBJ_SCOPE(oldproto);
|
||||
scope->protoShapeChange(cx);
|
||||
@ -375,7 +375,7 @@ MarkSharpObjects(JSContext *cx, JSObject *obj, JSIdArray **idap)
|
||||
continue;
|
||||
ok = obj2->getAttributes(cx, id, prop, &attrs);
|
||||
if (ok) {
|
||||
if (OBJ_IS_NATIVE(obj2) &&
|
||||
if (obj2->isNative() &&
|
||||
(attrs & (JSPROP_GETTER | JSPROP_SETTER))) {
|
||||
JSScopeProperty *sprop = (JSScopeProperty *) prop;
|
||||
val = JSVAL_VOID;
|
||||
@ -738,7 +738,7 @@ obj_toSource(JSContext *cx, uintN argc, jsval *vp)
|
||||
obj2->dropProperty(cx, prop);
|
||||
goto error;
|
||||
}
|
||||
if (OBJ_IS_NATIVE(obj2) &&
|
||||
if (obj2->isNative() &&
|
||||
(attrs & (JSPROP_GETTER | JSPROP_SETTER))) {
|
||||
JSScopeProperty *sprop = (JSScopeProperty *) prop;
|
||||
if (attrs & JSPROP_GETTER) {
|
||||
@ -1663,7 +1663,7 @@ js_HasOwnProperty(JSContext *cx, JSLookupPropOp lookup, JSObject *obj, jsid id,
|
||||
}
|
||||
|
||||
if (outer != *objp) {
|
||||
if (OBJ_IS_NATIVE(*objp) && obj->getClass() == clasp) {
|
||||
if ((*objp)->isNative() && obj->getClass() == clasp) {
|
||||
/*
|
||||
* The combination of JSPROP_SHARED and JSPROP_PERMANENT in a
|
||||
* delegated property makes that property appear to be direct in
|
||||
@ -1783,7 +1783,7 @@ js_PropertyIsEnumerable(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
|
||||
* to distinguish a shared permanent proto-property from a local one.
|
||||
*/
|
||||
if (pobj != obj &&
|
||||
!(OBJ_IS_NATIVE(pobj) &&
|
||||
!(pobj->isNative() &&
|
||||
((JSScopeProperty *)prop)->isSharedPermanent())) {
|
||||
pobj->dropProperty(cx, prop);
|
||||
*vp = JSVAL_FALSE;
|
||||
@ -1879,7 +1879,7 @@ obj_lookupGetter(JSContext *cx, uintN argc, jsval *vp)
|
||||
return JS_FALSE;
|
||||
*vp = JSVAL_VOID;
|
||||
if (prop) {
|
||||
if (OBJ_IS_NATIVE(pobj)) {
|
||||
if (pobj->isNative()) {
|
||||
sprop = (JSScopeProperty *) prop;
|
||||
if (sprop->hasGetterValue())
|
||||
*vp = sprop->getterValue();
|
||||
@ -1904,7 +1904,7 @@ obj_lookupSetter(JSContext *cx, uintN argc, jsval *vp)
|
||||
return JS_FALSE;
|
||||
*vp = JSVAL_VOID;
|
||||
if (prop) {
|
||||
if (OBJ_IS_NATIVE(pobj)) {
|
||||
if (pobj->isNative()) {
|
||||
sprop = (JSScopeProperty *) prop;
|
||||
if (sprop->hasSetterValue())
|
||||
*vp = sprop->setterValue();
|
||||
@ -1962,7 +1962,7 @@ js_GetOwnPropertyDescriptor(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
|
||||
jsval roots[] = { JSVAL_VOID, JSVAL_VOID };
|
||||
AutoArrayRooter tvr(cx, JS_ARRAY_LENGTH(roots), roots);
|
||||
if (attrs & (JSPROP_GETTER | JSPROP_SETTER)) {
|
||||
if (OBJ_IS_NATIVE(obj)) {
|
||||
if (obj->isNative()) {
|
||||
JSScopeProperty *sprop = reinterpret_cast<JSScopeProperty *>(prop);
|
||||
if (attrs & JSPROP_GETTER)
|
||||
roots[0] = sprop->getterValue();
|
||||
@ -2558,7 +2558,7 @@ DefineProperty(JSContext *cx, JSObject *obj, const PropertyDescriptor &desc, boo
|
||||
if (obj->isArray())
|
||||
return DefinePropertyArray(cx, obj, desc, throwError, rval);
|
||||
|
||||
if (!OBJ_IS_NATIVE(obj))
|
||||
if (!obj->isNative())
|
||||
return Reject(cx, JSMSG_OBJECT_NOT_EXTENSIBLE, throwError, rval);
|
||||
|
||||
return DefinePropertyObject(cx, obj, desc, throwError, rval);
|
||||
@ -2788,7 +2788,7 @@ InitScopeForObject(JSContext* cx, JSObject* obj, JSObject* proto, JSObjectOps* o
|
||||
JSClass *clasp = OBJ_GET_CLASS(cx, obj);
|
||||
JSScope *scope = NULL;
|
||||
|
||||
if (proto && OBJ_IS_NATIVE(proto)) {
|
||||
if (proto && proto->isNative()) {
|
||||
JS_LOCK_OBJ(cx, proto);
|
||||
scope = OBJ_SCOPE(proto);
|
||||
if (scope->canProvideEmptyScope(ops, clasp)) {
|
||||
@ -3028,7 +3028,7 @@ NewNativeObject(JSContext* cx, JSClass* clasp, JSObject* proto,
|
||||
JSObject* FASTCALL
|
||||
js_NewInstance(JSContext *cx, JSClass *clasp, JSObject *ctor)
|
||||
{
|
||||
JS_ASSERT(HAS_FUNCTION_CLASS(ctor));
|
||||
JS_ASSERT(ctor->isFunction());
|
||||
|
||||
JSAtom *atom = cx->runtime->atomState.classPrototypeAtom;
|
||||
|
||||
@ -3902,7 +3902,7 @@ js_ShrinkSlots(JSContext *cx, JSObject *obj, size_t nslots)
|
||||
bool
|
||||
js_EnsureReservedSlots(JSContext *cx, JSObject *obj, size_t nreserved)
|
||||
{
|
||||
JS_ASSERT(OBJ_IS_NATIVE(obj));
|
||||
JS_ASSERT(obj->isNative());
|
||||
JS_ASSERT(!obj->dslots);
|
||||
|
||||
uintN nslots = JSSLOT_FREE(obj->getClass()) + nreserved;
|
||||
@ -4062,14 +4062,14 @@ js_FindClassObject(JSContext *cx, JSObject *start, JSProtoKey protoKey,
|
||||
id = ATOM_TO_JSID(atom);
|
||||
}
|
||||
|
||||
JS_ASSERT(OBJ_IS_NATIVE(obj));
|
||||
JS_ASSERT(obj->isNative());
|
||||
if (js_LookupPropertyWithFlags(cx, obj, id, JSRESOLVE_CLASSNAME,
|
||||
&pobj, &prop) < 0) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
v = JSVAL_VOID;
|
||||
if (prop) {
|
||||
if (OBJ_IS_NATIVE(pobj)) {
|
||||
if (pobj->isNative()) {
|
||||
sprop = (JSScopeProperty *) prop;
|
||||
if (SPROP_HAS_VALID_SLOT(sprop, OBJ_SCOPE(pobj))) {
|
||||
v = LOCKED_OBJ_GET_SLOT(pobj, sprop->slot);
|
||||
@ -4258,7 +4258,7 @@ PurgeProtoChain(JSContext *cx, JSObject *obj, jsid id)
|
||||
JSScopeProperty *sprop;
|
||||
|
||||
while (obj) {
|
||||
if (!OBJ_IS_NATIVE(obj)) {
|
||||
if (!obj->isNative()) {
|
||||
obj = obj->getProto();
|
||||
continue;
|
||||
}
|
||||
@ -4619,7 +4619,7 @@ js_LookupPropertyWithFlags(JSContext *cx, JSObject *obj, jsid id, uintN flags,
|
||||
/* Resolved: juggle locks and lookup id again. */
|
||||
if (obj2 != obj) {
|
||||
JS_UNLOCK_OBJ(cx, obj);
|
||||
if (OBJ_IS_NATIVE(obj2))
|
||||
if (obj2->isNative())
|
||||
JS_LOCK_OBJ(cx, obj2);
|
||||
}
|
||||
protoIndex = 0;
|
||||
@ -4627,7 +4627,7 @@ js_LookupPropertyWithFlags(JSContext *cx, JSObject *obj, jsid id, uintN flags,
|
||||
proto = proto->getProto()) {
|
||||
protoIndex++;
|
||||
}
|
||||
if (!OBJ_IS_NATIVE(obj2)) {
|
||||
if (!obj2->isNative()) {
|
||||
/* Whoops, newresolve handed back a foreign obj2. */
|
||||
JS_ASSERT(obj2 != obj);
|
||||
ok = obj2->lookupProperty(cx, id, objp, propp);
|
||||
@ -4652,7 +4652,7 @@ js_LookupPropertyWithFlags(JSContext *cx, JSObject *obj, jsid id, uintN flags,
|
||||
JS_ASSERT(!scope->isSharedEmpty());
|
||||
obj = obj2;
|
||||
} else if (obj2 != obj) {
|
||||
if (OBJ_IS_NATIVE(obj2))
|
||||
if (obj2->isNative())
|
||||
JS_UNLOCK_OBJ(cx, obj2);
|
||||
JS_LOCK_OBJ(cx, obj);
|
||||
}
|
||||
@ -4667,7 +4667,7 @@ js_LookupPropertyWithFlags(JSContext *cx, JSObject *obj, jsid id, uintN flags,
|
||||
if (!ok)
|
||||
goto cleanup;
|
||||
JS_LOCK_OBJ(cx, obj);
|
||||
JS_ASSERT(OBJ_IS_NATIVE(obj));
|
||||
JS_ASSERT(obj->isNative());
|
||||
scope = OBJ_SCOPE(obj);
|
||||
if (!scope->isSharedEmpty())
|
||||
sprop = scope->lookup(id);
|
||||
@ -4695,7 +4695,7 @@ js_LookupPropertyWithFlags(JSContext *cx, JSObject *obj, jsid id, uintN flags,
|
||||
JS_UNLOCK_OBJ(cx, obj);
|
||||
if (!proto)
|
||||
break;
|
||||
if (!OBJ_IS_NATIVE(proto)) {
|
||||
if (!proto->isNative()) {
|
||||
if (!proto->lookupProperty(cx, id, objp, propp))
|
||||
return -1;
|
||||
return protoIndex + 1;
|
||||
@ -4753,7 +4753,7 @@ js_FindPropertyHelper(JSContext *cx, jsid id, JSBool cacheResult,
|
||||
#ifdef DEBUG
|
||||
if (parent) {
|
||||
JSClass *clasp = OBJ_GET_CLASS(cx, obj);
|
||||
JS_ASSERT(OBJ_IS_NATIVE(pobj));
|
||||
JS_ASSERT(pobj->isNative());
|
||||
JS_ASSERT(OBJ_GET_CLASS(cx, pobj) == clasp);
|
||||
if (clasp == &js_BlockClass) {
|
||||
/*
|
||||
@ -4847,7 +4847,7 @@ js_FindIdentifierBase(JSContext *cx, JSObject *scopeChain, jsid id)
|
||||
if (protoIndex < 0)
|
||||
return NULL;
|
||||
if (prop) {
|
||||
JS_ASSERT(OBJ_IS_NATIVE(pobj));
|
||||
JS_ASSERT(pobj->isNative());
|
||||
JS_ASSERT(OBJ_GET_CLASS(cx, pobj) == OBJ_GET_CLASS(cx, obj));
|
||||
#ifdef DEBUG
|
||||
PropertyCacheEntry *entry =
|
||||
@ -4899,7 +4899,7 @@ js_NativeGet(JSContext *cx, JSObject *obj, JSObject *pobj,
|
||||
uint32 slot;
|
||||
int32 sample;
|
||||
|
||||
JS_ASSERT(OBJ_IS_NATIVE(pobj));
|
||||
JS_ASSERT(pobj->isNative());
|
||||
JS_ASSERT(JS_IS_OBJ_LOCKED(cx, pobj));
|
||||
scope = OBJ_SCOPE(pobj);
|
||||
|
||||
@ -4949,7 +4949,7 @@ js_NativeSet(JSContext *cx, JSObject *obj, JSScopeProperty *sprop, bool added,
|
||||
uint32 slot;
|
||||
int32 sample;
|
||||
|
||||
JS_ASSERT(OBJ_IS_NATIVE(obj));
|
||||
JS_ASSERT(obj->isNative());
|
||||
JS_ASSERT(JS_IS_OBJ_LOCKED(cx, obj));
|
||||
scope = OBJ_SCOPE(obj);
|
||||
|
||||
@ -5080,7 +5080,7 @@ js_GetPropertyHelper(JSContext *cx, JSObject *obj, jsid id, uintN getHow,
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
if (!OBJ_IS_NATIVE(obj2)) {
|
||||
if (!obj2->isNative()) {
|
||||
obj2->dropProperty(cx, prop);
|
||||
return obj2->getProperty(cx, id, vp);
|
||||
}
|
||||
@ -5194,7 +5194,7 @@ js_SetPropertyHelper(JSContext *cx, JSObject *obj, jsid id, uintN defineHow,
|
||||
if (protoIndex < 0)
|
||||
return JS_FALSE;
|
||||
if (prop) {
|
||||
if (!OBJ_IS_NATIVE(pobj)) {
|
||||
if (!pobj->isNative()) {
|
||||
pobj->dropProperty(cx, prop);
|
||||
prop = NULL;
|
||||
}
|
||||
@ -5416,7 +5416,7 @@ js_GetAttributes(JSContext *cx, JSObject *obj, jsid id, JSProperty *prop,
|
||||
*attrsp = 0;
|
||||
return JS_TRUE;
|
||||
}
|
||||
if (!OBJ_IS_NATIVE(obj)) {
|
||||
if (!obj->isNative()) {
|
||||
ok = obj->getAttributes(cx, id, prop, attrsp);
|
||||
obj->dropProperty(cx, prop);
|
||||
return ok;
|
||||
@ -5442,7 +5442,7 @@ js_SetAttributes(JSContext *cx, JSObject *obj, jsid id, JSProperty *prop,
|
||||
return JS_FALSE;
|
||||
if (!prop)
|
||||
return JS_TRUE;
|
||||
if (!OBJ_IS_NATIVE(obj)) {
|
||||
if (!obj->isNative()) {
|
||||
ok = obj->setAttributes(cx, id, prop, attrsp);
|
||||
obj->dropProperty(cx, prop);
|
||||
return ok;
|
||||
@ -5480,7 +5480,7 @@ js_DeleteProperty(JSContext *cx, JSObject *obj, jsid id, jsval *rval)
|
||||
* each delegating object.
|
||||
*/
|
||||
if (prop) {
|
||||
if (OBJ_IS_NATIVE(proto)) {
|
||||
if (proto->isNative()) {
|
||||
sprop = (JSScopeProperty *)prop;
|
||||
if (sprop->isSharedPermanent())
|
||||
*rval = JSVAL_FALSE;
|
||||
@ -5920,7 +5920,7 @@ js_CheckAccess(JSContext *cx, JSObject *obj, jsid id, JSAccessMode mode,
|
||||
break;
|
||||
}
|
||||
|
||||
if (!OBJ_IS_NATIVE(pobj)) {
|
||||
if (!pobj->isNative()) {
|
||||
pobj->dropProperty(cx, prop);
|
||||
|
||||
/* Avoid diverging for non-natives that reuse js_CheckAccess. */
|
||||
@ -6516,7 +6516,7 @@ js_PrintObjectSlotName(JSTracer *trc, char *buf, size_t bufsize)
|
||||
JS_ASSERT(slot >= JSSLOT_START(obj->getClass()));
|
||||
|
||||
JSScopeProperty *sprop;
|
||||
if (OBJ_IS_NATIVE(obj)) {
|
||||
if (obj->isNative()) {
|
||||
JSScope *scope = OBJ_SCOPE(obj);
|
||||
sprop = scope->lastProperty();
|
||||
while (sprop && sprop->slot != slot)
|
||||
@ -6556,7 +6556,7 @@ js_PrintObjectSlotName(JSTracer *trc, char *buf, size_t bufsize)
|
||||
void
|
||||
js_TraceObject(JSTracer *trc, JSObject *obj)
|
||||
{
|
||||
JS_ASSERT(OBJ_IS_NATIVE(obj));
|
||||
JS_ASSERT(obj->isNative());
|
||||
|
||||
JSContext *cx = trc->context;
|
||||
JSScope *scope = OBJ_SCOPE(obj);
|
||||
@ -6663,7 +6663,7 @@ ReservedSlotIndexOK(JSContext *cx, JSObject *obj, JSClass *clasp,
|
||||
bool
|
||||
js_GetReservedSlot(JSContext *cx, JSObject *obj, uint32 index, jsval *vp)
|
||||
{
|
||||
if (!OBJ_IS_NATIVE(obj)) {
|
||||
if (!obj->isNative()) {
|
||||
*vp = JSVAL_VOID;
|
||||
return true;
|
||||
}
|
||||
@ -6684,7 +6684,7 @@ js_GetReservedSlot(JSContext *cx, JSObject *obj, uint32 index, jsval *vp)
|
||||
bool
|
||||
js_SetReservedSlot(JSContext *cx, JSObject *obj, uint32 index, jsval v)
|
||||
{
|
||||
if (!OBJ_IS_NATIVE(obj))
|
||||
if (!obj->isNative())
|
||||
return true;
|
||||
|
||||
JSClass *clasp = OBJ_GET_CLASS(cx, obj);
|
||||
@ -6852,7 +6852,7 @@ dumpValue(jsval val)
|
||||
} else if (JSVAL_IS_VOID(val)) {
|
||||
fprintf(stderr, "undefined");
|
||||
} else if (JSVAL_IS_OBJECT(val) &&
|
||||
HAS_FUNCTION_CLASS(JSVAL_TO_OBJECT(val))) {
|
||||
JSVAL_TO_OBJECT(val)->isFunction()) {
|
||||
JSObject *funobj = JSVAL_TO_OBJECT(val);
|
||||
JSFunction *fun = GET_FUNCTION_PRIVATE(cx, funobj);
|
||||
fprintf(stderr, "<%s %s at %p (JSFunction at %p)>",
|
||||
@ -6949,7 +6949,7 @@ js_DumpObject(JSObject *obj)
|
||||
return;
|
||||
}
|
||||
|
||||
if (OBJ_IS_NATIVE(obj)) {
|
||||
if (obj->isNative()) {
|
||||
JSScope *scope = OBJ_SCOPE(obj);
|
||||
if (scope->sealed())
|
||||
fprintf(stderr, "sealed\n");
|
||||
@ -6960,7 +6960,7 @@ js_DumpObject(JSObject *obj)
|
||||
dumpScopeProp(sprop);
|
||||
}
|
||||
} else {
|
||||
if (!OBJ_IS_NATIVE(obj))
|
||||
if (!obj->isNative())
|
||||
fprintf(stderr, "not native\n");
|
||||
}
|
||||
|
||||
@ -6980,7 +6980,7 @@ js_DumpObject(JSObject *obj)
|
||||
|
||||
fprintf(stderr, "slots:\n");
|
||||
reservedEnd = i + JSCLASS_RESERVED_SLOTS(clasp);
|
||||
slots = (OBJ_IS_NATIVE(obj) && !OBJ_SCOPE(obj)->isSharedEmpty())
|
||||
slots = (obj->isNative() && !OBJ_SCOPE(obj)->isSharedEmpty())
|
||||
? OBJ_SCOPE(obj)->freeslot
|
||||
: obj->numSlots();
|
||||
for (; i < slots; i++) {
|
||||
|
@ -312,13 +312,13 @@ struct JSObject {
|
||||
}
|
||||
|
||||
/*
|
||||
* These ones are for multi-threaded objects. Use getSlot(),
|
||||
* These ones are for multi-threaded ("MT") objects. Use getSlot(),
|
||||
* getSlotRef(), setSlot() to directly manipulate slots in obj when only
|
||||
* one thread can access obj, or when accessing read-only slots within
|
||||
* JS_INITIAL_NSLOTS.
|
||||
*/
|
||||
jsval lockAndGetSlot(JSContext *cx, uintN slot);
|
||||
void lockAndSetSlot(JSContext *cx, uintN slot, jsval value);
|
||||
inline jsval getSlotMT(JSContext *cx, uintN slot);
|
||||
inline void setSlotMT(JSContext *cx, uintN slot, jsval value);
|
||||
|
||||
JSObject *getProto() const {
|
||||
return JSVAL_TO_OBJECT(fslots[JSSLOT_PROTO]);
|
||||
@ -484,9 +484,6 @@ struct JSObject {
|
||||
inline bool unbrand(JSContext *cx);
|
||||
};
|
||||
|
||||
/* Compatibility macro. */
|
||||
#define OBJ_IS_NATIVE(obj) ((obj)->isNative())
|
||||
|
||||
#define JSSLOT_START(clasp) (((clasp)->flags & JSCLASS_HAS_PRIVATE) \
|
||||
? JSSLOT_PRIVATE + 1 \
|
||||
: JSSLOT_PRIVATE)
|
||||
|
@ -45,10 +45,10 @@
|
||||
#include "jsscope.h"
|
||||
|
||||
inline jsval
|
||||
JSObject::lockAndGetSlot(JSContext *cx, uintN slot) {
|
||||
JSObject::getSlotMT(JSContext *cx, uintN slot) {
|
||||
#ifdef JS_THREADSAFE
|
||||
/*
|
||||
* If thread-safe, define a lockAndGetSlot() that bypasses, for a native
|
||||
* If thread-safe, define a getSlotMT() that bypasses, for a native
|
||||
* object, the lock-free "fast path" test of
|
||||
* (OBJ_SCOPE(obj)->ownercx == cx), to avoid needlessly switching from
|
||||
* lock-free to lock-full scope when doing GC on a different context
|
||||
@ -66,7 +66,7 @@ JSObject::lockAndGetSlot(JSContext *cx, uintN slot) {
|
||||
}
|
||||
|
||||
inline void
|
||||
JSObject::lockAndSetSlot(JSContext *cx, uintN slot, jsval value) {
|
||||
JSObject::setSlotMT(JSContext *cx, uintN slot, jsval value) {
|
||||
#ifdef JS_THREADSAFE
|
||||
/* Thread-safe way to set a slot. */
|
||||
OBJ_CHECK_SLOT(this, slot);
|
||||
@ -102,7 +102,7 @@ JSObject::freeSlotsArray(JSContext *cx)
|
||||
inline bool
|
||||
JSObject::unbrand(JSContext *cx)
|
||||
{
|
||||
if (OBJ_IS_NATIVE(this)) {
|
||||
if (this->isNative()) {
|
||||
JS_LOCK_OBJ(cx, this);
|
||||
JSScope *scope = OBJ_SCOPE(this);
|
||||
if (scope->isSharedEmpty()) {
|
||||
|
@ -1400,7 +1400,7 @@ BEGIN_CASE(JSOP_GVARINC)
|
||||
}
|
||||
slot = JSVAL_TO_INT(lval);
|
||||
JS_ASSERT(fp->varobj(cx) == cx->activeCallStack()->getInitialVarObj());
|
||||
rval = cx->activeCallStack()->getInitialVarObj()->lockAndGetSlot(cx, slot);
|
||||
rval = cx->activeCallStack()->getInitialVarObj()->getSlotMT(cx, slot);
|
||||
if (JS_LIKELY(CAN_DO_FAST_INC_DEC(rval))) {
|
||||
PUSH_OPND(rval + incr2);
|
||||
rval += incr;
|
||||
@ -1412,7 +1412,7 @@ BEGIN_CASE(JSOP_GVARINC)
|
||||
rval = regs.sp[-1];
|
||||
--regs.sp;
|
||||
}
|
||||
fp->varobj(cx)->lockAndSetSlot(cx, slot, rval);
|
||||
fp->varobj(cx)->setSlotMT(cx, slot, rval);
|
||||
len = JSOP_INCGVAR_LENGTH; /* all gvar incops are same length */
|
||||
JS_ASSERT(len == js_CodeSpec[op].length);
|
||||
DO_NEXT_OP(len);
|
||||
@ -1714,7 +1714,7 @@ BEGIN_CASE(JSOP_SETMETHOD)
|
||||
if (!sprop->hasSlot()) {
|
||||
if (entry->vcapTag() == 0 ||
|
||||
((obj2 = obj->getProto()) &&
|
||||
OBJ_IS_NATIVE(obj2) &&
|
||||
obj2->isNative() &&
|
||||
OBJ_SHAPE(obj2) == entry->vshape())) {
|
||||
goto fast_set_propcache_hit;
|
||||
}
|
||||
@ -2329,7 +2329,7 @@ BEGIN_CASE(JSOP_CALLNAME)
|
||||
}
|
||||
|
||||
/* Take the slow path if prop was not found in a native object. */
|
||||
if (!OBJ_IS_NATIVE(obj) || !OBJ_IS_NATIVE(obj2)) {
|
||||
if (!obj->isNative() || !obj2->isNative()) {
|
||||
obj2->dropProperty(cx, prop);
|
||||
if (!obj->getProperty(cx, id, &rval))
|
||||
goto error;
|
||||
@ -2748,7 +2748,7 @@ BEGIN_CASE(JSOP_CALLGVAR)
|
||||
JS_ASSERT(fp->varobj(cx) == cx->activeCallStack()->getInitialVarObj());
|
||||
obj = cx->activeCallStack()->getInitialVarObj();
|
||||
slot = JSVAL_TO_INT(lval);
|
||||
rval = obj->lockAndGetSlot(cx, slot);
|
||||
rval = obj->getSlotMT(cx, slot);
|
||||
PUSH_OPND(rval);
|
||||
if (op == JSOP_CALLGVAR)
|
||||
PUSH_OPND(OBJECT_TO_JSVAL(obj));
|
||||
@ -2841,7 +2841,7 @@ BEGIN_CASE(JSOP_DEFVAR)
|
||||
if (!fp->fun &&
|
||||
index < GlobalVarCount(fp) &&
|
||||
obj2 == obj &&
|
||||
OBJ_IS_NATIVE(obj)) {
|
||||
obj->isNative()) {
|
||||
sprop = (JSScopeProperty *) prop;
|
||||
if (!sprop->configurable() &&
|
||||
SPROP_HAS_VALID_SLOT(sprop, OBJ_SCOPE(obj)) &&
|
||||
@ -3365,7 +3365,7 @@ BEGIN_CASE(JSOP_INITMETHOD)
|
||||
/* Load the object being initialized into lval/obj. */
|
||||
lval = FETCH_OPND(-2);
|
||||
obj = JSVAL_TO_OBJECT(lval);
|
||||
JS_ASSERT(OBJ_IS_NATIVE(obj));
|
||||
JS_ASSERT(obj->isNative());
|
||||
JS_ASSERT(!OBJ_GET_CLASS(cx, obj)->reserveSlots);
|
||||
JS_ASSERT(!(obj->getClass()->flags & JSCLASS_SHARE_ALL_PROPERTIES));
|
||||
|
||||
|
@ -223,7 +223,7 @@ JSFunctionBox *
|
||||
JSCompiler::newFunctionBox(JSObject *obj, JSParseNode *fn, JSTreeContext *tc)
|
||||
{
|
||||
JS_ASSERT(obj);
|
||||
JS_ASSERT(HAS_FUNCTION_CLASS(obj));
|
||||
JS_ASSERT(obj->isFunction());
|
||||
|
||||
/*
|
||||
* We use JSContext.tempPool to allocate parsed objects and place them on
|
||||
|
@ -108,7 +108,7 @@ PropertyCache::fill(JSContext *cx, JSObject *obj, uintN scopeIndex, uintN protoI
|
||||
* non-native ones on the prototype chain. The non-natives can
|
||||
* mutate in arbitrary way without changing any shapes.
|
||||
*/
|
||||
if (!tmp || !OBJ_IS_NATIVE(tmp)) {
|
||||
if (!tmp || !tmp->isNative()) {
|
||||
PCMETER(noprotos++);
|
||||
return JS_NO_PROP_CACHE_FILL;
|
||||
}
|
||||
@ -240,7 +240,7 @@ PropertyCache::fill(JSContext *cx, JSObject *obj, uintN scopeIndex, uintN protoI
|
||||
* __proto__ assignment we may not find one.
|
||||
*/
|
||||
JSObject *proto = obj->getProto();
|
||||
if (!proto || !OBJ_IS_NATIVE(proto))
|
||||
if (!proto || !proto->isNative())
|
||||
return JS_NO_PROP_CACHE_FILL;
|
||||
JSScope *protoscope = OBJ_SCOPE(proto);
|
||||
if (!protoscope->emptyScope ||
|
||||
@ -374,7 +374,7 @@ PropertyCache::fullTest(JSContext *cx, jsbytecode *pc, JSObject **objp, JSObject
|
||||
if (JOF_MODE(cs.format) == JOF_NAME) {
|
||||
while (vcap & (PCVCAP_SCOPEMASK << PCVCAP_PROTOBITS)) {
|
||||
tmp = pobj->getParent();
|
||||
if (!tmp || !OBJ_IS_NATIVE(tmp))
|
||||
if (!tmp || !tmp->isNative())
|
||||
break;
|
||||
pobj = tmp;
|
||||
vcap -= PCVCAP_PROTOSIZE;
|
||||
@ -385,7 +385,7 @@ PropertyCache::fullTest(JSContext *cx, jsbytecode *pc, JSObject **objp, JSObject
|
||||
|
||||
while (vcap & PCVCAP_PROTOMASK) {
|
||||
tmp = pobj->getProto();
|
||||
if (!tmp || !OBJ_IS_NATIVE(tmp))
|
||||
if (!tmp || !tmp->isNative())
|
||||
break;
|
||||
pobj = tmp;
|
||||
--vcap;
|
||||
|
@ -1142,7 +1142,7 @@ JSScope::clear(JSContext *cx)
|
||||
JSEmptyScope *emptyScope;
|
||||
uint32 newShape;
|
||||
if (proto &&
|
||||
OBJ_IS_NATIVE(proto) &&
|
||||
proto->isNative() &&
|
||||
(emptyScope = OBJ_SCOPE(proto)->emptyScope) &&
|
||||
emptyScope->clasp == clasp) {
|
||||
newShape = emptyScope->shape;
|
||||
|
@ -50,7 +50,7 @@ inline JSFunction *
|
||||
JSScript::getFunction(size_t index)
|
||||
{
|
||||
JSObject *funobj = getObject(index);
|
||||
JS_ASSERT(HAS_FUNCTION_CLASS(funobj));
|
||||
JS_ASSERT(funobj->isFunction());
|
||||
JS_ASSERT(funobj == (JSObject *) funobj->getPrivate());
|
||||
JSFunction *fun = (JSFunction *) funobj;
|
||||
JS_ASSERT(FUN_INTERPRETED(fun));
|
||||
|
@ -1037,7 +1037,7 @@ GetPromotedType(jsval v)
|
||||
if (JSVAL_IS_OBJECT(v)) {
|
||||
if (JSVAL_IS_NULL(v))
|
||||
return TT_NULL;
|
||||
if (HAS_FUNCTION_CLASS(JSVAL_TO_OBJECT(v)))
|
||||
if (JSVAL_TO_OBJECT(v)->isFunction())
|
||||
return TT_FUNCTION;
|
||||
return TT_OBJECT;
|
||||
}
|
||||
@ -1061,7 +1061,7 @@ getCoercedType(jsval v)
|
||||
if (JSVAL_IS_OBJECT(v)) {
|
||||
if (JSVAL_IS_NULL(v))
|
||||
return TT_NULL;
|
||||
if (HAS_FUNCTION_CLASS(JSVAL_TO_OBJECT(v)))
|
||||
if (JSVAL_TO_OBJECT(v)->isFunction())
|
||||
return TT_FUNCTION;
|
||||
return TT_OBJECT;
|
||||
}
|
||||
@ -2566,7 +2566,7 @@ ValueToNative(JSContext* cx, jsval v, TraceType type, double* slot)
|
||||
switch (type) {
|
||||
case TT_OBJECT:
|
||||
JS_ASSERT(tag == JSVAL_OBJECT);
|
||||
JS_ASSERT(!JSVAL_IS_NULL(v) && !HAS_FUNCTION_CLASS(JSVAL_TO_OBJECT(v)));
|
||||
JS_ASSERT(!JSVAL_IS_NULL(v) && !JSVAL_TO_OBJECT(v)->isFunction());
|
||||
*(JSObject**)slot = JSVAL_TO_OBJECT(v);
|
||||
debug_only_printf(LC_TMTracer,
|
||||
"object<%p:%s> ", (void*)JSVAL_TO_OBJECT(v),
|
||||
@ -2805,7 +2805,7 @@ NativeToValue(JSContext* cx, jsval& v, TraceType type, double* slot)
|
||||
break;
|
||||
|
||||
case TT_FUNCTION: {
|
||||
JS_ASSERT(HAS_FUNCTION_CLASS(*(JSObject**)slot));
|
||||
JS_ASSERT((*(JSObject**)slot)->isFunction());
|
||||
v = OBJECT_TO_JSVAL(*(JSObject**)slot);
|
||||
#ifdef DEBUG
|
||||
JSFunction* fun = GET_FUNCTION_PRIVATE(cx, JSVAL_TO_OBJECT(v));
|
||||
@ -3296,7 +3296,7 @@ FlushNativeStackFrame(JSContext* cx, unsigned callDepth, const TraceType* mp, do
|
||||
JSVAL_TO_OBJECT(fp->argsobj)->setPrivate(fp);
|
||||
|
||||
JS_ASSERT(JSVAL_IS_OBJECT(fp->argv[-1]));
|
||||
JS_ASSERT(HAS_FUNCTION_CLASS(fp->calleeObject()));
|
||||
JS_ASSERT(fp->calleeObject()->isFunction());
|
||||
JS_ASSERT(GET_FUNCTION_PRIVATE(cx, fp->callee()) == fp->fun);
|
||||
|
||||
if (FUN_INTERPRETED(fp->fun) &&
|
||||
@ -3844,7 +3844,7 @@ TraceRecorder::determineSlotType(jsval* vp)
|
||||
} else if (JSVAL_IS_OBJECT(*vp)) {
|
||||
if (JSVAL_IS_NULL(*vp))
|
||||
m = TT_NULL;
|
||||
else if (HAS_FUNCTION_CLASS(JSVAL_TO_OBJECT(*vp)))
|
||||
else if (JSVAL_TO_OBJECT(*vp)->isFunction())
|
||||
m = TT_FUNCTION;
|
||||
else
|
||||
m = TT_OBJECT;
|
||||
@ -5241,7 +5241,7 @@ TraceRecorder::hasMethod(JSObject* obj, jsid id, bool& found)
|
||||
if (!prop)
|
||||
return status;
|
||||
|
||||
if (!OBJ_IS_NATIVE(pobj)) {
|
||||
if (!pobj->isNative()) {
|
||||
// We can't rely on __iterator__ being present on trace just because
|
||||
// it's there now, if found in a non-native object.
|
||||
status = RECORD_STOP;
|
||||
@ -6077,7 +6077,7 @@ IsEntryTypeCompatible(jsval* vp, TraceType* m)
|
||||
switch (*m) {
|
||||
case TT_OBJECT:
|
||||
if (tag == JSVAL_OBJECT && !JSVAL_IS_NULL(*vp) &&
|
||||
!HAS_FUNCTION_CLASS(JSVAL_TO_OBJECT(*vp))) {
|
||||
!JSVAL_TO_OBJECT(*vp)->isFunction()) {
|
||||
return true;
|
||||
}
|
||||
debug_only_printf(LC_TMTracer, "object != tag%u ", tag);
|
||||
@ -6122,7 +6122,7 @@ IsEntryTypeCompatible(jsval* vp, TraceType* m)
|
||||
default:
|
||||
JS_ASSERT(*m == TT_FUNCTION);
|
||||
if (tag == JSVAL_OBJECT && !JSVAL_IS_NULL(*vp) &&
|
||||
HAS_FUNCTION_CLASS(JSVAL_TO_OBJECT(*vp))) {
|
||||
JSVAL_TO_OBJECT(*vp)->isFunction()) {
|
||||
return true;
|
||||
}
|
||||
debug_only_printf(LC_TMTracer, "fun != tag%u ", tag);
|
||||
@ -9161,7 +9161,7 @@ TraceRecorder::test_property_cache(JSObject* obj, LIns* obj_ins, JSObject*& obj2
|
||||
RETURN_ERROR_A("error in js_LookupPropertyWithFlags");
|
||||
|
||||
if (prop) {
|
||||
if (!OBJ_IS_NATIVE(obj2)) {
|
||||
if (!obj2->isNative()) {
|
||||
obj2->dropProperty(cx, prop);
|
||||
RETURN_STOP_A("property found on non-native object");
|
||||
}
|
||||
@ -9394,7 +9394,7 @@ TraceRecorder::unbox_jsval(jsval v, LIns* v_ins, VMSideExit* exit)
|
||||
INS_CONSTWORD(JSVAL_OBJECT)),
|
||||
exit);
|
||||
|
||||
guard(HAS_FUNCTION_CLASS(JSVAL_TO_OBJECT(v)),
|
||||
guard(JSVAL_TO_OBJECT(v)->isFunction(),
|
||||
lir->ins2(LIR_peq,
|
||||
lir->ins2(LIR_piand,
|
||||
lir->insLoad(LIR_ldp, v_ins, offsetof(JSObject, classword),
|
||||
@ -10364,7 +10364,7 @@ TraceRecorder::getClassPrototype(JSProtoKey key, LIns*& proto_ins)
|
||||
#ifdef DEBUG
|
||||
/* Double-check that a native proto has a matching emptyScope. */
|
||||
if (key != JSProto_Array) {
|
||||
JS_ASSERT(OBJ_IS_NATIVE(proto));
|
||||
JS_ASSERT(proto->isNative());
|
||||
JSEmptyScope *emptyScope = OBJ_SCOPE(proto)->emptyScope;
|
||||
JS_ASSERT(emptyScope);
|
||||
JS_ASSERT(JSCLASS_CACHED_PROTO_KEY(emptyScope->clasp) == key);
|
||||
@ -12163,7 +12163,7 @@ TraceRecorder::record_JSOP_CALLNAME()
|
||||
if (pcval.isNull() || !pcval.isObject())
|
||||
RETURN_STOP_A("callee is not an object");
|
||||
|
||||
JS_ASSERT(HAS_FUNCTION_CLASS(pcval.toObject()));
|
||||
JS_ASSERT(pcval.toObject()->isFunction());
|
||||
|
||||
stack(0, INS_CONSTOBJ(pcval.toObject()));
|
||||
stack(1, obj_ins);
|
||||
@ -12812,7 +12812,7 @@ TraceRecorder::prop(JSObject* obj, LIns* obj_ins, uint32 *slotp, LIns** v_insp,
|
||||
*/
|
||||
VMSideExit* exit = snapshot(BRANCH_EXIT);
|
||||
do {
|
||||
if (OBJ_IS_NATIVE(obj)) {
|
||||
if (obj->isNative()) {
|
||||
CHECK_STATUS_A(InjectStatus(guardShape(obj_ins, obj, OBJ_SHAPE(obj),
|
||||
"guard(shape)", exit)));
|
||||
} else if (!guardDenseArray(obj, obj_ins, exit)) {
|
||||
@ -14565,7 +14565,7 @@ TraceRecorder::record_JSOP_CALLPROP()
|
||||
if (pcval.isNull())
|
||||
RETURN_STOP_A("callprop of missing method");
|
||||
|
||||
JS_ASSERT(HAS_FUNCTION_CLASS(pcval.toObject()));
|
||||
JS_ASSERT(pcval.toObject()->isFunction());
|
||||
|
||||
if (JSVAL_IS_PRIMITIVE(l)) {
|
||||
JSFunction* fun = GET_FUNCTION_PRIVATE(cx, pcval.toObject());
|
||||
@ -15017,7 +15017,7 @@ TraceRecorder::record_JSOP_LENGTH()
|
||||
stobj_get_const_fslot(obj_ins, JSSLOT_PRIVATE),
|
||||
js::TypedArray::lengthOffset(), ACC_READONLY));
|
||||
} else {
|
||||
if (!OBJ_IS_NATIVE(obj))
|
||||
if (!obj->isNative())
|
||||
RETURN_STOP_A("can't trace length property access on non-array, non-native object");
|
||||
return getProp(obj, obj_ins);
|
||||
}
|
||||
|
@ -508,7 +508,7 @@ class TypedArrayTemplate
|
||||
return false;
|
||||
|
||||
if (prop) {
|
||||
if (OBJ_IS_NATIVE(obj2)) {
|
||||
if (obj2->isNative()) {
|
||||
sprop = (JSScopeProperty *) prop;
|
||||
if (!js_NativeGet(cx, obj, obj2, sprop, JSGET_METHOD_BARRIER, vp))
|
||||
return false;
|
||||
|
@ -5261,7 +5261,7 @@ out:
|
||||
return ok;
|
||||
}
|
||||
|
||||
/* Use NULL for objectMap so XML objects satisfy OBJ_IS_NATIVE tests. */
|
||||
/* Use NULL for objectMap so XML objects satisfy obj->isNative() tests. */
|
||||
JS_FRIEND_DATA(JSObjectOps) js_XMLObjectOps = {
|
||||
NULL,
|
||||
xml_lookupProperty, xml_defineProperty,
|
||||
@ -7285,7 +7285,7 @@ js_InitXMLClass(JSContext *cx, JSObject *obj)
|
||||
JS_ASSERT(prop);
|
||||
sprop = (JSScopeProperty *) prop;
|
||||
JS_ASSERT(SPROP_HAS_VALID_SLOT(sprop, OBJ_SCOPE(pobj)));
|
||||
cval = pobj->lockAndGetSlot(cx, sprop->slot);
|
||||
cval = pobj->getSlotMT(cx, sprop->slot);
|
||||
pobj->dropProperty(cx, prop);
|
||||
JS_ASSERT(VALUE_IS_FUNCTION(cx, cval));
|
||||
|
||||
|
@ -1821,7 +1821,7 @@ DisassembleValue(JSContext *cx, jsval v, bool lines, bool recursive)
|
||||
JSObjectArray *objects = script->objects();
|
||||
for (uintN i = 0; i != objects->length; ++i) {
|
||||
JSObject *obj = objects->vector[i];
|
||||
if (HAS_FUNCTION_CLASS(obj)) {
|
||||
if (obj->isFunction()) {
|
||||
putchar('\n');
|
||||
if (!DisassembleValue(cx, OBJECT_TO_JSVAL(obj),
|
||||
lines, recursive)) {
|
||||
@ -3107,7 +3107,7 @@ ShapeOf(JSContext *cx, uintN argc, jsval *vp)
|
||||
*vp = JSVAL_ZERO;
|
||||
return JS_TRUE;
|
||||
}
|
||||
if (!OBJ_IS_NATIVE(obj)) {
|
||||
if (!obj->isNative()) {
|
||||
*vp = INT_TO_JSVAL(-1);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
@ -426,7 +426,7 @@ static const int tab_width = 2;
|
||||
|
||||
static void PrintObjectBasics(JSObject* obj)
|
||||
{
|
||||
if(OBJ_IS_NATIVE(obj))
|
||||
if (obj->isNative())
|
||||
printf("%p 'native' <%s>",
|
||||
(void *)obj, obj->getClass()->name);
|
||||
else
|
||||
@ -450,7 +450,7 @@ static void PrintObject(JSObject* obj, int depth, ObjectPile* pile)
|
||||
return;
|
||||
}
|
||||
|
||||
if(!OBJ_IS_NATIVE(obj))
|
||||
if(!obj->isNative())
|
||||
return;
|
||||
|
||||
JSObject* parent = obj->getParent();
|
||||
|
Loading…
Reference in New Issue
Block a user