Support non-flat strings in Any_getelem and Any_setelem.

This commit is contained in:
Andreas Gal 2008-08-11 16:12:52 -07:00
parent 80ab94547d
commit b6bc18350b
2 changed files with 5 additions and 1 deletions

View File

@ -222,7 +222,7 @@ CPPSRCS += \
ifdef DEBUG
EXPORTS += nanojit/TraceTreeDrawer.h
CPPSRCS += nanojit/TraceTreeDrawer.cpp nanojit/Tests.cpp
CPPSRCS += nanojit/TraceTreeDrawer.cpp
endif
DEFINES += -DFEATURE_NANOJIT -DJS_TRACER

View File

@ -302,6 +302,8 @@ jsval FASTCALL
js_Any_getelem(JSContext* cx, JSObject* obj, JSString* idstr)
{
jsval v;
if (!JSSTRING_IS_FLAT(idstr) && !js_UndependString(cx, idstr))
return JSVAL_ERROR_COOKIE;
if (!OBJ_GET_PROPERTY(cx, obj, ATOM_TO_JSID(STRING_TO_JSVAL(idstr)), &v))
return JSVAL_ERROR_COOKIE;
return v;
@ -310,6 +312,8 @@ js_Any_getelem(JSContext* cx, JSObject* obj, JSString* idstr)
bool FASTCALL
js_Any_setelem(JSContext* cx, JSObject* obj, JSString* idstr, jsval v)
{
if (!JSSTRING_IS_FLAT(idstr) && !js_UndependString(cx, idstr))
return false;
return OBJ_SET_PROPERTY(cx, obj, ATOM_TO_JSID(STRING_TO_JSVAL(idstr)), &v);
}