Merge TM -> JM
This commit is contained in:
@@ -65,6 +65,7 @@
|
||||
#include "jsobj.h"
|
||||
#include "jsopcode.h"
|
||||
#include "jsproxy.h"
|
||||
#include "jsscan.h"
|
||||
#include "jsscope.h"
|
||||
#include "jsscript.h"
|
||||
#include "jsstaticcheck.h"
|
||||
@@ -74,13 +75,13 @@
|
||||
#include "jsxml.h"
|
||||
#endif
|
||||
|
||||
#include "jscntxtinlines.h"
|
||||
#include "jsinferinlines.h"
|
||||
#include "jsinterpinlines.h"
|
||||
#include "jsobjinlines.h"
|
||||
#include "jsstrinlines.h"
|
||||
#include "jsautooplen.h"
|
||||
|
||||
#include "vm/Stack-inl.h"
|
||||
|
||||
using namespace js;
|
||||
using namespace js::gc;
|
||||
using namespace js::types;
|
||||
@@ -1103,7 +1104,7 @@ generator_trace(JSTracer *trc, JSObject *obj)
|
||||
if (gen->state == JSGEN_RUNNING || gen->state == JSGEN_CLOSING)
|
||||
return;
|
||||
|
||||
JSStackFrame *fp = gen->floatingFrame();
|
||||
StackFrame *fp = gen->floatingFrame();
|
||||
JS_ASSERT(gen->liveFrame() == fp);
|
||||
|
||||
/*
|
||||
@@ -1146,17 +1147,10 @@ Class js_GeneratorClass = {
|
||||
}
|
||||
};
|
||||
|
||||
static inline void
|
||||
RebaseRegsFromTo(JSFrameRegs *regs, JSStackFrame *from, JSStackFrame *to)
|
||||
{
|
||||
regs->fp = to;
|
||||
regs->sp = to->slots() + (regs->sp - from->slots());
|
||||
}
|
||||
|
||||
/*
|
||||
* Called from the JSOP_GENERATOR case in the interpreter, with fp referring
|
||||
* to the frame by which the generator function was activated. Create a new
|
||||
* JSGenerator object, which contains its own JSStackFrame that we populate
|
||||
* JSGenerator object, which contains its own StackFrame that we populate
|
||||
* from *fp. We know that upon return, the JSOP_GENERATOR opcode will return
|
||||
* from the activation in fp, so we can steal away fp->callobj and fp->argsobj
|
||||
* if they are non-null.
|
||||
@@ -1168,8 +1162,8 @@ js_NewGenerator(JSContext *cx)
|
||||
if (!obj)
|
||||
return NULL;
|
||||
|
||||
JSStackFrame *stackfp = cx->fp();
|
||||
JS_ASSERT(stackfp->base() == cx->regs->sp);
|
||||
StackFrame *stackfp = cx->fp();
|
||||
JS_ASSERT(stackfp->base() == cx->regs().sp);
|
||||
JS_ASSERT(stackfp->actualArgs() <= stackfp->formalArgs());
|
||||
|
||||
/* Load and compute stack slot counts. */
|
||||
@@ -1189,7 +1183,7 @@ js_NewGenerator(JSContext *cx)
|
||||
|
||||
/* Cut up floatingStack space. */
|
||||
Value *genvp = gen->floatingStack;
|
||||
JSStackFrame *genfp = reinterpret_cast<JSStackFrame *>(genvp + vplen);
|
||||
StackFrame *genfp = reinterpret_cast<StackFrame *>(genvp + vplen);
|
||||
|
||||
/* Initialize JSGenerator. */
|
||||
gen->obj = obj;
|
||||
@@ -1198,11 +1192,11 @@ js_NewGenerator(JSContext *cx)
|
||||
gen->floating = genfp;
|
||||
|
||||
/* Initialize regs stored in generator. */
|
||||
gen->regs = *cx->regs;
|
||||
RebaseRegsFromTo(&gen->regs, stackfp, genfp);
|
||||
gen->regs = cx->regs();
|
||||
gen->regs.rebaseFromTo(stackfp, genfp);
|
||||
|
||||
/* Copy frame off the stack. */
|
||||
genfp->stealFrameAndSlots(genvp, stackfp, stackvp, cx->regs->sp);
|
||||
genfp->stealFrameAndSlots(genvp, stackfp, stackvp, cx->regs().sp);
|
||||
genfp->initFloatingGenerator();
|
||||
|
||||
obj->setPrivate(gen);
|
||||
@@ -1210,7 +1204,7 @@ js_NewGenerator(JSContext *cx)
|
||||
}
|
||||
|
||||
JSGenerator *
|
||||
js_FloatingFrameToGenerator(JSStackFrame *fp)
|
||||
js_FloatingFrameToGenerator(StackFrame *fp)
|
||||
{
|
||||
JS_ASSERT(fp->isGeneratorFrame() && fp->isFloatingGenerator());
|
||||
char *floatingStackp = (char *)(fp->actualArgs() - 2);
|
||||
@@ -1278,11 +1272,11 @@ SendToGenerator(JSContext *cx, JSGeneratorOp op, JSObject *obj,
|
||||
break;
|
||||
}
|
||||
|
||||
JSStackFrame *genfp = gen->floatingFrame();
|
||||
StackFrame *genfp = gen->floatingFrame();
|
||||
Value *genvp = gen->floatingStack;
|
||||
uintN vplen = genfp->formalArgsEnd() - genvp;
|
||||
|
||||
JSStackFrame *stackfp;
|
||||
StackFrame *stackfp;
|
||||
Value *stackvp;
|
||||
JSBool ok;
|
||||
{
|
||||
@@ -1291,7 +1285,7 @@ SendToGenerator(JSContext *cx, JSGeneratorOp op, JSObject *obj,
|
||||
* the code before pushExecuteFrame must not reenter the interpreter.
|
||||
*/
|
||||
GeneratorFrameGuard frame;
|
||||
if (!cx->stack().getGeneratorFrame(cx, vplen, genfp->numSlots(), &frame)) {
|
||||
if (!cx->stack.getGeneratorFrame(cx, vplen, genfp->numSlots(), &frame)) {
|
||||
gen->state = JSGEN_CLOSED;
|
||||
return JS_FALSE;
|
||||
}
|
||||
@@ -1302,11 +1296,11 @@ SendToGenerator(JSContext *cx, JSGeneratorOp op, JSObject *obj,
|
||||
stackfp->stealFrameAndSlots(stackvp, genfp, genvp, gen->regs.sp);
|
||||
stackfp->resetGeneratorPrev(cx);
|
||||
stackfp->unsetFloatingGenerator();
|
||||
RebaseRegsFromTo(&gen->regs, genfp, stackfp);
|
||||
gen->regs.rebaseFromTo(genfp, stackfp);
|
||||
MUST_FLOW_THROUGH("restore");
|
||||
|
||||
/* Officially push frame. frame's destructor pops. */
|
||||
cx->stack().pushGeneratorFrame(cx, &gen->regs, &frame);
|
||||
cx->stack.pushGeneratorFrame(gen->regs, &frame);
|
||||
|
||||
cx->enterGenerator(gen); /* OOM check above. */
|
||||
JSObject *enumerators = cx->enumerators;
|
||||
@@ -1326,7 +1320,7 @@ SendToGenerator(JSContext *cx, JSGeneratorOp op, JSObject *obj,
|
||||
genfp->setFloatingGenerator();
|
||||
}
|
||||
MUST_FLOW_LABEL(restore)
|
||||
RebaseRegsFromTo(&gen->regs, stackfp, genfp);
|
||||
gen->regs.rebaseFromTo(stackfp, genfp);
|
||||
|
||||
if (gen->floatingFrame()->isYielding()) {
|
||||
/* Yield cannot fail, throw or be called on closing. */
|
||||
|
||||
Reference in New Issue
Block a user