Fix tracing of JSOP_IN (465241, r=danderson).

This commit is contained in:
Andreas Gal
2008-11-16 22:13:13 -08:00
parent e54d30fb22
commit 81f22d7d34
4 changed files with 75 additions and 66 deletions

View File

@@ -187,6 +187,20 @@ js_StringToInt32(JSContext* cx, JSString* str)
return js_DoubleToECMAInt32(d);
}
static inline JSBool
js_Int32ToId(JSContext* cx, int32 index, jsid* id)
{
if (unsigned(index) <= JSVAL_INT_MAX) {
*id = INT_TO_JSID(index);
return JS_TRUE;
} else {
JSString* str = js_NumberToString(cx, index);
if (!str)
return JS_FALSE;
return js_ValueToStringId(cx, STRING_TO_JSVAL(str), id);
}
}
jsval FASTCALL
js_Any_getprop(JSContext* cx, JSObject* obj, JSString* idstr)
{
@@ -405,6 +419,21 @@ js_HasNamedProperty(JSContext* cx, JSObject* obj, JSString* idstr)
return prop != NULL;
}
JSBool FASTCALL
js_HasNamedPropertyInt32(JSContext* cx, JSObject* obj, int32 index)
{
jsid id;
if (!js_Int32ToId(cx, index, &id))
return JSVAL_TO_BOOLEAN(JSVAL_VOID);
JSObject* obj2;
JSProperty* prop;
if (!OBJ_LOOKUP_PROPERTY(cx, obj, id, &obj2, &prop))
return JSVAL_TO_BOOLEAN(JSVAL_VOID);
if (prop)
OBJ_DROP_PROPERTY(cx, obj2, prop);
return prop != NULL;
}
jsval FASTCALL
js_CallGetter(JSContext* cx, JSObject* obj, JSScopeProperty* sprop)
{