зеркало из https://github.com/mozilla/pjs.git
Bug 598682, part 2 - Minor cleanups to jsinterp.h and jsinterpinlines.h (r=bhackett)
--HG-- extra : rebase_source : bd664d9cd752992faa280d8d3a848058883f57e4
This commit is contained in:
Родитель
35ccc0ceae
Коммит
dbd90913db
|
@ -324,8 +324,6 @@ StackSpace::pushInvokeFrame(JSContext *cx, const CallArgs &args,
|
|||
{
|
||||
JS_ASSERT(firstUnused() == args.argv() + args.argc());
|
||||
|
||||
JSStackFrame *fp = fg->regs_.fp;
|
||||
fp->setPrev(cx->regs);
|
||||
if (JS_UNLIKELY(!currentSegment->inContext())) {
|
||||
cx->pushSegmentAndFrame(currentSegment, fg->regs_);
|
||||
} else {
|
||||
|
@ -392,8 +390,6 @@ StackSpace::pushInlineFrame(JSContext *cx, JSScript *script, JSStackFrame *fp,
|
|||
JS_ASSERT(isCurrentAndActive(cx));
|
||||
JS_ASSERT(cx->regs == regs && script == fp->script());
|
||||
|
||||
fp->setPrev(regs);
|
||||
|
||||
regs->fp = fp;
|
||||
regs->pc = script->code;
|
||||
regs->sp = fp->slots() + script->nfixed;
|
||||
|
|
|
@ -830,7 +830,7 @@ Execute(JSContext *cx, JSObject *chain, JSScript *script,
|
|||
JSObject *initialVarObj;
|
||||
if (prev) {
|
||||
JS_ASSERT(chain == &prev->scopeChain());
|
||||
frame.fp()->initEvalFrame(script, prev, prev->pc(cx), flags);
|
||||
frame.fp()->initEvalFrame(cx, script, prev, flags);
|
||||
|
||||
/*
|
||||
* We want to call |prev->varobj()|, but this requires knowing the
|
||||
|
|
|
@ -137,6 +137,8 @@ struct JSStackFrame
|
|||
friend class js::FrameRegsIter;
|
||||
friend struct JSContext;
|
||||
|
||||
inline void initPrev(JSContext *cx);
|
||||
|
||||
public:
|
||||
/*
|
||||
* Stack frame sort (see JSStackFrame comment above)
|
||||
|
@ -195,8 +197,8 @@ struct JSStackFrame
|
|||
inline void initCallFrameLatePrologue();
|
||||
|
||||
/* Used for eval. */
|
||||
inline void initEvalFrame(JSScript *script, JSStackFrame *prev,
|
||||
jsbytecode *prevpc, uint32 flags);
|
||||
inline void initEvalFrame(JSContext *cx, JSScript *script, JSStackFrame *prev,
|
||||
uint32 flags);
|
||||
inline void initGlobalFrame(JSScript *script, JSObject &chain, uint32 flags);
|
||||
|
||||
/* Used when activating generators. */
|
||||
|
@ -223,27 +225,7 @@ struct JSStackFrame
|
|||
return prev_;
|
||||
}
|
||||
|
||||
void setPrev(JSStackFrame *prev, jsbytecode *prevpc) {
|
||||
JS_ASSERT(flags_ & JSFRAME_HAS_PREVPC);
|
||||
prev_ = prev;
|
||||
if (prev) {
|
||||
prevpc_ = prevpc;
|
||||
JS_ASSERT_IF(!prev->isDummyFrame() && !prev->hasImacropc(),
|
||||
uint32(prevpc - prev->script()->code) < prev->script()->length);
|
||||
}
|
||||
}
|
||||
|
||||
void setPrev(JSFrameRegs *regs) {
|
||||
JS_ASSERT(flags_ & JSFRAME_HAS_PREVPC);
|
||||
if (regs) {
|
||||
prev_ = regs->fp;
|
||||
prevpc_ = regs->pc;
|
||||
JS_ASSERT_IF(!prev_->isDummyFrame() && !prev_->hasImacropc(),
|
||||
uint32(prevpc_ - prev_->script()->code) < prev_->script()->length);
|
||||
} else {
|
||||
prev_ = NULL;
|
||||
}
|
||||
}
|
||||
inline void resetGeneratorPrev(JSContext *cx);
|
||||
|
||||
/*
|
||||
* Frame slots
|
||||
|
|
|
@ -40,6 +40,29 @@
|
|||
#ifndef jsinterpinlines_h__
|
||||
#define jsinterpinlines_h__
|
||||
|
||||
inline void
|
||||
JSStackFrame::initPrev(JSContext *cx)
|
||||
{
|
||||
JS_ASSERT(flags_ & JSFRAME_HAS_PREVPC);
|
||||
if (JSFrameRegs *regs = cx->regs) {
|
||||
prev_ = regs->fp;
|
||||
prevpc_ = regs->pc;
|
||||
JS_ASSERT_IF(!prev_->isDummyFrame() && !prev_->hasImacropc(),
|
||||
uint32(prevpc_ - prev_->script()->code) < prev_->script()->length);
|
||||
} else {
|
||||
prev_ = NULL;
|
||||
#ifdef DEBUG
|
||||
prevpc_ = (jsbytecode *)0xbadc;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
inline void
|
||||
JSStackFrame::resetGeneratorPrev(JSContext *cx)
|
||||
{
|
||||
initPrev(cx);
|
||||
}
|
||||
|
||||
inline void
|
||||
JSStackFrame::initCallFrame(JSContext *cx, JSObject &callee, JSFunction *fun,
|
||||
uint32 nactual, uint32 flagsArg)
|
||||
|
@ -54,7 +77,7 @@ JSStackFrame::initCallFrame(JSContext *cx, JSObject &callee, JSFunction *fun,
|
|||
exec.fun = fun;
|
||||
args.nactual = nactual; /* only need to write if over/under-flow */
|
||||
scopeChain_ = callee.getParent();
|
||||
/* prevpc_, prev_ initialized by push*Frame */
|
||||
initPrev(cx);
|
||||
JS_ASSERT(!hasImacropc());
|
||||
JS_ASSERT(!hasHookData());
|
||||
JS_ASSERT(annotation() == NULL);
|
||||
|
@ -89,7 +112,6 @@ JSStackFrame::initCallFrameCallerHalf(JSContext *cx, uint32 nactual, uint32 flag
|
|||
inline void
|
||||
JSStackFrame::initCallFrameEarlyPrologue(JSFunction *fun, void *ncode)
|
||||
{
|
||||
/* Initialize state that gets set early in a jitted function's prologue. */
|
||||
exec.fun = fun;
|
||||
ncode_ = ncode;
|
||||
}
|
||||
|
@ -105,8 +127,7 @@ JSStackFrame::initCallFrameLatePrologue()
|
|||
}
|
||||
|
||||
inline void
|
||||
JSStackFrame::initEvalFrame(JSScript *script, JSStackFrame *prev,
|
||||
jsbytecode *prevpc, uint32 flagsArg)
|
||||
JSStackFrame::initEvalFrame(JSContext *cx, JSScript *script, JSStackFrame *prev, uint32 flagsArg)
|
||||
{
|
||||
JS_ASSERT(flagsArg & JSFRAME_EVAL);
|
||||
JS_ASSERT((flagsArg & ~(JSFRAME_EVAL | JSFRAME_DEBUGGER)) == 0);
|
||||
|
@ -133,10 +154,12 @@ JSStackFrame::initEvalFrame(JSScript *script, JSStackFrame *prev,
|
|||
} else {
|
||||
exec.script = script;
|
||||
}
|
||||
|
||||
scopeChain_ = &prev->scopeChain();
|
||||
JS_ASSERT_IF(isFunctionFrame(), &callObj() == &prev->callObj());
|
||||
|
||||
setPrev(prev, prevpc);
|
||||
prev_ = prev;
|
||||
prevpc_ = prev->pc(cx);
|
||||
JS_ASSERT(!hasImacropc());
|
||||
JS_ASSERT(!hasHookData());
|
||||
setAnnotation(prev->annotation());
|
||||
|
@ -157,7 +180,6 @@ JSStackFrame::initGlobalFrame(JSScript *script, JSObject &chain, uint32 flagsArg
|
|||
exec.script = script;
|
||||
args.script = (JSScript *)0xbad;
|
||||
scopeChain_ = &chain;
|
||||
|
||||
prev_ = NULL;
|
||||
JS_ASSERT(!hasImacropc());
|
||||
JS_ASSERT(!hasHookData());
|
||||
|
@ -169,7 +191,7 @@ JSStackFrame::initDummyFrame(JSContext *cx, JSObject &chain)
|
|||
{
|
||||
js::PodZero(this);
|
||||
flags_ = JSFRAME_DUMMY | JSFRAME_HAS_PREVPC | JSFRAME_HAS_SCOPECHAIN;
|
||||
setPrev(cx->regs);
|
||||
initPrev(cx);
|
||||
chain.isGlobal();
|
||||
setScopeChainNoCallObj(chain);
|
||||
}
|
||||
|
|
|
@ -1271,7 +1271,7 @@ SendToGenerator(JSContext *cx, JSGeneratorOp op, JSObject *obj,
|
|||
|
||||
/* Copy frame onto the stack. */
|
||||
stackfp->stealFrameAndSlots(stackvp, genfp, genvp, gen->regs.sp);
|
||||
stackfp->setPrev(cx->regs);
|
||||
stackfp->resetGeneratorPrev(cx);
|
||||
stackfp->unsetFloatingGenerator();
|
||||
RebaseRegsFromTo(&gen->regs, genfp, stackfp);
|
||||
MUST_FLOW_THROUGH("restore");
|
||||
|
|
Загрузка…
Ссылка в новой задаче