Remove redundant type checking in iterator opcode.

This commit is contained in:
Tor Andersson
2015-01-08 14:16:30 +01:00
parent b005928523
commit cb6facdf9c

21
jsrun.c
View File

@@ -207,12 +207,6 @@ int js_isregexp(js_State *J, int idx)
return v->type == JS_TOBJECT && v->u.object->type == JS_CREGEXP;
}
static int js_isiterator(js_State *J, int idx)
{
js_Value *v = stackidx(J, idx);
return v->type == JS_TOBJECT && v->u.object->type == JS_CITERATOR;
}
int js_isuserdata(js_State *J, int idx, const char *tag)
{
js_Value *v = stackidx(J, idx);
@@ -1328,16 +1322,11 @@ static void jsR_run(js_State *J, js_Function *F)
break;
case OP_NEXTITER:
if (js_isiterator(J, -1)) {
obj = js_toobject(J, -1);
str = jsV_nextiterator(J, obj);
if (str) {
js_pushliteral(J, str);
js_pushboolean(J, 1);
} else {
js_pop(J, 1);
js_pushboolean(J, 0);
}
obj = js_toobject(J, -1);
str = jsV_nextiterator(J, obj);
if (str) {
js_pushliteral(J, str);
js_pushboolean(J, 1);
} else {
js_pop(J, 1);
js_pushboolean(J, 0);