зеркало из https://github.com/mozilla/pjs.git
bug 513190 - avoiding jsint tagging of the private slot data. r=jorendorff
This commit is contained in:
Родитель
e97ed25095
Коммит
33dbce57f4
|
@ -189,24 +189,6 @@ GetPrincipalDomainOrigin(nsIPrincipal* aPrincipal,
|
|||
return GetOriginFromURI(uri, aOrigin);
|
||||
}
|
||||
|
||||
// Inline copy of JS_GetPrivate() for better inlining and optimization
|
||||
// possibilities. Also doesn't take a cx argument as it's not
|
||||
// needed. We access the private data only on objects whose private
|
||||
// data is not expected to change during the lifetime of the object,
|
||||
// so thus we won't worry about locking and holding on to slot values
|
||||
// etc while referencing private data.
|
||||
inline void *
|
||||
caps_GetJSPrivate(JSObject *obj)
|
||||
{
|
||||
jsval v;
|
||||
|
||||
JS_ASSERT(STOBJ_GET_CLASS(obj)->flags & JSCLASS_HAS_PRIVATE);
|
||||
v = obj->fslots[JSSLOT_PRIVATE];
|
||||
if (!JSVAL_IS_INT(v))
|
||||
return NULL;
|
||||
return JSVAL_TO_PRIVATE(v);
|
||||
}
|
||||
|
||||
static nsIScriptContext *
|
||||
GetScriptContext(JSContext *cx)
|
||||
{
|
||||
|
@ -1681,8 +1663,7 @@ nsScriptSecurityManager::CheckFunctionAccess(JSContext *aCx, void *aFunObj,
|
|||
{
|
||||
#ifdef DEBUG
|
||||
{
|
||||
JSFunction *fun =
|
||||
(JSFunction *)caps_GetJSPrivate((JSObject *)aFunObj);
|
||||
JSFunction *fun = GET_FUNCTION_PRIVATE(cx, (JSObject *)aFunObj);
|
||||
JSScript *script = JS_GetFunctionScript(aCx, fun);
|
||||
|
||||
NS_ASSERTION(!script, "Null principal for non-native function!");
|
||||
|
@ -2166,7 +2147,7 @@ nsScriptSecurityManager::GetFunctionObjectPrincipal(JSContext *cx,
|
|||
return result;
|
||||
}
|
||||
|
||||
JSFunction *fun = (JSFunction *) caps_GetJSPrivate(obj);
|
||||
JSFunction *fun = GET_FUNCTION_PRIVATE(cx, obj);
|
||||
JSScript *script = JS_GetFunctionScript(cx, fun);
|
||||
|
||||
*rv = NS_OK;
|
||||
|
@ -2235,7 +2216,7 @@ nsScriptSecurityManager::GetFramePrincipal(JSContext *cx,
|
|||
#ifdef DEBUG
|
||||
if (NS_SUCCEEDED(*rv) && !result)
|
||||
{
|
||||
JSFunction *fun = (JSFunction *)caps_GetJSPrivate(obj);
|
||||
JSFunction *fun = GET_FUNCTION_PRIVATE(cx, obj);
|
||||
JSScript *script = JS_GetFunctionScript(cx, fun);
|
||||
|
||||
NS_ASSERTION(!script, "Null principal for non-native function!");
|
||||
|
@ -2342,20 +2323,20 @@ nsScriptSecurityManager::doGetObjectPrincipal(JSObject *aObj
|
|||
// the loop.
|
||||
|
||||
if (jsClass == &js_FunctionClass) {
|
||||
aObj = STOBJ_GET_PARENT(aObj);
|
||||
aObj = aObj->getParent();
|
||||
|
||||
if (!aObj)
|
||||
return nsnull;
|
||||
|
||||
jsClass = STOBJ_GET_CLASS(aObj);
|
||||
jsClass = aObj->getClass();
|
||||
|
||||
if (jsClass == &js_CallClass) {
|
||||
aObj = STOBJ_GET_PARENT(aObj);
|
||||
aObj = aObj->getParent();
|
||||
|
||||
if (!aObj)
|
||||
return nsnull;
|
||||
|
||||
jsClass = STOBJ_GET_CLASS(aObj);
|
||||
jsClass = aObj->getClass();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2384,7 +2365,7 @@ nsScriptSecurityManager::doGetObjectPrincipal(JSObject *aObj
|
|||
}
|
||||
} else if (!(~jsClass->flags & (JSCLASS_HAS_PRIVATE |
|
||||
JSCLASS_PRIVATE_IS_NSISUPPORTS))) {
|
||||
nsISupports *priv = (nsISupports *)caps_GetJSPrivate(aObj);
|
||||
nsISupports *priv = (nsISupports *) aObj->getPrivate();
|
||||
|
||||
#ifdef DEBUG
|
||||
if (aAllowShortCircuit) {
|
||||
|
|
|
@ -191,17 +191,11 @@ public:
|
|||
|
||||
static void PreserveNodeWrapper(nsIXPConnectWrappedNative *aWrapper);
|
||||
|
||||
static inline void *GetJSPrivate(JSObject *obj)
|
||||
{
|
||||
JS_ASSERT(STOBJ_GET_CLASS(obj)->flags & JSCLASS_HAS_PRIVATE);
|
||||
jsval v = STOBJ_GET_SLOT(obj, JSSLOT_PRIVATE);
|
||||
return JSVAL_IS_INT(v) ? JSVAL_TO_PRIVATE(v) : nsnull;
|
||||
}
|
||||
static inline nsISupports *GetNative(nsIXPConnectWrappedNative *wrapper,
|
||||
JSObject *obj)
|
||||
{
|
||||
return wrapper ? wrapper->Native() :
|
||||
static_cast<nsISupports*>(GetJSPrivate(obj));
|
||||
static_cast<nsISupports*>(obj->getPrivate());
|
||||
}
|
||||
|
||||
static nsIXPConnect *XPConnect()
|
||||
|
|
|
@ -2776,9 +2776,8 @@ JS_GetPrivate(JSContext *cx, JSObject *obj)
|
|||
JS_PUBLIC_API(JSBool)
|
||||
JS_SetPrivate(JSContext *cx, JSObject *obj, void *data)
|
||||
{
|
||||
JS_ASSERT(OBJ_GET_CLASS(cx, obj)->flags & JSCLASS_HAS_PRIVATE);
|
||||
obj->fslots[JSSLOT_PRIVATE] = PRIVATE_TO_JSVAL(data);
|
||||
return JS_TRUE;
|
||||
obj->setPrivate(data);
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void *)
|
||||
|
@ -2787,7 +2786,7 @@ JS_GetInstancePrivate(JSContext *cx, JSObject *obj, JSClass *clasp,
|
|||
{
|
||||
if (!JS_InstanceOf(cx, obj, clasp, argv))
|
||||
return NULL;
|
||||
return JS_GetPrivate(cx, obj);
|
||||
return obj->getPrivate();
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSObject *)
|
||||
|
@ -4098,7 +4097,7 @@ JS_NextProperty(JSContext *cx, JSObject *iterobj, jsid *idp)
|
|||
obj = OBJ_GET_PARENT(cx, iterobj);
|
||||
JS_ASSERT(OBJ_IS_NATIVE(obj));
|
||||
scope = OBJ_SCOPE(obj);
|
||||
sprop = (JSScopeProperty *) iterobj->getAssignedPrivate();
|
||||
sprop = (JSScopeProperty *) iterobj->getPrivate();
|
||||
|
||||
/*
|
||||
* If the next property mapped by scope in the property tree ancestor
|
||||
|
@ -4122,7 +4121,7 @@ JS_NextProperty(JSContext *cx, JSObject *iterobj, jsid *idp)
|
|||
}
|
||||
} else {
|
||||
/* Non-native case: use the ida enumerated when iterobj was created. */
|
||||
ida = (JSIdArray *) iterobj->getAssignedPrivate();
|
||||
ida = (JSIdArray *) iterobj->getPrivate();
|
||||
JS_ASSERT(i <= ida->length);
|
||||
if (i == 0) {
|
||||
*idp = JSVAL_VOID;
|
||||
|
|
|
@ -139,7 +139,7 @@ Boolean(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
|||
if (!JS_IsConstructing(cx))
|
||||
*rval = bval;
|
||||
else
|
||||
obj->fslots[JSSLOT_PRIVATE] = bval;
|
||||
obj->fslots[JSSLOT_PRIMITIVE_THIS] = bval;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ js_InitBooleanClass(JSContext *cx, JSObject *obj)
|
|||
NULL, boolean_methods, NULL, NULL);
|
||||
if (!proto)
|
||||
return NULL;
|
||||
proto->fslots[JSSLOT_PRIVATE] = JSVAL_FALSE;
|
||||
proto->fslots[JSSLOT_PRIMITIVE_THIS] = JSVAL_FALSE;
|
||||
return proto;
|
||||
}
|
||||
|
||||
|
|
|
@ -400,13 +400,8 @@ js_NewNullClosure(JSContext* cx, JSObject* funobj, JSObject* proto, JSObject* pa
|
|||
}
|
||||
|
||||
closure->map = &scope->map;
|
||||
closure->classword = jsuword(&js_FunctionClass);
|
||||
closure->setProto(proto);
|
||||
closure->setParent(parent);
|
||||
closure->setPrivate(fun);
|
||||
for (unsigned i = JSSLOT_PRIVATE + 1; i != JS_INITIAL_NSLOTS; ++i)
|
||||
closure->fslots[i] = JSVAL_VOID;
|
||||
closure->dslots = NULL;
|
||||
closure->init(&js_FunctionClass, proto, parent,
|
||||
reinterpret_cast<jsval>(fun));
|
||||
return closure;
|
||||
}
|
||||
JS_DEFINE_CALLINFO_4(extern, OBJECT, js_NewNullClosure, CONTEXT, OBJECT, OBJECT, OBJECT, 0, 0)
|
||||
|
|
|
@ -843,7 +843,7 @@ date_parseISOString(JSString *str, jsdouble *result)
|
|||
done:
|
||||
if (year > 275943 // ceil(1e8/365) + 1970
|
||||
|| (month == 0 || month > 12)
|
||||
|| (day == 0 || day > DaysInMonth(year,month))
|
||||
|| (day == 0 || day > size_t(DaysInMonth(year,month)))
|
||||
|| hour > 24
|
||||
|| ((hour == 24) && (min > 0 || sec > 0))
|
||||
|| min > 59
|
||||
|
|
|
@ -595,7 +595,7 @@ js_watch_set(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
script = FUN_SCRIPT(fun);
|
||||
} else if (clasp == &js_ScriptClass) {
|
||||
fun = NULL;
|
||||
script = (JSScript *) closure->getAssignedPrivate();
|
||||
script = (JSScript *) closure->getPrivate();
|
||||
} else {
|
||||
fun = NULL;
|
||||
script = NULL;
|
||||
|
@ -1165,7 +1165,7 @@ JS_GetFrameFunctionObject(JSContext *cx, JSStackFrame *fp)
|
|||
return NULL;
|
||||
|
||||
JS_ASSERT(HAS_FUNCTION_CLASS(fp->callee()));
|
||||
JS_ASSERT(fp->callee()->getAssignedPrivate() == fp->fun);
|
||||
JS_ASSERT(fp->callee()->getPrivate() == fp->fun);
|
||||
return fp->callee();
|
||||
}
|
||||
|
||||
|
|
|
@ -369,7 +369,7 @@ WrapEscapingClosure(JSContext *cx, JSStackFrame *fp, JSObject *funobj, JSFunctio
|
|||
JSAutoTempValueRooter tvr(cx, wfunobj);
|
||||
|
||||
JSFunction *wfun = (JSFunction *) wfunobj;
|
||||
wfunobj->fslots[JSSLOT_PRIVATE] = PRIVATE_TO_JSVAL(wfun);
|
||||
wfunobj->setPrivate(wfun);
|
||||
wfun->nargs = 0;
|
||||
wfun->flags = fun->flags | JSFUN_HEAVYWEIGHT;
|
||||
wfun->u.i.nvars = 0;
|
||||
|
@ -788,7 +788,7 @@ js_GetCallObject(JSContext *cx, JSStackFrame *fp)
|
|||
/* A call object should be a frame's outermost scope chain element. */
|
||||
JSClass *classp = OBJ_GET_CLASS(cx, fp->scopeChain);
|
||||
if (classp == &js_WithClass || classp == &js_BlockClass || classp == &js_CallClass)
|
||||
JS_ASSERT(fp->scopeChain->getAssignedPrivate() != fp);
|
||||
JS_ASSERT(fp->scopeChain->getPrivate() != fp);
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -803,7 +803,7 @@ js_GetCallObject(JSContext *cx, JSStackFrame *fp)
|
|||
fp->scopeChain);
|
||||
if (!env)
|
||||
return NULL;
|
||||
env->fslots[JSSLOT_PRIVATE] = PRIVATE_TO_JSVAL(fp);
|
||||
env->setPrivate(fp);
|
||||
|
||||
/* Root env before js_DefineNativeProperty (-> JSClass.addProperty). */
|
||||
fp->scopeChain = env;
|
||||
|
@ -891,7 +891,7 @@ js_PutCallObject(JSContext *cx, JSStackFrame *fp)
|
|||
JSObject *env = STOBJ_GET_PARENT(callobj);
|
||||
|
||||
JS_ASSERT(STOBJ_GET_CLASS(env) == &js_DeclEnvClass);
|
||||
JS_ASSERT(env->getAssignedPrivate() == fp);
|
||||
JS_ASSERT(env->getPrivate() == fp);
|
||||
env->setPrivate(NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -218,7 +218,7 @@ extern JS_FRIEND_DATA(JSClass) js_FunctionClass;
|
|||
*/
|
||||
#define GET_FUNCTION_PRIVATE(cx, funobj) \
|
||||
(JS_ASSERT(HAS_FUNCTION_CLASS(funobj)), \
|
||||
(JSFunction *) (funobj)->getAssignedPrivate())
|
||||
(JSFunction *) (funobj)->getPrivate())
|
||||
|
||||
extern JSObject *
|
||||
js_InitFunctionClass(JSContext *cx, JSObject *obj);
|
||||
|
|
|
@ -740,7 +740,7 @@ js_GetScopeChain(JSContext *cx, JSStackFrame *fp)
|
|||
JSObject *limitBlock, *limitClone;
|
||||
if (fp->fun && !fp->callobj) {
|
||||
JS_ASSERT(OBJ_GET_CLASS(cx, fp->scopeChain) != &js_BlockClass ||
|
||||
fp->scopeChain->getAssignedPrivate() != fp);
|
||||
fp->scopeChain->getPrivate() != fp);
|
||||
if (!js_GetCallObject(cx, fp))
|
||||
return NULL;
|
||||
|
||||
|
@ -830,7 +830,7 @@ js_GetScopeChain(JSContext *cx, JSStackFrame *fp)
|
|||
*/
|
||||
JS_ASSERT_IF(limitBlock &&
|
||||
OBJ_GET_CLASS(cx, limitBlock) == &js_BlockClass &&
|
||||
limitClone->getAssignedPrivate() == fp,
|
||||
limitClone->getPrivate() == fp,
|
||||
sharedBlock);
|
||||
|
||||
/* Place our newly cloned blocks at the head of the scope chain. */
|
||||
|
@ -849,7 +849,7 @@ js_GetPrimitiveThis(JSContext *cx, jsval *vp, JSClass *clasp, jsval *thisvp)
|
|||
obj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!JS_InstanceOf(cx, obj, clasp, vp + 2))
|
||||
return JS_FALSE;
|
||||
v = obj->fslots[JSSLOT_PRIVATE];
|
||||
v = obj->fslots[JSSLOT_PRIMITIVE_THIS];
|
||||
}
|
||||
*thisvp = v;
|
||||
return JS_TRUE;
|
||||
|
@ -968,8 +968,8 @@ js_ComputeThis(JSContext *cx, JSBool lazy, jsval *argv)
|
|||
|
||||
#if JS_HAS_NO_SUCH_METHOD
|
||||
|
||||
#define JSSLOT_FOUND_FUNCTION JSSLOT_PRIVATE
|
||||
#define JSSLOT_SAVED_ID (JSSLOT_PRIVATE + 1)
|
||||
const uint32 JSSLOT_FOUND_FUNCTION = JSSLOT_PRIVATE;
|
||||
const uint32 JSSLOT_SAVED_ID = JSSLOT_PRIVATE + 1;
|
||||
|
||||
JSClass js_NoSuchMethodClass = {
|
||||
"NoSuchMethod",
|
||||
|
@ -1953,7 +1953,7 @@ js_LeaveWith(JSContext *cx)
|
|||
|
||||
withobj = cx->fp->scopeChain;
|
||||
JS_ASSERT(OBJ_GET_CLASS(cx, withobj) == &js_WithClass);
|
||||
JS_ASSERT(withobj->getAssignedPrivate() == cx->fp);
|
||||
JS_ASSERT(withobj->getPrivate() == cx->fp);
|
||||
JS_ASSERT(OBJ_BLOCK_DEPTH(cx, withobj) >= 0);
|
||||
cx->fp->scopeChain = OBJ_GET_PARENT(cx, withobj);
|
||||
withobj->setPrivate(NULL);
|
||||
|
@ -1966,7 +1966,7 @@ js_IsActiveWithOrBlock(JSContext *cx, JSObject *obj, int stackDepth)
|
|||
|
||||
clasp = OBJ_GET_CLASS(cx, obj);
|
||||
if ((clasp == &js_WithClass || clasp == &js_BlockClass) &&
|
||||
obj->getAssignedPrivate() == cx->fp &&
|
||||
obj->getPrivate() == cx->fp &&
|
||||
OBJ_BLOCK_DEPTH(cx, obj) >= stackDepth) {
|
||||
return clasp;
|
||||
}
|
||||
|
|
|
@ -60,8 +60,8 @@ JS_BEGIN_EXTERN_C
|
|||
/*
|
||||
* Native iterator object slots, shared between jsiter.cpp and jstracer.cpp.
|
||||
*/
|
||||
#define JSSLOT_ITER_STATE (JSSLOT_PRIVATE)
|
||||
#define JSSLOT_ITER_FLAGS (JSSLOT_PRIVATE + 1)
|
||||
const uint32 JSSLOT_ITER_STATE = JSSLOT_PRIVATE;
|
||||
const uint32 JSSLOT_ITER_FLAGS = JSSLOT_PRIVATE + 1;
|
||||
|
||||
/*
|
||||
* Convert the value stored in *vp to its iteration object. The flags should
|
||||
|
|
|
@ -463,19 +463,16 @@ ShareTitle(JSContext *cx, JSTitle *title)
|
|||
static void
|
||||
FinishSharingTitle(JSContext *cx, JSTitle *title)
|
||||
{
|
||||
JSScope *scope;
|
||||
JSObject *obj;
|
||||
uint32 nslots, i;
|
||||
jsval v;
|
||||
|
||||
js_InitLock(&title->lock);
|
||||
title->u.count = 0; /* NULL may not pun as 0 */
|
||||
scope = TITLE_TO_SCOPE(title);
|
||||
obj = scope->object;
|
||||
|
||||
JSScope *scope = TITLE_TO_SCOPE(title);
|
||||
JSObject *obj = scope->object;
|
||||
if (obj) {
|
||||
nslots = scope->freeslot;
|
||||
for (i = 0; i != nslots; ++i) {
|
||||
v = STOBJ_GET_SLOT(obj, i);
|
||||
uint32 nslots = scope->freeslot;
|
||||
JS_ASSERT(nslots >= JSSLOT_START(obj->getClass()));
|
||||
for (uint32 i = JSSLOT_START(obj->getClass()); i != nslots; ++i) {
|
||||
jsval v = STOBJ_GET_SLOT(obj, i);
|
||||
if (JSVAL_IS_STRING(v) &&
|
||||
!js_MakeStringImmutable(cx, JSVAL_TO_STRING(v))) {
|
||||
/*
|
||||
|
|
|
@ -271,7 +271,7 @@ Number(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
|||
if (!JS_IsConstructing(cx))
|
||||
*rval = v;
|
||||
else
|
||||
obj->fslots[JSSLOT_PRIVATE] = v;
|
||||
obj->fslots[JSSLOT_PRIMITIVE_THIS] = v;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -514,7 +514,7 @@ num_valueOf(JSContext *cx, uintN argc, jsval *vp)
|
|||
obj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!JS_InstanceOf(cx, obj, &js_NumberClass, vp + 2))
|
||||
return JS_FALSE;
|
||||
*vp = obj->fslots[JSSLOT_PRIVATE];
|
||||
*vp = obj->fslots[JSSLOT_PRIMITIVE_THIS];
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
@ -762,7 +762,7 @@ js_InitNumberClass(JSContext *cx, JSObject *obj)
|
|||
NULL, number_methods, NULL, NULL);
|
||||
if (!proto || !(ctor = JS_GetConstructor(cx, proto)))
|
||||
return NULL;
|
||||
proto->fslots[JSSLOT_PRIVATE] = JSVAL_ZERO;
|
||||
proto->fslots[JSSLOT_PRIMITIVE_THIS] = JSVAL_ZERO;
|
||||
if (!JS_DefineConstDoubles(cx, ctor, number_constants))
|
||||
return NULL;
|
||||
|
||||
|
|
105
js/src/jsobj.cpp
105
js/src/jsobj.cpp
|
@ -2080,28 +2080,14 @@ js_NewObjectWithGivenProto(JSContext *cx, JSClass *clasp, JSObject *proto,
|
|||
if (!obj)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* Set the class slot with the initial value of the system and delegate
|
||||
* flags set to false.
|
||||
*/
|
||||
JS_ASSERT(((jsuword) clasp & 3) == 0);
|
||||
obj->classword = jsuword(clasp);
|
||||
JS_ASSERT(!obj->isDelegate());
|
||||
JS_ASSERT(!obj->isSystem());
|
||||
|
||||
obj->setProto(proto);
|
||||
|
||||
/*
|
||||
* Default parent to the parent of the prototype, which was set from
|
||||
* the parent of the prototype's constructor.
|
||||
*/
|
||||
obj->setParent((!parent && proto) ? proto->getParent() : parent);
|
||||
|
||||
/* Initialize the remaining fixed slots. */
|
||||
for (uint32 i = JSSLOT_PRIVATE; i < JS_INITIAL_NSLOTS; ++i)
|
||||
obj->fslots[i] = JSVAL_VOID;
|
||||
|
||||
obj->dslots = NULL;
|
||||
obj->init(clasp,
|
||||
proto,
|
||||
(!parent && proto) ? proto->getParent() : parent,
|
||||
JSObject::defaultPrivate(clasp));
|
||||
|
||||
if (OPS_IS_NATIVE(ops)) {
|
||||
if (!InitScopeForObject(cx, obj, proto, ops)) {
|
||||
|
@ -2187,27 +2173,24 @@ js_Object(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
|||
#ifdef JS_TRACER
|
||||
|
||||
static inline JSObject*
|
||||
NewNativeObject(JSContext* cx, JSClass* clasp, JSObject* proto, JSObject *parent)
|
||||
NewNativeObject(JSContext* cx, JSClass* clasp, JSObject* proto,
|
||||
JSObject *parent, jsval privateSlotValue)
|
||||
{
|
||||
JS_ASSERT(JS_ON_TRACE(cx));
|
||||
JSObject* obj = js_NewGCObject(cx, GCX_OBJECT);
|
||||
if (!obj)
|
||||
return NULL;
|
||||
|
||||
obj->classword = jsuword(clasp);
|
||||
obj->setProto(proto);
|
||||
obj->setParent(parent);
|
||||
for (unsigned i = JSSLOT_PRIVATE; i < JS_INITIAL_NSLOTS; ++i)
|
||||
obj->fslots[i] = JSVAL_VOID;
|
||||
|
||||
obj->dslots = NULL;
|
||||
obj->init(clasp, proto, parent, privateSlotValue);
|
||||
return InitScopeForObject(cx, obj, proto, &js_ObjectOps) ? obj : NULL;
|
||||
}
|
||||
|
||||
JSObject* FASTCALL
|
||||
js_Object_tn(JSContext* cx, JSObject* proto)
|
||||
{
|
||||
return NewNativeObject(cx, &js_ObjectClass, proto, JSVAL_TO_OBJECT(proto->fslots[JSSLOT_PARENT]));
|
||||
JS_ASSERT(!(js_ObjectClass.flags & JSCLASS_HAS_PRIVATE));
|
||||
return NewNativeObject(cx, &js_ObjectClass, proto, proto->getParent(),
|
||||
JSVAL_VOID);
|
||||
}
|
||||
|
||||
JS_DEFINE_TRCINFO_1(js_Object,
|
||||
|
@ -2253,7 +2236,8 @@ js_NewInstance(JSContext *cx, JSClass *clasp, JSObject *ctor)
|
|||
}
|
||||
}
|
||||
|
||||
return NewNativeObject(cx, clasp, proto, JSVAL_TO_OBJECT(ctor->fslots[JSSLOT_PARENT]));
|
||||
return NewNativeObject(cx, clasp, proto, ctor->getParent(),
|
||||
JSObject::defaultPrivate(clasp));
|
||||
}
|
||||
|
||||
JS_DEFINE_CALLINFO_3(extern, CONSTRUCTOR_RETRY, js_NewInstance, CONTEXT, CLASS, OBJECT, 0, 0)
|
||||
|
@ -2566,7 +2550,7 @@ js_PutBlockObject(JSContext *cx, JSBool normalUnwind)
|
|||
fp = cx->fp;
|
||||
obj = fp->scopeChain;
|
||||
JS_ASSERT(OBJ_GET_CLASS(cx, obj) == &js_BlockClass);
|
||||
JS_ASSERT(obj->getAssignedPrivate() == cx->fp);
|
||||
JS_ASSERT(obj->getPrivate() == cx->fp);
|
||||
JS_ASSERT(OBJ_IS_CLONED_BLOCK(obj));
|
||||
|
||||
/*
|
||||
|
@ -3111,7 +3095,8 @@ js_GetClassId(JSContext *cx, JSClass *clasp, jsid *idp)
|
|||
}
|
||||
|
||||
JSObject*
|
||||
js_NewNativeObject(JSContext *cx, JSClass *clasp, JSObject *proto, uint32 slot)
|
||||
js_NewNativeObject(JSContext *cx, JSClass *clasp, JSObject *proto,
|
||||
jsval privateSlotValue)
|
||||
{
|
||||
JS_ASSERT(!clasp->getObjectOps);
|
||||
JS_ASSERT(proto->map->ops == &js_ObjectOps);
|
||||
|
@ -3127,15 +3112,7 @@ js_NewNativeObject(JSContext *cx, JSClass *clasp, JSObject *proto, uint32 slot)
|
|||
return NULL;
|
||||
}
|
||||
obj->map = &scope->map;
|
||||
obj->classword = jsuword(clasp);
|
||||
obj->setProto(proto);
|
||||
obj->setParent(proto->getParent());
|
||||
|
||||
JS_ASSERT(slot >= JSSLOT_PRIVATE);
|
||||
while (slot < JS_INITIAL_NSLOTS)
|
||||
obj->fslots[slot++] = JSVAL_VOID;
|
||||
|
||||
obj->dslots = NULL;
|
||||
obj->init(clasp, proto, proto->getParent(), privateSlotValue);
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
@ -4798,7 +4775,7 @@ js_DefaultValue(JSContext *cx, JSObject *obj, JSType hint, jsval *vp)
|
|||
|
||||
if (FUN_FAST_NATIVE(fun) == js_str_toString) {
|
||||
JS_UNLOCK_SCOPE(cx, scope);
|
||||
*vp = obj->fslots[JSSLOT_PRIVATE];
|
||||
*vp = obj->fslots[JSSLOT_PRIMITIVE_THIS];
|
||||
return JS_TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -5483,7 +5460,7 @@ js_PrimitiveToObject(JSContext *cx, jsval *vp)
|
|||
obj = js_NewObject(cx, clasp, NULL, NULL);
|
||||
if (!obj)
|
||||
return JS_FALSE;
|
||||
obj->fslots[JSSLOT_PRIVATE] = *vp;
|
||||
obj->fslots[JSSLOT_PRIMITIVE_THIS] = *vp;
|
||||
*vp = OBJECT_TO_JSVAL(obj);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
@ -5686,22 +5663,15 @@ js_DumpScopeMeters(JSRuntime *rt)
|
|||
void
|
||||
js_PrintObjectSlotName(JSTracer *trc, char *buf, size_t bufsize)
|
||||
{
|
||||
JSObject *obj;
|
||||
uint32 slot;
|
||||
JSScope *scope;
|
||||
jsval nval;
|
||||
JSScopeProperty *sprop;
|
||||
JSClass *clasp;
|
||||
uint32 key;
|
||||
const char *slotname;
|
||||
|
||||
JS_ASSERT(trc->debugPrinter == js_PrintObjectSlotName);
|
||||
obj = (JSObject *)trc->debugPrintArg;
|
||||
slot = (uint32)trc->debugPrintIndex;
|
||||
JS_ASSERT(slot >= JSSLOT_PRIVATE);
|
||||
|
||||
JSObject *obj = (JSObject *)trc->debugPrintArg;
|
||||
uint32 slot = (uint32)trc->debugPrintIndex;
|
||||
JS_ASSERT(slot >= JSSLOT_START(obj->getClass()));
|
||||
|
||||
JSScopeProperty *sprop;
|
||||
if (OBJ_IS_NATIVE(obj)) {
|
||||
scope = OBJ_SCOPE(obj);
|
||||
JSScope *scope = OBJ_SCOPE(obj);
|
||||
sprop = SCOPE_LAST_PROP(scope);
|
||||
while (sprop && sprop->slot != slot)
|
||||
sprop = sprop->parent;
|
||||
|
@ -5710,10 +5680,10 @@ js_PrintObjectSlotName(JSTracer *trc, char *buf, size_t bufsize)
|
|||
}
|
||||
|
||||
if (!sprop) {
|
||||
slotname = NULL;
|
||||
clasp = obj->getClass();
|
||||
const char *slotname = NULL;
|
||||
JSClass *clasp = obj->getClass();
|
||||
if (clasp->flags & JSCLASS_IS_GLOBAL) {
|
||||
key = slot - JSSLOT_START(clasp);
|
||||
uint32 key = slot - JSSLOT_START(clasp);
|
||||
#define JS_PROTO(name,code,init) \
|
||||
if ((code) == key) { slotname = js_##name##_str; goto found; }
|
||||
#include "jsproto.tbl"
|
||||
|
@ -5725,7 +5695,7 @@ js_PrintObjectSlotName(JSTracer *trc, char *buf, size_t bufsize)
|
|||
else
|
||||
JS_snprintf(buf, bufsize, "**UNKNOWN SLOT %ld**", (long)slot);
|
||||
} else {
|
||||
nval = ID_TO_VALUE(sprop->id);
|
||||
jsval nval = ID_TO_VALUE(sprop->id);
|
||||
if (JSVAL_IS_INT(nval)) {
|
||||
JS_snprintf(buf, bufsize, "%ld", (long)JSVAL_TO_INT(nval));
|
||||
} else if (JSVAL_IS_STRING(nval)) {
|
||||
|
@ -5740,16 +5710,10 @@ js_PrintObjectSlotName(JSTracer *trc, char *buf, size_t bufsize)
|
|||
void
|
||||
js_TraceObject(JSTracer *trc, JSObject *obj)
|
||||
{
|
||||
JSContext *cx;
|
||||
JSScope *scope;
|
||||
JSClass *clasp;
|
||||
size_t nslots, i;
|
||||
jsval v;
|
||||
|
||||
JS_ASSERT(OBJ_IS_NATIVE(obj));
|
||||
cx = trc->context;
|
||||
scope = OBJ_SCOPE(obj);
|
||||
|
||||
JSContext *cx = trc->context;
|
||||
JSScope *scope = OBJ_SCOPE(obj);
|
||||
if (scope->owned() && IS_GC_MARKING_TRACER(trc)) {
|
||||
/*
|
||||
* Check whether we should shrink the object's slots. Skip this check
|
||||
|
@ -5771,7 +5735,7 @@ js_TraceObject(JSTracer *trc, JSObject *obj)
|
|||
js_TraceWatchPoints(trc, obj);
|
||||
|
||||
/* No one runs while the GC is running, so we can use LOCKED_... here. */
|
||||
clasp = obj->getClass();
|
||||
JSClass *clasp = obj->getClass();
|
||||
if (clasp->mark) {
|
||||
if (clasp->flags & JSCLASS_MARK_IS_TRACE)
|
||||
((JSTraceOp) clasp->mark)(trc, obj);
|
||||
|
@ -5790,12 +5754,13 @@ js_TraceObject(JSTracer *trc, JSObject *obj)
|
|||
* don't move it up and unify it with the |if (!traceScope)| section
|
||||
* above.
|
||||
*/
|
||||
nslots = STOBJ_NSLOTS(obj);
|
||||
uint32 nslots = STOBJ_NSLOTS(obj);
|
||||
if (scope->owned() && scope->freeslot < nslots)
|
||||
nslots = scope->freeslot;
|
||||
JS_ASSERT(nslots >= JSSLOT_START(clasp));
|
||||
|
||||
for (i = JSSLOT_PRIVATE; i != nslots; ++i) {
|
||||
v = STOBJ_GET_SLOT(obj, i);
|
||||
for (uint32 i = JSSLOT_START(clasp); i != nslots; ++i) {
|
||||
jsval v = STOBJ_GET_SLOT(obj, i);
|
||||
if (JSVAL_IS_TRACEABLE(v)) {
|
||||
JS_SET_TRACING_DETAILS(trc, js_PrintObjectSlotName, obj, i);
|
||||
JS_CallTracer(trc, JSVAL_TO_TRACEABLE(v), JSVAL_TRACE_KIND(v));
|
||||
|
|
|
@ -93,8 +93,18 @@ const uint32 JS_INITIAL_NSLOTS = 5;
|
|||
|
||||
const uint32 JSSLOT_PROTO = 0;
|
||||
const uint32 JSSLOT_PARENT = 1;
|
||||
|
||||
/*
|
||||
* The first available slot to store generic value. For JSCLASS_HAS_PRIVATE
|
||||
* classes the slot stores a pointer to private data reinterpreted as jsval.
|
||||
* Such pointer is stored as is without an overhead of PRIVATE_TO_JSVAL
|
||||
* tagging and should be accessed using the (get|set)Private methods of
|
||||
* JSObject.
|
||||
*/
|
||||
const uint32 JSSLOT_PRIVATE = 2;
|
||||
|
||||
const uint32 JSSLOT_PRIMITIVE_THIS = JSSLOT_PRIVATE;
|
||||
|
||||
const uintptr_t JSSLOT_CLASS_MASK_BITS = 3;
|
||||
|
||||
/*
|
||||
|
@ -196,33 +206,44 @@ struct JSObject {
|
|||
JS_CALL_OBJECT_TRACER(trc, parent, "__parent__");
|
||||
}
|
||||
|
||||
/*
|
||||
* Get private value previously assigned with setPrivate.
|
||||
*/
|
||||
void *getAssignedPrivate() const {
|
||||
JS_ASSERT(getClass()->flags & JSCLASS_HAS_PRIVATE);
|
||||
|
||||
jsval v = fslots[JSSLOT_PRIVATE];
|
||||
JS_ASSERT(JSVAL_IS_INT(v));
|
||||
return JSVAL_TO_PRIVATE(v);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get private value or null if the value has not yet been assigned.
|
||||
*/
|
||||
void *getPrivate() const {
|
||||
JS_ASSERT(getClass()->flags & JSCLASS_HAS_PRIVATE);
|
||||
|
||||
jsval v = fslots[JSSLOT_PRIVATE];
|
||||
if (JSVAL_IS_INT(v))
|
||||
return JSVAL_TO_PRIVATE(v);
|
||||
JS_ASSERT(JSVAL_IS_VOID(v));
|
||||
return NULL;
|
||||
JS_ASSERT((v & jsval(1)) == jsval(0));
|
||||
return reinterpret_cast<void *>(v);
|
||||
}
|
||||
|
||||
void setPrivate(void *data) {
|
||||
JS_ASSERT(getClass()->flags & JSCLASS_HAS_PRIVATE);
|
||||
fslots[JSSLOT_PRIVATE] = PRIVATE_TO_JSVAL(data);
|
||||
jsval v = reinterpret_cast<jsval>(data);
|
||||
JS_ASSERT((v & jsval(1)) == jsval(0));
|
||||
fslots[JSSLOT_PRIVATE] = v;
|
||||
}
|
||||
|
||||
static jsval defaultPrivate(JSClass *clasp) {
|
||||
return (clasp->flags & JSCLASS_HAS_PRIVATE)
|
||||
? JSVAL_NULL
|
||||
: JSVAL_VOID;
|
||||
}
|
||||
|
||||
/* The map field is not initialized here and should be set separately. */
|
||||
void init(JSClass *clasp, JSObject *proto, JSObject *parent,
|
||||
jsval privateSlotValue) {
|
||||
JS_ASSERT(((jsuword) clasp & 3) == 0);
|
||||
JS_STATIC_ASSERT(JSSLOT_PRIVATE + 3 == JS_INITIAL_NSLOTS);
|
||||
JS_ASSERT_IF(clasp->flags & JSCLASS_HAS_PRIVATE,
|
||||
(privateSlotValue & jsval(1)) == jsval(0));
|
||||
|
||||
classword = jsuword(clasp);
|
||||
JS_ASSERT(!isDelegate());
|
||||
JS_ASSERT(!isSystem());
|
||||
|
||||
setProto(proto);
|
||||
setParent(parent);
|
||||
fslots[JSSLOT_PRIVATE] = privateSlotValue;
|
||||
fslots[JSSLOT_PRIVATE + 1] = JSVAL_VOID;
|
||||
fslots[JSSLOT_PRIVATE + 2] = JSVAL_VOID;
|
||||
dslots = NULL;
|
||||
}
|
||||
|
||||
JSBool lookupProperty(JSContext *cx, jsid id,
|
||||
|
@ -302,7 +323,7 @@ struct JSObject {
|
|||
|
||||
#define JSSLOT_START(clasp) (((clasp)->flags & JSCLASS_HAS_PRIVATE) \
|
||||
? JSSLOT_PRIVATE + 1 \
|
||||
: JSSLOT_PARENT + 1)
|
||||
: JSSLOT_PRIVATE)
|
||||
|
||||
#define JSSLOT_FREE(clasp) (JSSLOT_START(clasp) \
|
||||
+ JSCLASS_RESERVED_SLOTS(clasp))
|
||||
|
@ -581,9 +602,8 @@ js_NewObjectWithGivenProto(JSContext *cx, JSClass *clasp, JSObject *proto,
|
|||
JSObject *parent, size_t objectSize = 0);
|
||||
|
||||
/*
|
||||
* Allocate a new native object and initialize all fslots with JSVAL_VOID
|
||||
* starting with the specified slot. The parent slot is set to the value of
|
||||
* proto's parent slot.
|
||||
* Allocate a new native object with the given value of the proto and private
|
||||
* slots. The parent slot is set to the value of proto's parent slot.
|
||||
*
|
||||
* Note that this is the correct global object for native class instances, but
|
||||
* not for user-defined functions called as constructors. Functions used as
|
||||
|
@ -591,7 +611,8 @@ js_NewObjectWithGivenProto(JSContext *cx, JSClass *clasp, JSObject *proto,
|
|||
* object, not by the parent of its .prototype object value.
|
||||
*/
|
||||
extern JSObject*
|
||||
js_NewNativeObject(JSContext *cx, JSClass *clasp, JSObject *proto, uint32 slot);
|
||||
js_NewNativeObject(JSContext *cx, JSClass *clasp, JSObject *proto,
|
||||
jsval privateSlotValue);
|
||||
|
||||
/*
|
||||
* Fast access to immutable standard objects (constructors and prototypes).
|
||||
|
|
|
@ -460,7 +460,7 @@ Str(JSContext *cx, jsid id, JSObject *holder, StringifyContext *scx, jsval *vp,
|
|||
if (!JSVAL_IS_PRIMITIVE(*vp)) {
|
||||
JSClass *clasp = OBJ_GET_CLASS(cx, JSVAL_TO_OBJECT(*vp));
|
||||
if (clasp == &js_StringClass || clasp == &js_NumberClass)
|
||||
*vp = JSVAL_TO_OBJECT(*vp)->fslots[JSSLOT_PRIVATE];
|
||||
*vp = JSVAL_TO_OBJECT(*vp)->fslots[JSSLOT_PRIMITIVE_THIS];
|
||||
}
|
||||
|
||||
if (JSVAL_IS_STRING(*vp)) {
|
||||
|
|
|
@ -145,7 +145,7 @@
|
|||
clasp = OBJ_GET_CLASS(cx, obj);
|
||||
if (clasp != &js_BlockClass && clasp != &js_WithClass)
|
||||
continue;
|
||||
if (obj->getAssignedPrivate() != fp)
|
||||
if (obj->getPrivate() != fp)
|
||||
break;
|
||||
JS_ASSERT(StackBase(fp) + OBJ_BLOCK_DEPTH(cx, obj)
|
||||
+ ((clasp == &js_BlockClass)
|
||||
|
@ -4114,7 +4114,7 @@
|
|||
while ((clasp = OBJ_GET_CLASS(cx, obj2)) == &js_WithClass)
|
||||
obj2 = OBJ_GET_PARENT(cx, obj2);
|
||||
if (clasp == &js_BlockClass &&
|
||||
obj2->getAssignedPrivate() == fp) {
|
||||
obj2->getPrivate() == fp) {
|
||||
JSObject *youngestProto = OBJ_GET_PROTO(cx, obj2);
|
||||
JS_ASSERT(!OBJ_IS_CLONED_BLOCK(youngestProto));
|
||||
parent = obj;
|
||||
|
|
|
@ -192,7 +192,7 @@ StackDepth(JSScript *script)
|
|||
\
|
||||
JS_GET_SCRIPT_OBJECT(script, index, funobj_); \
|
||||
JS_ASSERT(HAS_FUNCTION_CLASS(funobj_)); \
|
||||
JS_ASSERT(funobj_ == (JSObject *) funobj_->getAssignedPrivate()); \
|
||||
JS_ASSERT(funobj_ == (JSObject *) funobj_->getPrivate()); \
|
||||
(fun) = (JSFunction *) funobj_; \
|
||||
JS_ASSERT(FUN_INTERPRETED(fun)); \
|
||||
JS_END_MACRO
|
||||
|
|
|
@ -558,7 +558,7 @@ str_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
if (id == ATOM_KEY(cx->runtime->atomState.lengthAtom)) {
|
||||
if (OBJ_GET_CLASS(cx, obj) == &js_StringClass) {
|
||||
/* Follow ECMA-262 by fetching intrinsic length of our string. */
|
||||
v = obj->fslots[JSSLOT_PRIVATE];
|
||||
v = obj->fslots[JSSLOT_PRIMITIVE_THIS];
|
||||
JS_ASSERT(JSVAL_IS_STRING(v));
|
||||
str = JSVAL_TO_STRING(v);
|
||||
} else {
|
||||
|
@ -583,7 +583,7 @@ str_enumerate(JSContext *cx, JSObject *obj)
|
|||
JSString *str, *str1;
|
||||
size_t i, length;
|
||||
|
||||
v = obj->fslots[JSSLOT_PRIVATE];
|
||||
v = obj->fslots[JSSLOT_PRIMITIVE_THIS];
|
||||
JS_ASSERT(JSVAL_IS_STRING(v));
|
||||
str = JSVAL_TO_STRING(v);
|
||||
|
||||
|
@ -611,7 +611,7 @@ str_resolve(JSContext *cx, JSObject *obj, jsval id, uintN flags,
|
|||
if (!JSVAL_IS_INT(id) || (flags & JSRESOLVE_ASSIGNING))
|
||||
return JS_TRUE;
|
||||
|
||||
v = obj->fslots[JSSLOT_PRIVATE];
|
||||
v = obj->fslots[JSSLOT_PRIMITIVE_THIS];
|
||||
JS_ASSERT(JSVAL_IS_STRING(v));
|
||||
str = JSVAL_TO_STRING(v);
|
||||
|
||||
|
@ -791,7 +791,7 @@ String_p_toString(JSContext* cx, JSObject* obj)
|
|||
{
|
||||
if (!JS_InstanceOf(cx, obj, &js_StringClass, NULL))
|
||||
return NULL;
|
||||
jsval v = obj->fslots[JSSLOT_PRIVATE];
|
||||
jsval v = obj->fslots[JSSLOT_PRIMITIVE_THIS];
|
||||
JS_ASSERT(JSVAL_IS_STRING(v));
|
||||
return JSVAL_TO_STRING(v);
|
||||
}
|
||||
|
@ -2611,7 +2611,7 @@ js_String(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
|||
*rval = STRING_TO_JSVAL(str);
|
||||
return JS_TRUE;
|
||||
}
|
||||
obj->fslots[JSSLOT_PRIVATE] = STRING_TO_JSVAL(str);
|
||||
obj->fslots[JSSLOT_PRIMITIVE_THIS] = STRING_TO_JSVAL(str);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
@ -2621,12 +2621,7 @@ JSObject* FASTCALL
|
|||
js_String_tn(JSContext* cx, JSObject* proto, JSString* str)
|
||||
{
|
||||
JS_ASSERT(JS_ON_TRACE(cx));
|
||||
JSObject* obj = js_NewNativeObject(cx, &js_StringClass, proto, JSSLOT_PRIVATE + 1);
|
||||
if (!obj)
|
||||
return NULL;
|
||||
|
||||
obj->fslots[JSSLOT_PRIVATE] = STRING_TO_JSVAL(str);
|
||||
return obj;
|
||||
return js_NewNativeObject(cx, &js_StringClass, proto, STRING_TO_JSVAL(str));
|
||||
}
|
||||
JS_DEFINE_CALLINFO_3(extern, OBJECT, js_String_tn, CONTEXT, CALLEE_PROTOTYPE, STRING, 0, 0)
|
||||
|
||||
|
@ -2766,7 +2761,7 @@ js_InitStringClass(JSContext *cx, JSObject *obj)
|
|||
NULL, string_static_methods);
|
||||
if (!proto)
|
||||
return NULL;
|
||||
proto->fslots[JSSLOT_PRIVATE] = STRING_TO_JSVAL(cx->runtime->emptyString);
|
||||
proto->fslots[JSSLOT_PRIMITIVE_THIS] = STRING_TO_JSVAL(cx->runtime->emptyString);
|
||||
if (!js_DefineNativeProperty(cx, proto, ATOM_TO_JSID(cx->runtime->atomState.lengthAtom),
|
||||
JSVAL_VOID, NULL, NULL,
|
||||
JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0,
|
||||
|
|
|
@ -10822,7 +10822,7 @@ TraceRecorder::guardCallee(jsval& callee)
|
|||
guard(true,
|
||||
lir->ins2(LIR_eq,
|
||||
stobj_get_private(callee_ins),
|
||||
INS_CONSTPTR(callee_obj->getAssignedPrivate())),
|
||||
INS_CONSTPTR(callee_obj->getPrivate())),
|
||||
branchExit);
|
||||
guard(true,
|
||||
lir->ins2(LIR_eq,
|
||||
|
@ -11897,7 +11897,7 @@ TraceRecorder::record_JSOP_BINDNAME()
|
|||
// are still on the stack. We never use BINDNAME to refer to these.
|
||||
while (OBJ_GET_CLASS(cx, obj) == &js_BlockClass) {
|
||||
// The block's values are still on the stack.
|
||||
JS_ASSERT(obj->getAssignedPrivate() == fp);
|
||||
JS_ASSERT(obj->getPrivate() == fp);
|
||||
obj = OBJ_GET_PARENT(cx, obj);
|
||||
// Blocks always have parents.
|
||||
JS_ASSERT(obj);
|
||||
|
|
|
@ -838,10 +838,8 @@ class TraceRecorder : public avmplus::GCObject {
|
|||
nanojit::LIns* stobj_get_slot(nanojit::LIns* obj_ins, unsigned slot,
|
||||
nanojit::LIns*& dslots_ins);
|
||||
|
||||
nanojit::LIns* stobj_get_private(nanojit::LIns* obj_ins, jsval mask=JSVAL_INT) {
|
||||
return lir->ins2(nanojit::LIR_piand,
|
||||
stobj_get_fslot(obj_ins, JSSLOT_PRIVATE),
|
||||
lir->insImmPtr((void*) ~mask));
|
||||
nanojit::LIns* stobj_get_private(nanojit::LIns* obj_ins) {
|
||||
return stobj_get_fslot(obj_ins, JSSLOT_PRIVATE);
|
||||
}
|
||||
|
||||
nanojit::LIns* stobj_get_proto(nanojit::LIns* obj_ins) {
|
||||
|
|
108
js/src/jsxml.cpp
108
js/src/jsxml.cpp
|
@ -1964,7 +1964,7 @@ ToXML(JSContext *cx, jsval v)
|
|||
} else {
|
||||
obj = JSVAL_TO_OBJECT(v);
|
||||
if (OBJECT_IS_XML(cx, obj)) {
|
||||
xml = (JSXML *) obj->getAssignedPrivate();
|
||||
xml = (JSXML *) obj->getPrivate();
|
||||
if (xml->xml_class == JSXML_CLASS_LIST) {
|
||||
if (xml->xml_kids.length != 1)
|
||||
goto bad;
|
||||
|
@ -2045,12 +2045,12 @@ ToXMLList(JSContext *cx, jsval v)
|
|||
} else {
|
||||
obj = JSVAL_TO_OBJECT(v);
|
||||
if (OBJECT_IS_XML(cx, obj)) {
|
||||
xml = (JSXML *) obj->getAssignedPrivate();
|
||||
xml = (JSXML *) obj->getPrivate();
|
||||
if (xml->xml_class != JSXML_CLASS_LIST) {
|
||||
listobj = js_NewXMLObject(cx, JSXML_CLASS_LIST);
|
||||
if (!listobj)
|
||||
return NULL;
|
||||
list = (JSXML *) listobj->getAssignedPrivate();
|
||||
list = (JSXML *) listobj->getPrivate();
|
||||
if (!Append(cx, list, xml))
|
||||
return NULL;
|
||||
return listobj;
|
||||
|
@ -2089,7 +2089,7 @@ ToXMLList(JSContext *cx, jsval v)
|
|||
|
||||
listobj = js_NewXMLObject(cx, JSXML_CLASS_LIST);
|
||||
if (listobj) {
|
||||
list = (JSXML *) listobj->getAssignedPrivate();
|
||||
list = (JSXML *) listobj->getPrivate();
|
||||
for (i = 0; i < length; i++) {
|
||||
kid = OrphanXMLChild(cx, xml, i);
|
||||
if (!kid || !Append(cx, list, kid)) {
|
||||
|
@ -2882,7 +2882,7 @@ ToXMLString(JSContext *cx, jsval v, uint32 toSourceFlag)
|
|||
}
|
||||
|
||||
/* Handle non-element cases in this switch, returning from each case. */
|
||||
xml = (JSXML *) obj->getAssignedPrivate();
|
||||
xml = (JSXML *) obj->getPrivate();
|
||||
return XMLToXMLString(cx, xml, NULL, toSourceFlag | 0);
|
||||
}
|
||||
|
||||
|
@ -3379,7 +3379,7 @@ Descendants(JSContext *cx, JSXML *xml, jsval id)
|
|||
listobj = js_NewXMLObject(cx, JSXML_CLASS_LIST);
|
||||
if (!listobj)
|
||||
return NULL;
|
||||
list = (JSXML *) listobj->getAssignedPrivate();
|
||||
list = (JSXML *) listobj->getPrivate();
|
||||
if (funid)
|
||||
return list;
|
||||
|
||||
|
@ -3525,7 +3525,7 @@ Equals(JSContext *cx, JSXML *xml, jsval v, JSBool *bp)
|
|||
if (!OBJECT_IS_XML(cx, vobj)) {
|
||||
*bp = JS_FALSE;
|
||||
} else {
|
||||
vxml = (JSXML *) vobj->getAssignedPrivate();
|
||||
vxml = (JSXML *) vobj->getPrivate();
|
||||
if (!XMLEquals(cx, xml, vxml, bp))
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -3566,7 +3566,7 @@ Insert(JSContext *cx, JSXML *xml, uint32 i, jsval v)
|
|||
if (!JSVAL_IS_PRIMITIVE(v)) {
|
||||
vobj = JSVAL_TO_OBJECT(v);
|
||||
if (OBJECT_IS_XML(cx, vobj)) {
|
||||
vxml = (JSXML *) vobj->getAssignedPrivate();
|
||||
vxml = (JSXML *) vobj->getPrivate();
|
||||
if (vxml->xml_class == JSXML_CLASS_LIST) {
|
||||
n = vxml->xml_kids.length;
|
||||
if (n == 0)
|
||||
|
@ -3660,7 +3660,7 @@ Replace(JSContext *cx, JSXML *xml, uint32 i, jsval v)
|
|||
if (!JSVAL_IS_PRIMITIVE(v)) {
|
||||
vobj = JSVAL_TO_OBJECT(v);
|
||||
if (OBJECT_IS_XML(cx, vobj))
|
||||
vxml = (JSXML *) vobj->getAssignedPrivate();
|
||||
vxml = (JSXML *) vobj->getPrivate();
|
||||
}
|
||||
|
||||
switch (vxml ? JSXMLClass(vxml->xml_class) : JSXML_CLASS_LIMIT) {
|
||||
|
@ -3902,7 +3902,7 @@ GetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
roots[1] = OBJECT_TO_JSVAL(listobj);
|
||||
tvr.count++;
|
||||
|
||||
list = (JSXML *) listobj->getAssignedPrivate();
|
||||
list = (JSXML *) listobj->getPrivate();
|
||||
if (!GetNamedProperty(cx, xml, nameqn, list)) {
|
||||
listobj = NULL;
|
||||
} else {
|
||||
|
@ -3988,7 +3988,7 @@ PutProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
if (!JSVAL_IS_PRIMITIVE(*vp)) {
|
||||
vobj = JSVAL_TO_OBJECT(*vp);
|
||||
if (OBJECT_IS_XML(cx, vobj))
|
||||
vxml = (JSXML *) vobj->getAssignedPrivate();
|
||||
vxml = (JSXML *) vobj->getPrivate();
|
||||
}
|
||||
|
||||
ok = js_EnterLocalRootScope(cx);
|
||||
|
@ -4079,7 +4079,7 @@ PutProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
if (JSVAL_IS_PRIMITIVE(attrval)) /* no such attribute */
|
||||
goto out;
|
||||
attrobj = JSVAL_TO_OBJECT(attrval);
|
||||
attr = (JSXML *) attrobj->getAssignedPrivate();
|
||||
attr = (JSXML *) attrobj->getPrivate();
|
||||
if (JSXML_LENGTH(attr) != 0)
|
||||
goto out;
|
||||
|
||||
|
@ -4185,7 +4185,7 @@ PutProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
ok = GetProperty(cx, parentobj, id, vp);
|
||||
if (!ok)
|
||||
goto out;
|
||||
attr = (JSXML *) JSVAL_TO_OBJECT(*vp)->getAssignedPrivate();
|
||||
attr = (JSXML *) JSVAL_TO_OBJECT(*vp)->getPrivate();
|
||||
|
||||
/* 2(e)(iii) - the length check comes from the bug 375406. */
|
||||
if (attr->xml_kids.length != 0)
|
||||
|
@ -4278,7 +4278,7 @@ PutProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
if (!vobj)
|
||||
goto bad;
|
||||
roots[VAL_ROOT] = *vp = OBJECT_TO_JSVAL(vobj);
|
||||
vxml = (JSXML *) vobj->getAssignedPrivate();
|
||||
vxml = (JSXML *) vobj->getPrivate();
|
||||
}
|
||||
XMLARRAY_SET_MEMBER(&xml->xml_kids, i, vxml);
|
||||
}
|
||||
|
@ -4541,7 +4541,7 @@ PutProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
vobj = js_NewXMLObject(cx, JSXML_CLASS_ELEMENT);
|
||||
if (!vobj)
|
||||
goto bad;
|
||||
vxml = (JSXML *) vobj->getAssignedPrivate();
|
||||
vxml = (JSXML *) vobj->getPrivate();
|
||||
vxml->parent = xml;
|
||||
vxml->name = nameqn;
|
||||
|
||||
|
@ -4640,7 +4640,7 @@ ResolveValue(JSContext *cx, JSXML *list, JSXML **result)
|
|||
id = OBJECT_TO_JSVAL(targetprop);
|
||||
if (!GetProperty(cx, base->object, id, &tv))
|
||||
return JS_FALSE;
|
||||
target = (JSXML *) JSVAL_TO_OBJECT(tv)->getAssignedPrivate();
|
||||
target = (JSXML *) JSVAL_TO_OBJECT(tv)->getPrivate();
|
||||
|
||||
if (JSXML_LENGTH(target) == 0) {
|
||||
if (base->xml_class == JSXML_CLASS_LIST && JSXML_LENGTH(base) > 1) {
|
||||
|
@ -4652,7 +4652,7 @@ ResolveValue(JSContext *cx, JSXML *list, JSXML **result)
|
|||
return JS_FALSE;
|
||||
if (!GetProperty(cx, base->object, id, &tv))
|
||||
return JS_FALSE;
|
||||
target = (JSXML *) JSVAL_TO_OBJECT(tv)->getAssignedPrivate();
|
||||
target = (JSXML *) JSVAL_TO_OBJECT(tv)->getPrivate();
|
||||
}
|
||||
|
||||
*result = target;
|
||||
|
@ -4727,7 +4727,7 @@ HasFunctionProperty(JSContext *cx, JSObject *obj, jsid funid, JSBool *found)
|
|||
if (prop) {
|
||||
pobj->dropProperty(cx, prop);
|
||||
} else {
|
||||
xml = (JSXML *) obj->getAssignedPrivate();
|
||||
xml = (JSXML *) obj->getPrivate();
|
||||
if (HasSimpleContent(xml)) {
|
||||
/*
|
||||
* Search in String.prototype to set found whenever
|
||||
|
@ -4760,7 +4760,7 @@ HasProperty(JSContext *cx, JSObject *obj, jsval id, JSBool *found)
|
|||
JSObject *qn;
|
||||
jsid funid;
|
||||
|
||||
xml = (JSXML *) obj->getAssignedPrivate();
|
||||
xml = (JSXML *) obj->getPrivate();
|
||||
if (js_IdIsIndex(id, &i)) {
|
||||
*found = HasIndexedProperty(xml, i);
|
||||
} else {
|
||||
|
@ -4839,7 +4839,7 @@ xml_lookupProperty(JSContext *cx, JSObject *obj, jsid id, JSObject **objp,
|
|||
JSScopeProperty *sprop;
|
||||
|
||||
v = ID_TO_VALUE(id);
|
||||
xml = (JSXML *) obj->getAssignedPrivate();
|
||||
xml = (JSXML *) obj->getPrivate();
|
||||
if (js_IdIsIndex(v, &i)) {
|
||||
found = HasIndexedProperty(xml, i);
|
||||
} else {
|
||||
|
@ -4945,7 +4945,7 @@ xml_deleteProperty(JSContext *cx, JSObject *obj, jsid id, jsval *rval)
|
|||
jsid funid;
|
||||
|
||||
idval = ID_TO_VALUE(id);
|
||||
xml = (JSXML *) obj->getAssignedPrivate();
|
||||
xml = (JSXML *) obj->getPrivate();
|
||||
if (js_IdIsIndex(idval, &index)) {
|
||||
if (xml->xml_class != JSXML_CLASS_LIST) {
|
||||
/* See NOTE in spec: this variation is reserved for future use. */
|
||||
|
@ -4988,7 +4988,7 @@ xml_defaultValue(JSContext *cx, JSObject *obj, JSType hint, jsval *vp)
|
|||
|
||||
if (hint == JSTYPE_OBJECT) {
|
||||
/* Called from for..in code in js_Interpret: return an XMLList. */
|
||||
xml = (JSXML *) obj->getAssignedPrivate();
|
||||
xml = (JSXML *) obj->getPrivate();
|
||||
if (xml->xml_class != JSXML_CLASS_LIST) {
|
||||
obj = ToXMLList(cx, OBJECT_TO_JSVAL(obj));
|
||||
if (!obj)
|
||||
|
@ -5009,7 +5009,7 @@ xml_enumerate(JSContext *cx, JSObject *obj, JSIterateOp enum_op,
|
|||
uint32 length, index;
|
||||
JSXMLArrayCursor *cursor;
|
||||
|
||||
xml = (JSXML *)obj->getAssignedPrivate();
|
||||
xml = (JSXML *)obj->getPrivate();
|
||||
length = JSXML_LENGTH(xml);
|
||||
|
||||
switch (enum_op) {
|
||||
|
@ -5137,7 +5137,7 @@ js_EnumerateXMLValues(JSContext *cx, JSObject *obj, JSIterateOp enum_op,
|
|||
JSObject *kidobj;
|
||||
|
||||
JS_ASSERT(JS_InstanceOf(cx, obj, &js_XMLClass, NULL));
|
||||
xml = (JSXML *) obj->getAssignedPrivate();
|
||||
xml = (JSXML *) obj->getPrivate();
|
||||
length = JSXML_LENGTH(xml);
|
||||
JS_ASSERT(INT_FITS_IN_JSVAL(length));
|
||||
|
||||
|
@ -5197,12 +5197,12 @@ js_TestXMLEquality(JSContext *cx, JSObject *obj, jsval v, JSBool *bp)
|
|||
jsdouble d, d2;
|
||||
|
||||
JS_ASSERT(JS_InstanceOf(cx, obj, &js_XMLClass, NULL));
|
||||
xml = (JSXML *) obj->getAssignedPrivate();
|
||||
xml = (JSXML *) obj->getPrivate();
|
||||
vxml = NULL;
|
||||
if (!JSVAL_IS_PRIMITIVE(v)) {
|
||||
vobj = JSVAL_TO_OBJECT(v);
|
||||
if (OBJECT_IS_XML(cx, vobj))
|
||||
vxml = (JSXML *) vobj->getAssignedPrivate();
|
||||
vxml = (JSXML *) vobj->getPrivate();
|
||||
}
|
||||
|
||||
if (xml->xml_class == JSXML_CLASS_LIST) {
|
||||
|
@ -5280,21 +5280,21 @@ js_ConcatenateXML(JSContext *cx, JSObject *obj, jsval v, jsval *vp)
|
|||
goto out;
|
||||
}
|
||||
|
||||
list = (JSXML *) listobj->getAssignedPrivate();
|
||||
lxml = (JSXML *) obj->getAssignedPrivate();
|
||||
list = (JSXML *) listobj->getPrivate();
|
||||
lxml = (JSXML *) obj->getPrivate();
|
||||
ok = Append(cx, list, lxml);
|
||||
if (!ok)
|
||||
goto out;
|
||||
|
||||
if (VALUE_IS_XML(cx, v)) {
|
||||
rxml = (JSXML *) JSVAL_TO_OBJECT(v)->getAssignedPrivate();
|
||||
rxml = (JSXML *) JSVAL_TO_OBJECT(v)->getPrivate();
|
||||
} else {
|
||||
robj = ToXML(cx, v);
|
||||
if (!robj) {
|
||||
ok = JS_FALSE;
|
||||
goto out;
|
||||
}
|
||||
rxml = (JSXML *) robj->getAssignedPrivate();
|
||||
rxml = (JSXML *) robj->getPrivate();
|
||||
}
|
||||
ok = Append(cx, list, rxml);
|
||||
if (!ok)
|
||||
|
@ -5430,7 +5430,7 @@ xml_appendChild(JSContext *cx, uintN argc, jsval *vp)
|
|||
JS_ASSERT(!JSVAL_IS_PRIMITIVE(v));
|
||||
vobj = JSVAL_TO_OBJECT(v);
|
||||
JS_ASSERT(OBJECT_IS_XML(cx, vobj));
|
||||
vxml = (JSXML *) vobj->getAssignedPrivate();
|
||||
vxml = (JSXML *) vobj->getPrivate();
|
||||
JS_ASSERT(vxml->xml_class == JSXML_CLASS_LIST);
|
||||
|
||||
if (!IndexToIdVal(cx, vxml->xml_kids.length, &name))
|
||||
|
@ -5493,7 +5493,7 @@ xml_list_helper(JSContext *cx, JSXML *xml, jsval *rval)
|
|||
return NULL;
|
||||
|
||||
*rval = OBJECT_TO_JSVAL(listobj);
|
||||
list = (JSXML *) listobj->getAssignedPrivate();
|
||||
list = (JSXML *) listobj->getPrivate();
|
||||
list->xml_target = xml;
|
||||
return list;
|
||||
}
|
||||
|
@ -5558,7 +5558,7 @@ xml_child(JSContext *cx, uintN argc, jsval *vp)
|
|||
}
|
||||
|
||||
JS_ASSERT(!JSVAL_IS_PRIMITIVE(v));
|
||||
vxml = (JSXML *) JSVAL_TO_OBJECT(v)->getAssignedPrivate();
|
||||
vxml = (JSXML *) JSVAL_TO_OBJECT(v)->getPrivate();
|
||||
if ((!JSXML_HAS_KIDS(vxml) || vxml->xml_kids.length != 0) &&
|
||||
!Append(cx, list, vxml)) {
|
||||
return JS_FALSE;
|
||||
|
@ -5639,7 +5639,7 @@ xml_comments_helper(JSContext *cx, JSObject *obj, JSXML *xml, jsval *vp)
|
|||
js_LeaveLocalRootScopeWithResult(cx, v);
|
||||
if (!ok)
|
||||
break;
|
||||
vxml = (JSXML *) JSVAL_TO_OBJECT(v)->getAssignedPrivate();
|
||||
vxml = (JSXML *) JSVAL_TO_OBJECT(v)->getPrivate();
|
||||
if (JSXML_LENGTH(vxml) != 0) {
|
||||
ok = Append(cx, list, vxml);
|
||||
if (!ok)
|
||||
|
@ -5763,7 +5763,7 @@ xml_elements_helper(JSContext *cx, JSObject *obj, JSXML *xml,
|
|||
js_LeaveLocalRootScopeWithResult(cx, v);
|
||||
if (!ok)
|
||||
break;
|
||||
vxml = (JSXML *) JSVAL_TO_OBJECT(v)->getAssignedPrivate();
|
||||
vxml = (JSXML *) JSVAL_TO_OBJECT(v)->getPrivate();
|
||||
if (JSXML_LENGTH(vxml) != 0) {
|
||||
ok = Append(cx, list, vxml);
|
||||
if (!ok)
|
||||
|
@ -5856,7 +5856,7 @@ again:
|
|||
if (!kidobj)
|
||||
return JS_FALSE;
|
||||
obj = kidobj;
|
||||
xml = (JSXML *) obj->getAssignedPrivate();
|
||||
xml = (JSXML *) obj->getPrivate();
|
||||
goto again;
|
||||
}
|
||||
}
|
||||
|
@ -6034,7 +6034,7 @@ xml_insertChildAfter(JSContext *cx, uintN argc, jsval *vp)
|
|||
} else {
|
||||
if (!VALUE_IS_XML(cx, arg))
|
||||
return JS_TRUE;
|
||||
kid = (JSXML *) JSVAL_TO_OBJECT(arg)->getAssignedPrivate();
|
||||
kid = (JSXML *) JSVAL_TO_OBJECT(arg)->getPrivate();
|
||||
i = XMLARRAY_FIND_MEMBER(&xml->xml_kids, kid, NULL);
|
||||
if (i == XML_NOT_FOUND)
|
||||
return JS_TRUE;
|
||||
|
@ -6066,7 +6066,7 @@ xml_insertChildBefore(JSContext *cx, uintN argc, jsval *vp)
|
|||
} else {
|
||||
if (!VALUE_IS_XML(cx, arg))
|
||||
return JS_TRUE;
|
||||
kid = (JSXML *) JSVAL_TO_OBJECT(arg)->getAssignedPrivate();
|
||||
kid = (JSXML *) JSVAL_TO_OBJECT(arg)->getPrivate();
|
||||
i = XMLARRAY_FIND_MEMBER(&xml->xml_kids, kid, NULL);
|
||||
if (i == XML_NOT_FOUND)
|
||||
return JS_TRUE;
|
||||
|
@ -6384,7 +6384,7 @@ xml_processingInstructions_helper(JSContext *cx, JSObject *obj, JSXML *xml,
|
|||
js_LeaveLocalRootScopeWithResult(cx, v);
|
||||
if (!ok)
|
||||
break;
|
||||
vxml = (JSXML *) JSVAL_TO_OBJECT(v)->getAssignedPrivate();
|
||||
vxml = (JSXML *) JSVAL_TO_OBJECT(v)->getPrivate();
|
||||
if (JSXML_LENGTH(vxml) != 0) {
|
||||
ok = Append(cx, list, vxml);
|
||||
if (!ok)
|
||||
|
@ -6558,7 +6558,7 @@ xml_replace(JSContext *cx, uintN argc, jsval *vp)
|
|||
} else {
|
||||
value = vp[3];
|
||||
vxml = VALUE_IS_XML(cx, value)
|
||||
? (JSXML *) JSVAL_TO_OBJECT(value)->getAssignedPrivate()
|
||||
? (JSXML *) JSVAL_TO_OBJECT(value)->getPrivate()
|
||||
: NULL;
|
||||
if (!vxml) {
|
||||
if (!JS_ConvertValue(cx, value, JSTYPE_STRING, &vp[3]))
|
||||
|
@ -6853,7 +6853,7 @@ xml_text_helper(JSContext *cx, JSObject *obj, JSXML *xml, jsval *vp)
|
|||
js_LeaveLocalRootScopeWithResult(cx, v);
|
||||
if (!ok)
|
||||
return JS_FALSE;
|
||||
vxml = (JSXML *) JSVAL_TO_OBJECT(v)->getAssignedPrivate();
|
||||
vxml = (JSXML *) JSVAL_TO_OBJECT(v)->getPrivate();
|
||||
if (JSXML_LENGTH(vxml) != 0 && !Append(cx, list, vxml))
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -7123,7 +7123,7 @@ XML(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
|||
if (!xobj)
|
||||
return JS_FALSE;
|
||||
*rval = OBJECT_TO_JSVAL(xobj);
|
||||
xml = (JSXML *) xobj->getAssignedPrivate();
|
||||
xml = (JSXML *) xobj->getPrivate();
|
||||
|
||||
if (JS_IsConstructing(cx) && !JSVAL_IS_PRIMITIVE(v)) {
|
||||
vobj = JSVAL_TO_OBJECT(v);
|
||||
|
@ -7156,14 +7156,14 @@ XMLList(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
|||
if (JS_IsConstructing(cx) && !JSVAL_IS_PRIMITIVE(v)) {
|
||||
vobj = JSVAL_TO_OBJECT(v);
|
||||
if (OBJECT_IS_XML(cx, vobj)) {
|
||||
xml = (JSXML *) vobj->getAssignedPrivate();
|
||||
xml = (JSXML *) vobj->getPrivate();
|
||||
if (xml->xml_class == JSXML_CLASS_LIST) {
|
||||
listobj = js_NewXMLObject(cx, JSXML_CLASS_LIST);
|
||||
if (!listobj)
|
||||
return JS_FALSE;
|
||||
*rval = OBJECT_TO_JSVAL(listobj);
|
||||
|
||||
list = (JSXML *) listobj->getAssignedPrivate();
|
||||
list = (JSXML *) listobj->getPrivate();
|
||||
if (!Append(cx, list, xml))
|
||||
return JS_FALSE;
|
||||
return JS_TRUE;
|
||||
|
@ -7343,7 +7343,7 @@ js_GetXMLObject(JSContext *cx, JSXML *xml)
|
|||
|
||||
obj = xml->object;
|
||||
if (obj) {
|
||||
JS_ASSERT(obj->getAssignedPrivate() == xml);
|
||||
JS_ASSERT(obj->getPrivate() == xml);
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
@ -7801,7 +7801,7 @@ js_FindXMLProperty(JSContext *cx, jsval nameval, JSObject **objp, jsid *idp)
|
|||
|
||||
if (OBJECT_IS_XML(cx, target)) {
|
||||
if (funid == 0) {
|
||||
xml = (JSXML *) target->getAssignedPrivate();
|
||||
xml = (JSXML *) target->getPrivate();
|
||||
found = HasNamedProperty(xml, qn);
|
||||
} else {
|
||||
if (!HasFunctionProperty(cx, target, funid, &found))
|
||||
|
@ -7865,7 +7865,7 @@ GetXMLFunction(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
|
|||
tvr.u.object = target;
|
||||
}
|
||||
|
||||
xml = (JSXML *) obj->getAssignedPrivate();
|
||||
xml = (JSXML *) obj->getPrivate();
|
||||
if (HasSimpleContent(xml)) {
|
||||
/* Search in String.prototype to implement 11.2.2.1 Step 3(f). */
|
||||
ok = js_GetClassPrototype(cx, NULL, INT_TO_JSID(JSProto_String),
|
||||
|
@ -7917,7 +7917,7 @@ js_DeleteXMLListElements(JSContext *cx, JSObject *listobj)
|
|||
JSXML *list;
|
||||
uint32 n;
|
||||
|
||||
list = (JSXML *) listobj->getAssignedPrivate();
|
||||
list = (JSXML *) listobj->getPrivate();
|
||||
for (n = list->xml_kids.length; n != 0; --n)
|
||||
DeleteListElement(cx, list, 0);
|
||||
|
||||
|
@ -7995,7 +7995,7 @@ js_StepXMLListFilter(JSContext *cx, JSBool initialized)
|
|||
return JS_FALSE;
|
||||
}
|
||||
obj = JSVAL_TO_OBJECT(sp[-2]);
|
||||
xml = (JSXML *) obj->getAssignedPrivate();
|
||||
xml = (JSXML *) obj->getPrivate();
|
||||
|
||||
if (xml->xml_class == JSXML_CLASS_LIST) {
|
||||
list = xml;
|
||||
|
@ -8009,7 +8009,7 @@ js_StepXMLListFilter(JSContext *cx, JSBool initialized)
|
|||
* as it may be the only root holding xml.
|
||||
*/
|
||||
sp[-1] = OBJECT_TO_JSVAL(obj);
|
||||
list = (JSXML *) obj->getAssignedPrivate();
|
||||
list = (JSXML *) obj->getPrivate();
|
||||
if (!Append(cx, list, xml))
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -8036,13 +8036,13 @@ js_StepXMLListFilter(JSContext *cx, JSBool initialized)
|
|||
return JS_FALSE;
|
||||
|
||||
/* This also roots resobj. */
|
||||
filter->result = (JSXML *) resobj->getAssignedPrivate();
|
||||
filter->result = (JSXML *) resobj->getPrivate();
|
||||
} else {
|
||||
/* We have iterated at least once. */
|
||||
JS_ASSERT(!JSVAL_IS_PRIMITIVE(sp[-2]));
|
||||
JS_ASSERT(OBJ_GET_CLASS(cx, JSVAL_TO_OBJECT(sp[-2])) ==
|
||||
&js_XMLFilterClass);
|
||||
filter = (JSXMLFilter *) JSVAL_TO_OBJECT(sp[-2])->getAssignedPrivate();
|
||||
filter = (JSXMLFilter *) JSVAL_TO_OBJECT(sp[-2])->getPrivate();
|
||||
JS_ASSERT(filter->kid);
|
||||
|
||||
/* Check if the filter expression wants to append the element. */
|
||||
|
@ -8094,7 +8094,7 @@ js_CloneXMLObject(JSContext *cx, JSObject *obj)
|
|||
|
||||
if (!GetXMLSettingFlags(cx, &flags))
|
||||
return NULL;
|
||||
xml = (JSXML *) obj->getAssignedPrivate();
|
||||
xml = (JSXML *) obj->getPrivate();
|
||||
if (flags & (XSF_IGNORE_COMMENTS |
|
||||
XSF_IGNORE_PROCESSING_INSTRUCTIONS |
|
||||
XSF_IGNORE_WHITESPACE)) {
|
||||
|
@ -8128,7 +8128,7 @@ js_NewXMLSpecialObject(JSContext *cx, JSXMLClass xml_class, JSString *name,
|
|||
obj = js_NewXMLObject(cx, xml_class);
|
||||
if (!obj)
|
||||
return NULL;
|
||||
xml = (JSXML *) obj->getAssignedPrivate();
|
||||
xml = (JSXML *) obj->getPrivate();
|
||||
if (name) {
|
||||
qn = NewXMLQName(cx, cx->runtime->emptyString, NULL, name);
|
||||
if (!qn)
|
||||
|
|
|
@ -514,7 +514,7 @@ GetMemberInfo(JSObject *obj,
|
|||
}
|
||||
else
|
||||
{
|
||||
XPCWrappedNative *wrapper = (XPCWrappedNative *) obj->getAssignedPrivate();
|
||||
XPCWrappedNative *wrapper = (XPCWrappedNative *) obj->getPrivate();
|
||||
proto = wrapper->GetProto();
|
||||
}
|
||||
if(proto)
|
||||
|
|
Загрузка…
Ссылка в новой задаче