Bug 727087 - Move JSOP_TOID implementation to jsinterpinlines. r=dvander

--HG--
extra : rebase_source : 2bcc7b7a30f613489a93cb1465a2ae6d64815f1c
This commit is contained in:
Jan de Mooij 2012-02-14 23:36:36 +01:00
Родитель 3b439ba3ee
Коммит fd8b55ef22
2 изменённых файлов: 25 добавлений и 12 удалений

Просмотреть файл

@ -2453,18 +2453,10 @@ BEGIN_CASE(JSOP_TOID)
* There must be an object value below the id, which will not be popped
* but is necessary in interning the id for XML.
*/
Value &idval = regs.sp[-1];
if (!idval.isInt32()) {
JSObject *obj;
FETCH_OBJECT(cx, -2, obj);
jsid dummy;
if (!js_InternNonIntElementId(cx, obj, idval, &dummy, &idval))
goto error;
TypeScript::MonitorUnknown(cx, script, regs.pc);
}
Value objval = regs.sp[-2];
Value idval = regs.sp[-1];
if (!ToIdOperation(cx, objval, idval, &regs.sp[-1]))
goto error;
}
END_CASE(JSOP_TOID)

Просмотреть файл

@ -703,6 +703,27 @@ FetchElementId(JSContext *cx, JSObject *obj, const Value &idval, jsid &id, Value
return !!js_InternNonIntElementId(cx, obj, idval, &id, vp);
}
static JS_ALWAYS_INLINE bool
ToIdOperation(JSContext *cx, const Value &objval, const Value &idval, Value *res)
{
if (idval.isInt32()) {
*res = idval;
return true;
}
JSObject *obj = ValueToObject(cx, objval);
if (!obj)
return false;
jsid dummy;
if (!js_InternNonIntElementId(cx, obj, idval, &dummy, res))
return false;
if (!res->isInt32())
types::TypeScript::MonitorUnknown(cx);
return true;
}
static JS_ALWAYS_INLINE bool
GetObjectElementOperation(JSContext *cx, JSObject *obj, const Value &rref, Value *res)
{