Bug 772285 - rm JSPD_ARGUMENT/JSPD_VARIABLE (r=sfink)

--HG--
extra : rebase_source : 7be9ea3e5e90be9abd65f7d5268741e453cc717b
This commit is contained in:
Luke Wagner 2012-07-10 15:34:12 -07:00
parent eb8c258145
commit b844e5f326
10 changed files with 28 additions and 83 deletions

View File

@ -1211,7 +1211,7 @@ interface jsdIObject : nsISupports
* Representation of a property of an object. When an instance is invalid, all
* method and property access will result in a NS_UNAVAILABLE error.
*/
[scriptable, uuid(09332485-1419-42bc-ba1f-070815ed4b82)]
[scriptable, uuid(acf1329e-aaf6-4d6a-a1eb-f75858566f09)]
interface jsdIProperty : jsdIEphemeral
{
/** Internal use only. */
@ -1250,6 +1250,4 @@ interface jsdIProperty : jsdIEphemeral
readonly attribute jsdIValue name;
/** value of this property. */
readonly attribute jsdIValue value;
/** slot number if this property is a local variable or parameter. */
readonly attribute unsigned long varArgSlot;
};

View File

@ -255,7 +255,6 @@ struct JSDProperty
JSDValue* val;
JSDValue* name;
JSDValue* alias;
unsigned slot;
unsigned flags;
};
@ -991,9 +990,6 @@ jsd_GetPropertyAlias(JSDContext* jsdc, JSDProperty* jsdprop);
extern unsigned
jsd_GetPropertyFlags(JSDContext* jsdc, JSDProperty* jsdprop);
extern unsigned
jsd_GetPropertyVarArgSlot(JSDContext* jsdc, JSDProperty* jsdprop);
/**************************************************/
/* Stepping Functions */

View File

@ -375,7 +375,6 @@ static JSDProperty* _newProperty(JSDContext* jsdc, JSPropertyDesc* pd,
JS_INIT_CLIST(&jsdprop->links);
jsdprop->nref = 1;
jsdprop->flags = pd->flags | additionalFlags;
jsdprop->slot = pd->slot;
if(!(jsdprop->name = jsd_NewValue(jsdc, pd->id)))
goto new_prop_fail;
@ -625,7 +624,7 @@ jsd_GetValueProperty(JSDContext* jsdc, JSDValue* jsdval, JSString* name)
return NULL;
}
pd.slot = pd.spare = 0;
pd.spare = 0;
pd.alias = JSVAL_NULL;
pd.flags |= (attrs & JSPROP_ENUMERATE) ? JSPD_ENUMERATE : 0
| (attrs & JSPROP_READONLY) ? JSPD_READONLY : 0
@ -847,12 +846,6 @@ jsd_GetPropertyFlags(JSDContext* jsdc, JSDProperty* jsdprop)
return jsdprop->flags;
}
unsigned
jsd_GetPropertyVarArgSlot(JSDContext* jsdc, JSDProperty* jsdprop)
{
return jsdprop->slot;
}
void
jsd_DropProperty(JSDContext* jsdc, JSDProperty* jsdprop)
{

View File

@ -911,13 +911,6 @@ jsdProperty::GetValue(jsdIValue **_rval)
return NS_OK;
}
NS_IMETHODIMP
jsdProperty::GetVarArgSlot(PRUint32 *_rval)
{
*_rval = JSD_GetPropertyVarArgSlot (mCx, mProperty);
return NS_OK;
}
/* Scripts */
NS_IMPL_THREADSAFE_ISUPPORTS2(jsdScript, jsdIScript, jsdIEphemeral)

View File

@ -1226,14 +1226,6 @@ JSD_GetPropertyFlags(JSDContext* jsdc, JSDProperty* jsdprop)
return jsd_GetPropertyFlags(jsdc, jsdprop);
}
JSD_PUBLIC_API(unsigned)
JSD_GetPropertyVarArgSlot(JSDContext* jsdc, JSDProperty* jsdprop)
{
JSD_ASSERT_VALID_CONTEXT(jsdc);
JSD_ASSERT_VALID_PROPERTY(jsdprop);
return jsd_GetPropertyVarArgSlot(jsdc, jsdprop);
}
/**************************************************/
/* Object Functions */

View File

@ -1370,8 +1370,6 @@ JSD_GetScriptForValue(JSDContext* jsdc, JSDValue* jsdval);
#define JSDPD_READONLY JSPD_READONLY /* assignment is error */
#define JSDPD_PERMANENT JSPD_PERMANENT /* property cannot be deleted */
#define JSDPD_ALIAS JSPD_ALIAS /* property has an alias id */
#define JSDPD_ARGUMENT JSPD_ARGUMENT /* argument to function */
#define JSDPD_VARIABLE JSPD_VARIABLE /* local variable in function */
#define JSDPD_EXCEPTION JSPD_EXCEPTION /* exception occurred looking up */
/* proprety, value is exception */
#define JSDPD_ERROR JSPD_ERROR /* native getter returned JS_FALSE */
@ -1417,13 +1415,6 @@ JSD_GetPropertyAlias(JSDContext* jsdc, JSDProperty* jsdprop);
extern JSD_PUBLIC_API(unsigned)
JSD_GetPropertyFlags(JSDContext* jsdc, JSDProperty* jsdprop);
/*
* Get Variable or Argument slot number (if JSDPD_ARGUMENT or JSDPD_VARIABLE set)
* *** new for version 1.1 ****
*/
extern JSD_PUBLIC_API(unsigned)
JSD_GetPropertyVarArgSlot(JSDContext* jsdc, JSDProperty* jsdprop);
/***************************************************************************/
/* Object Functions --- All NEW for 1.1 --- */

View File

@ -818,15 +818,6 @@ GetPropertyDesc(JSContext *cx, JSObject *obj_, Shape *shape, JSPropertyDesc *pd)
| (!shape->writable() ? JSPD_READONLY : 0)
| (!shape->configurable() ? JSPD_PERMANENT : 0);
pd->spare = 0;
if (shape->setter() == CallObject::setArgOp) {
pd->slot = shape->shortid();
pd->flags |= JSPD_ARGUMENT;
} else if (shape->setter() == CallObject::setVarOp) {
pd->slot = shape->shortid();
pd->flags |= JSPD_VARIABLE;
} else {
pd->slot = 0;
}
pd->alias = JSVAL_VOID;
return JS_TRUE;

View File

@ -336,7 +336,6 @@ typedef struct JSPropertyDesc {
jsval value; /* property value */
uint8_t flags; /* flags, see below */
uint8_t spare; /* unused */
uint16_t slot; /* argument/variable slot */
jsval alias; /* alias id if JSPD_ALIAS flag */
} JSPropertyDesc;
@ -344,8 +343,6 @@ typedef struct JSPropertyDesc {
#define JSPD_READONLY 0x02 /* assignment is error */
#define JSPD_PERMANENT 0x04 /* property cannot be deleted */
#define JSPD_ALIAS 0x08 /* property has an alias id */
#define JSPD_ARGUMENT 0x10 /* argument to function */
#define JSPD_VARIABLE 0x20 /* local variable in function */
#define JSPD_EXCEPTION 0x40 /* exception occurred fetching the property, */
/* value is exception */
#define JSPD_ERROR 0x80 /* native getter returned JS_FALSE without */

View File

@ -2368,8 +2368,6 @@ GetPDA(JSContext *cx, unsigned argc, jsval *vp)
JS_SetProperty(cx, pdobj, "value", &pd->value) &&
(v = INT_TO_JSVAL(pd->flags),
JS_SetProperty(cx, pdobj, "flags", &v)) &&
(v = INT_TO_JSVAL(pd->slot),
JS_SetProperty(cx, pdobj, "slot", &v)) &&
JS_SetProperty(cx, pdobj, "alias", &pd->alias);
if (!ok)
break;

View File

@ -96,24 +96,22 @@ static char* FormatJSFrame(JSContext* cx, JSStackFrame* fp,
if (showArgs && callObj) {
for (uint32_t i = 0; i < callProps.length; i++) {
JSPropertyDesc* desc = &callProps.array[i];
if (desc->flags & JSPD_ARGUMENT) {
JSAutoByteString nameBytes;
const char* name = JSVAL2String(cx, desc->id, &isString, &nameBytes);
if (!isString)
name = nsnull;
JSAutoByteString valueBytes;
const char* value = JSVAL2String(cx, desc->value, &isString, &valueBytes);
JSAutoByteString nameBytes;
const char* name = JSVAL2String(cx, desc->id, &isString, &nameBytes);
if (!isString)
name = nsnull;
JSAutoByteString valueBytes;
const char* value = JSVAL2String(cx, desc->value, &isString, &valueBytes);
buf = JS_sprintf_append(buf, "%s%s%s%s%s%s",
namedArgCount ? ", " : "",
name ? name :"",
name ? " = " : "",
isString ? "\"" : "",
value ? value : "?unknown?",
isString ? "\"" : "");
if (!buf) goto out;
namedArgCount++;
}
buf = JS_sprintf_append(buf, "%s%s%s%s%s%s",
namedArgCount ? ", " : "",
name ? name :"",
name ? " = " : "",
isString ? "\"" : "",
value ? value : "?unknown?",
isString ? "\"" : "");
if (!buf) goto out;
namedArgCount++;
}
// print any unnamed trailing args (found in 'arguments' object)
@ -157,20 +155,18 @@ static char* FormatJSFrame(JSContext* cx, JSStackFrame* fp,
if (showLocals && callProps.array) {
for (uint32_t i = 0; i < callProps.length; i++) {
JSPropertyDesc* desc = &callProps.array[i];
if (desc->flags & JSPD_VARIABLE) {
JSAutoByteString nameBytes;
JSAutoByteString valueBytes;
const char *name = JSVAL2String(cx, desc->id, nsnull, &nameBytes);
const char *value = JSVAL2String(cx, desc->value, &isString, &valueBytes);
JSAutoByteString nameBytes;
JSAutoByteString valueBytes;
const char *name = JSVAL2String(cx, desc->id, nsnull, &nameBytes);
const char *value = JSVAL2String(cx, desc->value, &isString, &valueBytes);
if (name && value) {
buf = JS_sprintf_append(buf, TAB "%s = %s%s%s\n",
name,
isString ? "\"" : "",
value,
isString ? "\"" : "");
if (!buf) goto out;
}
if (name && value) {
buf = JS_sprintf_append(buf, TAB "%s = %s%s%s\n",
name,
isString ? "\"" : "",
value,
isString ? "\"" : "");
if (!buf) goto out;
}
}
}