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
parent e2b9bb5001
commit 02c5104da9
2 changed files with 25 additions and 12 deletions

View File

@ -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)

View File

@ -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)
{