From bb6551c9b12a9f14d466bf9ee9702ace1ceeb18d Mon Sep 17 00:00:00 2001 From: "igor.bukanov%gmail.com" Date: Wed, 20 Sep 2006 14:50:43 +0000 Subject: [PATCH] Allow to compile and run SM when !JS_HAS_GENERATORS. bug=347065 r=brendan --- js/src/jsinterp.c | 4 +--- js/src/jsiter.c | 8 ++------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/js/src/jsinterp.c b/js/src/jsinterp.c index 272eeab3c7c2..8df1b01e4f8b 100644 --- a/js/src/jsinterp.c +++ b/js/src/jsinterp.c @@ -6097,7 +6097,6 @@ interrupt: #undef FAST_LOCAL_INCREMENT_OP -#if JS_HAS_GENERATORS BEGIN_CASE(JSOP_STARTITER) /* * Start of a for-in or for-each-in loop: push two nulls. Push @@ -6130,6 +6129,7 @@ interrupt: sp -= 3; END_CASE(JSOP_ENDITER) +#if JS_HAS_GENERATORS BEGIN_CASE(JSOP_GENERATOR) pc += JSOP_GENERATOR_LENGTH; SAVE_SP_AND_PC(fp); @@ -6187,8 +6187,6 @@ interrupt: #endif /* JS_HAS_GENERATORS */ #if !JS_HAS_GENERATORS - L_JSOP_STARTITER: - L_JSOP_ENDITER: L_JSOP_GENERATOR: L_JSOP_YIELD: L_JSOP_ARRAYPUSH: diff --git a/js/src/jsiter.c b/js/src/jsiter.c index ab3fb90e327e..1bf78d13d199 100644 --- a/js/src/jsiter.c +++ b/js/src/jsiter.c @@ -121,8 +121,6 @@ JSClass js_IteratorClass = { JSCLASS_NO_OPTIONAL_MEMBERS }; -#if JS_HAS_GENERATORS - static JSBool Iterator(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { @@ -285,8 +283,6 @@ static JSFunctionSpec iterator_methods[] = { {0,0,0,0,0} }; -#endif /* JS_HAS_GENERATORS */ - JSBool js_NewNativeIterator(JSContext *cx, JSObject *obj, uintN flags, jsval *vp) { @@ -958,14 +954,14 @@ js_InitIteratorClasses(JSContext *cx, JSObject *obj) if (stop) return stop; -#if JS_HAS_GENERATORS - /* Expose Iterator and initialize the generator internals if configured. */ proto = JS_InitClass(cx, obj, NULL, &js_IteratorClass, Iterator, 2, NULL, iterator_methods, NULL, NULL); if (!proto) return NULL; proto->slots[JSSLOT_ITER_STATE] = JSVAL_NULL; +#if JS_HAS_GENERATORS + /* Initialize the generator internals if configured. */ if (!JS_InitClass(cx, obj, NULL, &js_GeneratorClass, NULL, 0, NULL, generator_methods, NULL, NULL)) { return NULL;