shithub: libmujs

Download patch

ref: cb6facdf9ccf7f39c5689e6b8e5366b63d984df0
parent: b005928523d2427f8b1daac093c259ab53dba3e9
author: Tor Andersson <tor.andersson@artifex.com>
date: Thu Jan 8 09:16:30 EST 2015

Remove redundant type checking in iterator opcode.

--- a/jsrun.c
+++ b/jsrun.c
@@ -207,12 +207,6 @@
 	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 @@
 			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);