Bug 603193 - Set JSFRAME_HAS_PREVPC when activating generator (r=dvander)
authorLuke Wagner <lw@mozilla.com>
Fri, 12 Nov 2010 17:40:24 -0800
changeset 57808 5b757ec177b164b3f7d1d77d3b9043fec81ffbc2
parent 57807 eaa6114ee405754eef8306c02615897d0cb3c091
child 57809 95f3ef09d58ee2b8c146b4a7936cc2f430e1caf1
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersdvander
bugs603193
milestone2.0b8pre
Bug 603193 - Set JSFRAME_HAS_PREVPC when activating generator (r=dvander)
js/src/jit-test/tests/basic/testBug603193.js
js/src/jsinterpinlines.h
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/basic/testBug603193.js
@@ -0,0 +1,12 @@
+function g(code) {
+  f = Function(code);
+  for (a in f()) {}
+}
+
+/* Get call ic in a state to call CompileFunction for new functions. */
+g()
+g("(function(){})")
+g()
+
+/* Call generator with frame created by call ic + CompileFunction. */
+g("yield")
--- a/js/src/jsinterpinlines.h
+++ b/js/src/jsinterpinlines.h
@@ -64,16 +64,17 @@ JSStackFrame::initPrev(JSContext *cx)
         prevpc_ = (jsbytecode *)0xbadc;
 #endif
     }
 }
 
 inline void
 JSStackFrame::resetGeneratorPrev(JSContext *cx)
 {
+    flags_ |= JSFRAME_HAS_PREVPC;
     initPrev(cx);
 }
 
 inline void
 JSStackFrame::initCallFrame(JSContext *cx, JSObject &callee, JSFunction *fun,
                             uint32 nactual, uint32 flagsArg)
 {
     JS_ASSERT((flagsArg & ~(JSFRAME_CONSTRUCTING |