Bug 984836 - Rename StackFrame to InterpreterFrame. r=luke

This commit is contained in:
Jan de Mooij 2014-03-19 09:28:57 +01:00
parent b34af3c7e4
commit 7a97b6b078
43 changed files with 314 additions and 310 deletions

View File

@ -23,7 +23,7 @@ class JSAtom;
class JSFreeOp;
namespace js {
class StackFrame;
class InterpreterFrame;
class ScriptFrameIter;
}
@ -94,7 +94,7 @@ FormatStackDump(JSContext *cx, char *buf, bool showArgs, bool showLocals, bool s
# ifdef JS_DEBUG
JS_FRIEND_API(void) js_DumpValue(const JS::Value &val);
JS_FRIEND_API(void) js_DumpId(jsid id);
JS_FRIEND_API(void) js_DumpStackFrame(JSContext *cx, js::StackFrame *start = nullptr);
JS_FRIEND_API(void) js_DumpInterpreterFrame(JSContext *cx, js::InterpreterFrame *start = nullptr);
# endif
JS_FRIEND_API(void)

View File

@ -260,7 +260,7 @@ EvalKernel(JSContext *cx, const CallArgs &args, EvalType evalType, AbstractFrame
unsigned staticLevel;
RootedValue thisv(cx);
if (evalType == DIRECT_EVAL) {
JS_ASSERT_IF(caller.isStackFrame(), !caller.asStackFrame()->runningInJit());
JS_ASSERT_IF(caller.isInterpreterFrame(), !caller.asInterpreterFrame()->runningInJit());
staticLevel = caller.script()->staticLevel() + 1;
// Direct calls to eval are supposed to see the caller's |this|. If we

View File

@ -151,7 +151,7 @@ BaselineFrame::initFunctionScopeObjects(JSContext *cx)
}
bool
BaselineFrame::initForOsr(StackFrame *fp, uint32_t numStackValues)
BaselineFrame::initForOsr(InterpreterFrame *fp, uint32_t numStackValues)
{
mozilla::PodZero(this);
@ -192,8 +192,8 @@ BaselineFrame::initForOsr(StackFrame *fp, uint32_t numStackValues)
JSContext *cx = GetJSContextFromJitCode();
if (cx->compartment()->debugMode()) {
// In debug mode, update any Debugger.Frame objects for the StackFrame to
// point to the BaselineFrame.
// In debug mode, update any Debugger.Frame objects for the
// InterpreterFrame to point to the BaselineFrame.
// The caller pushed a fake return address. ScriptFrameIter, used by the
// debugger, wants a valid return address, but it's okay to just pick one.

View File

@ -26,7 +26,7 @@ namespace jit {
// Eval frames
//
// Like js::StackFrame, every BaselineFrame is either a global frame
// Like js::InterpreterFrame, every BaselineFrame is either a global frame
// or a function frame. Both global and function frames can optionally
// be "eval frames". The callee token for eval function frames is the
// enclosing function. BaselineFrame::evalScript_ stores the eval script
@ -35,7 +35,7 @@ class BaselineFrame
{
public:
enum Flags {
// The frame has a valid return value. See also StackFrame::HAS_RVAL.
// The frame has a valid return value. See also InterpreterFrame::HAS_RVAL.
HAS_RVAL = 1 << 0,
// A call object has been pushed on the scope chain.
@ -44,7 +44,7 @@ class BaselineFrame
// Frame has an arguments object, argsObj_.
HAS_ARGS_OBJ = 1 << 4,
// See StackFrame::PREV_UP_TO_DATE.
// See InterpreterFrame::PREV_UP_TO_DATE.
PREV_UP_TO_DATE = 1 << 5,
// Eval frame, see the "eval frames" comment.
@ -82,7 +82,7 @@ class BaselineFrame
// This is the old frame pointer saved in the prologue.
static const uint32_t FramePointerOffset = sizeof(void *);
bool initForOsr(StackFrame *fp, uint32_t numStackValues);
bool initForOsr(InterpreterFrame *fp, uint32_t numStackValues);
uint32_t frameSize() const {
return frameSize_;

View File

@ -947,7 +947,7 @@ DoUseCountFallback(JSContext *cx, ICUseCount_Fallback *stub, BaselineFrame *fram
if (!jitcode)
return true;
// Prepare the temporary heap copy of the fake StackFrame and actual args list.
// Prepare the temporary heap copy of the fake InterpreterFrame and actual args list.
IonSpew(IonSpew_BaselineOSR, "Got jitcode. Preparing for OSR into ion.");
IonOsrTempData *info = PrepareOsrTempData(cx, stub, frame, script, pc, jitcode);
if (!info)

View File

@ -55,7 +55,7 @@ static const size_t BASELINE_LIFO_ALLOC_PRIMARY_CHUNK_SIZE = 4096;
static const unsigned BASELINE_MAX_ARGS_LENGTH = 20000;
static bool
CheckFrame(StackFrame *fp)
CheckFrame(InterpreterFrame *fp)
{
if (fp->isGeneratorFrame()) {
IonSpew(IonSpew_BaselineAbort, "generator frame");
@ -159,7 +159,7 @@ jit::EnterBaselineMethod(JSContext *cx, RunState &state)
}
IonExecStatus
jit::EnterBaselineAtBranch(JSContext *cx, StackFrame *fp, jsbytecode *pc)
jit::EnterBaselineAtBranch(JSContext *cx, InterpreterFrame *fp, jsbytecode *pc)
{
JS_ASSERT(JSOp(*pc) == JSOP_LOOPENTRY);
@ -301,7 +301,7 @@ CanEnterBaselineJIT(JSContext *cx, HandleScript script, bool osr)
}
MethodStatus
jit::CanEnterBaselineAtBranch(JSContext *cx, StackFrame *fp, bool newType)
jit::CanEnterBaselineAtBranch(JSContext *cx, InterpreterFrame *fp, bool newType)
{
// If constructing, allocate a new |this| object.
if (fp->isConstructing() && fp->functionThis().isPrimitive()) {

View File

@ -319,13 +319,13 @@ MethodStatus
CanEnterBaselineMethod(JSContext *cx, RunState &state);
MethodStatus
CanEnterBaselineAtBranch(JSContext *cx, StackFrame *fp, bool newType);
CanEnterBaselineAtBranch(JSContext *cx, InterpreterFrame *fp, bool newType);
IonExecStatus
EnterBaselineMethod(JSContext *cx, RunState &state);
IonExecStatus
EnterBaselineAtBranch(JSContext *cx, StackFrame *fp, jsbytecode *pc);
EnterBaselineAtBranch(JSContext *cx, InterpreterFrame *fp, jsbytecode *pc);
void
FinishDiscardBaselineScript(FreeOp *fop, JSScript *script);

View File

@ -2402,7 +2402,7 @@ jit::SetEnterJitData(JSContext *cx, EnterJitData &data, RunState &state, AutoVal
data.calleeToken = CalleeToToken(state.script());
if (state.script()->isForEval() &&
!(state.asExecute()->type() & StackFrame::GLOBAL))
!(state.asExecute()->type() & InterpreterFrame::GLOBAL))
{
ScriptFrameIter iter(cx);
if (iter.isFunctionFrame())

View File

@ -25,7 +25,7 @@ namespace jit {
enum FrameType
{
// A JS frame is analagous to a js::StackFrame, representing one scripted
// A JS frame is analagous to a js::InterpreterFrame, representing one scripted
// functon activation. OptimizedJS frames are used by the optimizing compiler.
IonFrame_OptimizedJS,
@ -63,7 +63,7 @@ enum FrameType
// An OSR frame is added when performing OSR from within a bailout. It
// looks like a JS frame, but does not push scripted arguments, as OSR
// reads arguments from a js::StackFrame.
// reads arguments from a BaselineFrame.
IonFrame_Osr
};

View File

@ -38,7 +38,7 @@ struct EnterJitData
{}
uint8_t *jitcode;
StackFrame *osrFrame;
InterpreterFrame *osrFrame;
void *calleeToken;
@ -53,7 +53,7 @@ struct EnterJitData
bool constructing;
};
typedef void (*EnterJitCode)(void *code, unsigned argc, Value *argv, StackFrame *fp,
typedef void (*EnterJitCode)(void *code, unsigned argc, Value *argv, InterpreterFrame *fp,
CalleeToken calleeToken, JSObject *scopeChain,
size_t numStackValues, Value *vp);

View File

@ -3155,7 +3155,7 @@ class LStart : public LInstructionHelper<0, 0, 0>
LIR_HEADER(Start)
};
// Passed the StackFrame address in the OsrFrameReg by SideCannon().
// Passed the BaselineFrame address in the OsrFrameReg by SideCannon().
// Forwards this object to the LOsrValues for Value materialization.
class LOsrEntry : public LInstructionHelper<1, 0, 0>
{

View File

@ -134,7 +134,7 @@ typedef InlineList<MUse>::iterator MUseIterator;
// A node is an entry in the MIR graph. It has two kinds:
// MInstruction: an instruction which appears in the IR stream.
// MResumePoint: a list of instructions that correspond to the state of the
// interpreter stack.
// interpreter/Baseline stack.
//
// Nodes can hold references to MDefinitions. Each MDefinition has a list of
// nodes holding such a reference (its use chain).
@ -4619,7 +4619,7 @@ class MBeta : public MUnaryInstruction
void computeRange(TempAllocator &alloc);
};
// MIR representation of a Value on the OSR StackFrame.
// MIR representation of a Value on the OSR BaselineFrame.
// The Value is indexed off of OsrFrameReg.
class MOsrValue : public MUnaryInstruction
{
@ -4652,7 +4652,7 @@ class MOsrValue : public MUnaryInstruction
}
};
// MIR representation of a JSObject scope chain pointer on the OSR StackFrame.
// MIR representation of a JSObject scope chain pointer on the OSR BaselineFrame.
// The pointer is indexed off of OsrFrameReg.
class MOsrScopeChain : public MUnaryInstruction
{
@ -4674,7 +4674,7 @@ class MOsrScopeChain : public MUnaryInstruction
}
};
// MIR representation of a JSObject ArgumentsObject pointer on the OSR StackFrame.
// MIR representation of a JSObject ArgumentsObject pointer on the OSR BaselineFrame.
// The pointer is indexed off of OsrFrameReg.
class MOsrArgumentsObject : public MUnaryInstruction
{
@ -4696,7 +4696,7 @@ class MOsrArgumentsObject : public MUnaryInstruction
}
};
// MIR representation of the return value on the OSR StackFrame.
// MIR representation of the return value on the OSR BaselineFrame.
// The Value is indexed off of OsrFrameReg.
class MOsrReturnValue : public MUnaryInstruction
{
@ -9197,7 +9197,7 @@ class MNewDenseArrayPar : public MBinaryInstruction
}
};
// A resume point contains the information needed to reconstruct the interpreter
// A resume point contains the information needed to reconstruct the Baseline
// state from a position in the JIT. See the big comment near resumeAfter() in
// IonBuilder.cpp.
class MResumePoint MOZ_FINAL : public MNode, public InlineForwardListNode<MResumePoint>

View File

@ -11,7 +11,7 @@
namespace js {
class StackFrame;
class InterpreterFrame;
namespace jit {

View File

@ -941,7 +941,8 @@ LeaveWith(JSContext *cx, BaselineFrame *frame)
}
bool
InitBaselineFrameForOsr(BaselineFrame *frame, StackFrame *interpFrame, uint32_t numStackValues)
InitBaselineFrameForOsr(BaselineFrame *frame, InterpreterFrame *interpFrame,
uint32_t numStackValues)
{
return frame->initForOsr(interpFrame, numStackValues);
}

View File

@ -665,7 +665,7 @@ bool PushBlockScope(JSContext *cx, BaselineFrame *frame, Handle<StaticBlockObjec
bool PopBlockScope(JSContext *cx, BaselineFrame *frame);
bool DebugLeaveBlock(JSContext *cx, BaselineFrame *frame, jsbytecode *pc);
bool InitBaselineFrameForOsr(BaselineFrame *frame, StackFrame *interpFrame,
bool InitBaselineFrameForOsr(BaselineFrame *frame, InterpreterFrame *interpFrame,
uint32_t numStackValues);
JSObject *CreateDerivedTypedObj(JSContext *cx, HandleObject descr,

View File

@ -99,7 +99,7 @@ struct EnterJITStack
/*
* This method generates a trampoline for a c++ function with the following
* signature:
* void enter(void *code, int argc, Value *argv, StackFrame *fp, CalleeToken
* void enter(void *code, int argc, Value *argv, InterpreterFrame *fp, CalleeToken
* calleeToken, JSObject *scopeChain, Value *vp)
* ...using standard EABI calling convention
*/
@ -263,7 +263,7 @@ JitRuntime::generateEnterJIT(JSContext *cx, EnterJitType type)
masm.setupUnalignedABICall(3, scratch);
masm.passABIArg(r11); // BaselineFrame
masm.passABIArg(OsrFrameReg); // StackFrame
masm.passABIArg(OsrFrameReg); // InterpreterFrame
masm.passABIArg(numStackValues);
masm.callWithABI(JS_FUNC_TO_DATA_PTR(void *, jit::InitBaselineFrameForOsr));

View File

@ -213,7 +213,7 @@ JitRuntime::generateEnterJIT(JSContext *cx, EnterJitType type)
masm.setupUnalignedABICall(3, scratch);
masm.passABIArg(framePtr); // BaselineFrame
masm.passABIArg(OsrFrameReg); // StackFrame
masm.passABIArg(OsrFrameReg); // InterpreterFrame
masm.passABIArg(numStackValues);
masm.callWithABI(JS_FUNC_TO_DATA_PTR(void *, jit::InitBaselineFrameForOsr));

View File

@ -123,7 +123,7 @@ JitRuntime::generateEnterJIT(JSContext *cx, EnterJitType type)
// Push the callee token.
masm.push(Operand(ebp, ARG_CALLEETOKEN));
// Load the StackFrame address into the OsrFrameReg.
// Load the InterpreterFrame address into the OsrFrameReg.
// This address is also used for setting the constructing bit on all paths.
masm.loadPtr(Address(ebp, ARG_STACKFRAME), OsrFrameReg);
@ -203,7 +203,7 @@ JitRuntime::generateEnterJIT(JSContext *cx, EnterJitType type)
masm.setupUnalignedABICall(3, scratch);
masm.passABIArg(framePtr); // BaselineFrame
masm.passABIArg(OsrFrameReg); // StackFrame
masm.passABIArg(OsrFrameReg); // InterpreterFrame
masm.passABIArg(numStackValues);
masm.callWithABI(JS_FUNC_TO_DATA_PTR(void *, jit::InitBaselineFrameForOsr));

View File

@ -1352,7 +1352,7 @@ JS::AutoCheckRequestDepth::~AutoCheckRequestDepth()
#endif
#ifdef JS_CRASH_DIAGNOSTICS
void CompartmentChecker::check(StackFrame *fp)
void CompartmentChecker::check(InterpreterFrame *fp)
{
if (fp)
check(fp->scopeChain());

View File

@ -320,7 +320,7 @@ class ExclusiveContext : public ThreadSafeContext
/*
* "Entering" a compartment changes cx->compartment (which changes
* cx->global). Note that this does not push any StackFrame which means
* cx->global). Note that this does not push any InterpreterFrame which means
* that it is possible for cx->fp()->compartment() != cx->compartment.
* This is not a problem since, in general, most places in the VM cannot
* know that they were called from script (e.g., they may have been called
@ -515,7 +515,7 @@ struct JSContext : public js::ExclusiveContext,
bool currentlyRunningInJit() const {
return mainThread().activation()->isJit();
}
js::StackFrame *interpreterFrame() const {
js::InterpreterFrame *interpreterFrame() const {
return mainThread().activation()->asInterpreter()->current();
}
js::InterpreterRegs &interpreterRegs() const {

View File

@ -142,7 +142,7 @@ class CompartmentChecker
check(script->compartment());
}
void check(StackFrame *fp);
void check(InterpreterFrame *fp);
void check(AbstractFramePtr frame);
};
#endif /* JS_CRASH_DIAGNOSTICS */
@ -480,7 +480,7 @@ JSContext::currentScript(jsbytecode **ppc,
JS_ASSERT(act->isInterpreter());
js::StackFrame *fp = act->asInterpreter()->current();
js::InterpreterFrame *fp = act->asInterpreter()->current();
JS_ASSERT(!fp->runningInJit());
JSScript *script = fp->script();

View File

@ -2169,7 +2169,7 @@ js::SetMarkStackLimit(JSRuntime *rt, size_t limit)
}
void
js::MarkCompartmentActive(StackFrame *fp)
js::MarkCompartmentActive(InterpreterFrame *fp)
{
fp->script()->compartment()->zone()->active = true;
}

View File

@ -703,10 +703,10 @@ js_FinishGC(JSRuntime *rt);
namespace js {
class StackFrame;
class InterpreterFrame;
extern void
MarkCompartmentActive(js::StackFrame *fp);
MarkCompartmentActive(js::InterpreterFrame *fp);
extern void
TraceRuntime(JSTracer *trc);

View File

@ -1471,7 +1471,7 @@ FinalizeGenerator(FreeOp *fop, JSObject *obj)
gen->state == JSGEN_OPEN);
// If gen->state is JSGEN_CLOSED, gen->fp may be nullptr.
if (gen->fp)
JS_POISON(gen->fp, JS_FREE_PATTERN, sizeof(StackFrame));
JS_POISON(gen->fp, JS_FREE_PATTERN, sizeof(InterpreterFrame));
JS_POISON(gen, JS_FREE_PATTERN, sizeof(JSGenerator));
fop->free_(gen);
}
@ -1566,7 +1566,7 @@ GeneratorState::~GeneratorState()
cx_->leaveGenerator(gen_);
}
StackFrame *
InterpreterFrame *
GeneratorState::pushInterpreterFrame(JSContext *cx)
{
/*
@ -1639,7 +1639,7 @@ const Class StarGeneratorObject::class_ = {
/*
* 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 StackFrame that we populate
* JSGenerator object, which contains its own InterpreterFrame 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.
@ -1648,7 +1648,7 @@ JSObject *
js_NewGenerator(JSContext *cx, const InterpreterRegs &stackRegs)
{
JS_ASSERT(stackRegs.stackDepth() == 0);
StackFrame *stackfp = stackRegs.fp();
InterpreterFrame *stackfp = stackRegs.fp();
JS_ASSERT(stackfp->script()->isGenerator());
@ -1690,7 +1690,7 @@ js_NewGenerator(JSContext *cx, const InterpreterRegs &stackRegs)
stackfp->script()->nslots()) * sizeof(HeapValue);
JS_ASSERT(nbytes % sizeof(Value) == 0);
JS_STATIC_ASSERT(sizeof(StackFrame) % sizeof(HeapValue) == 0);
JS_STATIC_ASSERT(sizeof(InterpreterFrame) % sizeof(HeapValue) == 0);
JSGenerator *gen = (JSGenerator *) cx->calloc_(nbytes);
if (!gen)
@ -1700,7 +1700,7 @@ js_NewGenerator(JSContext *cx, const InterpreterRegs &stackRegs)
HeapValue *genvp = gen->stackSnapshot;
SetValueRangeToUndefined((Value *)genvp, vplen);
StackFrame *genfp = reinterpret_cast<StackFrame *>(genvp + vplen);
InterpreterFrame *genfp = reinterpret_cast<InterpreterFrame *>(genvp + vplen);
/* Initialize JSGenerator. */
gen->obj.init(obj);
@ -1710,7 +1710,7 @@ js_NewGenerator(JSContext *cx, const InterpreterRegs &stackRegs)
/* Copy from the stack to the generator's floating frame. */
gen->regs.rebaseFromTo(stackRegs, *genfp);
genfp->copyFrameAndValues<StackFrame::DoPostBarrier>(cx, (Value *)genvp, stackfp,
genfp->copyFrameAndValues<InterpreterFrame::DoPostBarrier>(cx, (Value *)genvp, stackfp,
stackvp, stackRegs.sp);
genfp->setSuspended();
obj->setPrivate(gen);

View File

@ -241,12 +241,12 @@ enum JSGeneratorState
struct JSGenerator
{
js::HeapPtrObject obj;
JSGeneratorState state;
js::InterpreterRegs regs;
JSGenerator *prevGenerator;
js::StackFrame *fp;
js::HeapValue stackSnapshot[1];
js::HeapPtrObject obj;
JSGeneratorState state;
js::InterpreterRegs regs;
JSGenerator *prevGenerator;
js::InterpreterFrame *fp;
js::HeapValue stackSnapshot[1];
};
extern JSObject *

View File

@ -5813,7 +5813,7 @@ MaybeDumpValue(const char *name, const Value &v)
}
JS_FRIEND_API(void)
js_DumpStackFrame(JSContext *cx, StackFrame *start)
js_DumpInterpreterFrame(JSContext *cx, InterpreterFrame *start)
{
/* This should only called during live debugging. */
ScriptFrameIter i(cx, ScriptFrameIter::GO_THROUGH_SAVED);
@ -5837,7 +5837,7 @@ js_DumpStackFrame(JSContext *cx, StackFrame *start)
if (i.isJit())
fprintf(stderr, "JIT frame\n");
else
fprintf(stderr, "StackFrame at %p\n", (void *) i.interpFrame());
fprintf(stderr, "InterpreterFrame at %p\n", (void *) i.interpFrame());
if (i.isFunctionFrame()) {
fprintf(stderr, "callee fun: ");

View File

@ -297,7 +297,7 @@ class JSObject : public js::ObjectImpl
return setFlag(cx, js::BaseShape::WATCHED, GENERATE_SHAPE);
}
/* See StackFrame::varObj. */
/* See InterpreterFrame::varObj. */
inline bool isVarObj();
bool setVarObj(js::ExclusiveContext *cx) {
return setFlag(cx, js::BaseShape::VAROBJ);

View File

@ -1427,7 +1427,7 @@ namespace {
struct ExpressionDecompiler
{
JSContext *cx;
StackFrame *fp;
InterpreterFrame *fp;
RootedScript script;
RootedFunction fun;
BindingVector *localNames;
@ -1759,7 +1759,7 @@ DecompileExpressionFromStack(JSContext *cx, int spindex, int skipStackHits, Hand
#ifdef JS_MORE_DETERMINISTIC
/*
* Give up if we need deterministic behavior for differential testing.
* IonMonkey doesn't use StackFrames and this ensures we get the same
* IonMonkey doesn't use InterpreterFrames and this ensures we get the same
* error messages.
*/
return true;

View File

@ -2669,7 +2669,7 @@ js::PCToLineNumber(unsigned startLine, jssrcnote *notes, jsbytecode *code, jsbyt
unsigned
js::PCToLineNumber(JSScript *script, jsbytecode *pc, unsigned *columnp)
{
/* Cope with StackFrame.pc value prior to entering js_Interpret. */
/* Cope with InterpreterFrame.pc value prior to entering Interpret. */
if (!pc)
return 0;
@ -3482,10 +3482,8 @@ JSScript::argumentsOptimizationFailed(JSContext *cx, HandleScript script)
* We cannot reliably create an arguments object for Ion activations of
* this script. To maintain the invariant that "script->needsArgsObj
* implies fp->hasArgsObj", the Ion bail mechanism will create an
* arguments object right after restoring the StackFrame and before
* entering the interpreter (in jit::ThunkToInterpreter). This delay is
* safe since the engine avoids any observation of a StackFrame when it's
* runningInJit (see ScriptFrameIter::interpFrame comment).
* arguments object right after restoring the BaselineFrame and before
* entering Baseline code (in jit::FinishBailoutToBaseline).
*/
if (i.isIon())
continue;

View File

@ -24,7 +24,7 @@ using namespace js::gc;
static void
CopyStackFrameArguments(const AbstractFramePtr frame, HeapValue *dst, unsigned totalArgs)
{
JS_ASSERT_IF(frame.isStackFrame(), !frame.asStackFrame()->runningInJit());
JS_ASSERT_IF(frame.isInterpreterFrame(), !frame.asInterpreterFrame()->runningInJit());
JS_ASSERT(Max(frame.numActualArgs(), frame.numFormalArgs()) == totalArgs);
@ -568,7 +568,7 @@ ArgumentsObject::trace(JSTracer *trc, JSObject *obj)
/*
* The classes below collaborate to lazily reflect and synchronize actual
* argument values, argument count, and callee function object stored in a
* StackFrame with their corresponding property values in the frame's
* stack frame with their corresponding property values in the frame's
* arguments object.
*/
const Class NormalArgumentsObject::class_ = {

View File

@ -146,7 +146,7 @@ ValueToIdentifier(JSContext *cx, HandleValue v, MutableHandleId id)
}
/*
* A range of all the Debugger.Frame objects for a particular StackFrame.
* A range of all the Debugger.Frame objects for a particular AbstractFramePtr.
*
* FIXME This checks only current debuggers, so it relies on a hack in
* Debugger::removeDebuggeeGlobal to make sure only current debuggers have Frame
@ -1609,7 +1609,7 @@ Debugger::trace(JSTracer *trc)
/*
* Mark Debugger.Frame objects. These are all reachable from JS, because the
* corresponding StackFrames are still on the stack.
* corresponding JS frames are still on the stack.
*
* (Once we support generator frames properly, we will need
* weakly-referenced Debugger.Frame objects as well, for suspended generator
@ -2286,7 +2286,7 @@ Debugger::removeDebuggeeGlobal(FreeOp *fop, GlobalObject *global,
/*
* FIXME Debugger::slowPathOnLeaveFrame needs to kill all Debugger.Frame
* objects referring to a particular js::StackFrame. This is hard if
* objects referring to a particular JS stack frame. This is hard if
* Debugger objects that are no longer debugging the relevant global might
* have live Frame objects. So we take the easy way out and kill them here.
* This is a bug, since it's observable and contrary to the spec. One
@ -3546,7 +3546,7 @@ Debugger::observesScript(JSScript *script) const
}
/* static */ bool
Debugger::handleBaselineOsr(JSContext *cx, StackFrame *from, jit::BaselineFrame *to)
Debugger::handleBaselineOsr(JSContext *cx, InterpreterFrame *from, jit::BaselineFrame *to)
{
ScriptFrameIter iter(cx);
JS_ASSERT(iter.abstractFramePtr() == to);

View File

@ -426,7 +426,7 @@ class Debugger : private mozilla::LinkedListElement<Debugger>
static inline void onNewGlobalObject(JSContext *cx, Handle<GlobalObject *> global);
static JSTrapStatus onTrap(JSContext *cx, MutableHandleValue vp);
static JSTrapStatus onSingleStep(JSContext *cx, MutableHandleValue vp);
static bool handleBaselineOsr(JSContext *cx, StackFrame *from, jit::BaselineFrame *to);
static bool handleBaselineOsr(JSContext *cx, InterpreterFrame *from, jit::BaselineFrame *to);
/************************************* Functions for use by Debugger.cpp. */

View File

@ -30,7 +30,7 @@ namespace js {
inline bool
ComputeThis(JSContext *cx, AbstractFramePtr frame)
{
JS_ASSERT_IF(frame.isStackFrame(), !frame.asStackFrame()->runningInJit());
JS_ASSERT_IF(frame.isInterpreterFrame(), !frame.asInterpreterFrame()->runningInJit());
if (frame.thisValue().isObject())
return true;
RootedValue thisv(cx, frame.thisValue());
@ -108,7 +108,7 @@ GuardFunApplyArgumentsOptimization(JSContext *cx, AbstractFramePtr frame, Handle
* problem to the value at |spindex| on the stack.
*/
MOZ_ALWAYS_INLINE JSObject *
ValuePropertyBearer(JSContext *cx, StackFrame *fp, HandleValue v, int spindex)
ValuePropertyBearer(JSContext *cx, InterpreterFrame *fp, HandleValue v, int spindex)
{
if (v.isObject())
return &v.toObject();

View File

@ -227,7 +227,7 @@ NoSuchMethod(JSContext *cx, unsigned argc, Value *vp)
#endif /* JS_HAS_NO_SUCH_METHOD */
static inline bool
GetPropertyOperation(JSContext *cx, StackFrame *fp, HandleScript script, jsbytecode *pc,
GetPropertyOperation(JSContext *cx, InterpreterFrame *fp, HandleScript script, jsbytecode *pc,
MutableHandleValue lval, MutableHandleValue vp)
{
JSOp op = JSOp(*pc);
@ -280,7 +280,7 @@ GetPropertyOperation(JSContext *cx, StackFrame *fp, HandleScript script, jsbytec
}
static inline bool
NameOperation(JSContext *cx, StackFrame *fp, jsbytecode *pc, MutableHandleValue vp)
NameOperation(JSContext *cx, InterpreterFrame *fp, jsbytecode *pc, MutableHandleValue vp)
{
JSObject *obj = fp->scopeChain();
PropertyName *name = fp->script()->getName(pc);
@ -371,13 +371,13 @@ js::ValueToCallable(JSContext *cx, HandleValue v, int numToSkip, MaybeConstruct
static MOZ_NEVER_INLINE bool
Interpret(JSContext *cx, RunState &state);
StackFrame *
InterpreterFrame *
InvokeState::pushInterpreterFrame(JSContext *cx)
{
return cx->runtime()->interpreterStack().pushInvokeFrame(cx, args_, initial_);
}
StackFrame *
InterpreterFrame *
ExecuteState::pushInterpreterFrame(JSContext *cx)
{
return cx->runtime()->interpreterStack().pushExecuteFrame(cx, script_, thisv_, scopeChain_,
@ -1456,7 +1456,7 @@ Interpret(JSContext *cx, RunState &state)
gc::MaybeVerifyBarriers(cx, true);
JS_ASSERT(!cx->compartment()->activeAnalysis);
StackFrame *entryFrame = state.pushInterpreterFrame(cx);
InterpreterFrame *entryFrame = state.pushInterpreterFrame(cx);
if (!entryFrame)
return false;

View File

@ -205,7 +205,7 @@ class RunState
JSScript *script() const { return script_; }
virtual StackFrame *pushInterpreterFrame(JSContext *cx) = 0;
virtual InterpreterFrame *pushInterpreterFrame(JSContext *cx) = 0;
virtual void setReturnValue(Value v) = 0;
private:
@ -242,7 +242,7 @@ class ExecuteState : public RunState
JSObject *scopeChain() const { return scopeChain_; }
ExecuteType type() const { return type_; }
virtual StackFrame *pushInterpreterFrame(JSContext *cx);
virtual InterpreterFrame *pushInterpreterFrame(JSContext *cx);
virtual void setReturnValue(Value v) {
if (result_)
@ -271,7 +271,7 @@ class InvokeState : public RunState
bool constructing() const { return InitialFrameFlagsAreConstructing(initial_); }
CallArgs &args() const { return args_; }
virtual StackFrame *pushInterpreterFrame(JSContext *cx);
virtual InterpreterFrame *pushInterpreterFrame(JSContext *cx);
virtual void setReturnValue(Value v) {
args_.rval().set(v);
@ -290,7 +290,7 @@ class GeneratorState : public RunState
GeneratorState(JSContext *cx, JSGenerator *gen, JSGeneratorState futureState);
~GeneratorState();
virtual StackFrame *pushInterpreterFrame(JSContext *cx);
virtual InterpreterFrame *pushInterpreterFrame(JSContext *cx);
virtual void setReturnValue(Value) { }
JSGenerator *gen() const { return gen_; }

View File

@ -70,7 +70,7 @@ IsTopFrameConstructing(JSContext *cx, AbstractFramePtr frame)
JSTrapStatus
js::ScriptDebugPrologue(JSContext *cx, AbstractFramePtr frame, jsbytecode *pc)
{
JS_ASSERT_IF(frame.isStackFrame(), frame.asStackFrame() == cx->interpreterFrame());
JS_ASSERT_IF(frame.isInterpreterFrame(), frame.asInterpreterFrame() == cx->interpreterFrame());
if (!frame.script()->selfHosted()) {
JSAbstractFramePtr jsframe(frame.raw(), pc);
@ -108,7 +108,7 @@ js::ScriptDebugPrologue(JSContext *cx, AbstractFramePtr frame, jsbytecode *pc)
bool
js::ScriptDebugEpilogue(JSContext *cx, AbstractFramePtr frame, jsbytecode *pc, bool okArg)
{
JS_ASSERT_IF(frame.isStackFrame(), frame.asStackFrame() == cx->interpreterFrame());
JS_ASSERT_IF(frame.isInterpreterFrame(), frame.asInterpreterFrame() == cx->interpreterFrame());
bool ok = okArg;

View File

@ -41,7 +41,7 @@ probes::WantNativeAddressInfo(JSContext *cx)
inline bool
probes::EnterScript(JSContext *cx, JSScript *script, JSFunction *maybeFun,
StackFrame *fp)
InterpreterFrame *fp)
{
bool ok = true;
#ifdef INCLUDE_MOZILLA_DTRACE

View File

@ -66,7 +66,7 @@ bool CallTrackingActive(JSContext *);
bool WantNativeAddressInfo(JSContext *);
/* Entering a JS function */
bool EnterScript(JSContext *, JSScript *, JSFunction *, StackFrame *);
bool EnterScript(JSContext *, JSScript *, JSFunction *, InterpreterFrame *);
/* About to leave a JS function */
bool ExitScript(JSContext *, JSScript *, JSFunction *, bool popSPSFrame);

View File

@ -261,8 +261,8 @@ CallObject *
CallObject::createForStrictEval(JSContext *cx, AbstractFramePtr frame)
{
JS_ASSERT(frame.isStrictEvalFrame());
JS_ASSERT_IF(frame.isStackFrame(), cx->interpreterFrame() == frame.asStackFrame());
JS_ASSERT_IF(frame.isStackFrame(), cx->interpreterRegs().pc == frame.script()->code());
JS_ASSERT_IF(frame.isInterpreterFrame(), cx->interpreterFrame() == frame.asInterpreterFrame());
JS_ASSERT_IF(frame.isInterpreterFrame(), cx->interpreterRegs().pc == frame.script()->code());
RootedFunction callee(cx);
RootedScript script(cx, frame.script());
@ -1118,7 +1118,7 @@ class DebugScopeProxy : public BaseProxyHandler
* the normal Call/BlockObject scope objects and thus must be recovered
* from somewhere else:
* + if the invocation for which the scope was created is still executing,
* there is a StackFrame live on the stack holding the values;
* there is a JS frame live on the stack holding the values;
* + if the invocation for which the scope was created finished executing:
* - and there was a DebugScopeObject associated with scope, then the
* DebugScopes::onPop(Call|Block) handler copied out the unaliased
@ -1859,7 +1859,7 @@ DebugScopes::onPopCall(AbstractFramePtr frame, JSContext *cx)
if (frame.fun()->isHeavyweight()) {
/*
* The StackFrame may be observed before the prologue has created the
* The frame may be observed before the prologue has created the
* CallObject. See ScopeIter::settle.
*/
if (!frame.hasCallObj())
@ -1879,7 +1879,7 @@ DebugScopes::onPopCall(AbstractFramePtr frame, JSContext *cx)
}
/*
* When the StackFrame is popped, the values of unaliased variables
* When the JS stack frame is popped, the values of unaliased variables
* are lost. If there is any debug scope referring to this scope, save a
* copy of the unaliased variables' values in an array for later debugger
* access via DebugScopeProxy::handleUnaliasedAccess.
@ -1976,7 +1976,7 @@ DebugScopes::onPopStrictEvalScope(AbstractFramePtr frame)
return;
/*
* The StackFrame may be observed before the prologue has created the
* The stack frame may be observed before the prologue has created the
* CallObject. See ScopeIter::settle.
*/
if (frame.hasCallObj())
@ -2105,7 +2105,7 @@ GetDebugScopeForMissing(JSContext *cx, const ScopeIter &si)
/*
* Create the missing scope object. For block objects, this takes care of
* storing variable values after the StackFrame has been popped. For call
* storing variable values after the stack frame has been popped. For call
* objects, we only use the pretend call object to access callee, bindings
* and to receive dynamically added properties. Together, this provides the
* nice invariant that every DebugScopeObject has a ScopeObject.

View File

@ -207,7 +207,7 @@ class ScopeObject : public JSObject
/*
* Get or set an aliased variable contained in this scope. Unaliased
* variables should instead access the StackFrame. Aliased variable access
* variables should instead access the stack frame. Aliased variable access
* is primarily made through JOF_SCOPECOORD ops which is why these members
* take a ScopeCoordinate instead of just the slot index.
*/
@ -630,12 +630,12 @@ class ScopeIter
ScopeIter(const ScopeIter &si, JSContext *cx
MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
/* Constructing from StackFrame places ScopeIter on the innermost scope. */
/* Constructing from AbstractFramePtr places ScopeIter on the innermost scope. */
ScopeIter(AbstractFramePtr frame, jsbytecode *pc, JSContext *cx
MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
/*
* Without a StackFrame, the resulting ScopeIter is done() with
* Without a stack frame, the resulting ScopeIter is done() with
* enclosingScope() as given.
*/
ScopeIter(JSObject &enclosingScope, JSContext *cx

View File

@ -37,7 +37,7 @@ IsCacheableNonGlobalScope(JSObject *obj)
}
inline HandleObject
StackFrame::scopeChain() const
InterpreterFrame::scopeChain() const
{
JS_ASSERT_IF(!(flags_ & HAS_SCOPECHAIN), isFunctionFrame());
if (!(flags_ & HAS_SCOPECHAIN)) {
@ -48,13 +48,13 @@ StackFrame::scopeChain() const
}
inline GlobalObject &
StackFrame::global() const
InterpreterFrame::global() const
{
return scopeChain()->global();
}
inline JSObject &
StackFrame::varObj()
InterpreterFrame::varObj()
{
JSObject *obj = scopeChain();
while (!obj->isVarObj())
@ -63,15 +63,16 @@ StackFrame::varObj()
}
inline JSCompartment *
StackFrame::compartment() const
InterpreterFrame::compartment() const
{
JS_ASSERT(scopeChain()->compartment() == script()->compartment());
return scopeChain()->compartment();
}
inline void
StackFrame::initCallFrame(JSContext *cx, StackFrame *prev, jsbytecode *prevpc, Value *prevsp, JSFunction &callee,
JSScript *script, Value *argv, uint32_t nactual, StackFrame::Flags flagsArg)
InterpreterFrame::initCallFrame(JSContext *cx, InterpreterFrame *prev, jsbytecode *prevpc,
Value *prevsp, JSFunction &callee, JSScript *script, Value *argv,
uint32_t nactual, InterpreterFrame::Flags flagsArg)
{
JS_ASSERT((flagsArg & ~CONSTRUCTING) == 0);
JS_ASSERT(callee.nonLazyScript() == script);
@ -91,13 +92,13 @@ StackFrame::initCallFrame(JSContext *cx, StackFrame *prev, jsbytecode *prevpc, V
}
inline void
StackFrame::initVarsToUndefined()
InterpreterFrame::initVarsToUndefined()
{
SetValueRangeToUndefined(slots(), script()->nfixed());
}
inline Value &
StackFrame::unaliasedVar(uint32_t i, MaybeCheckAliasing checkAliasing)
InterpreterFrame::unaliasedVar(uint32_t i, MaybeCheckAliasing checkAliasing)
{
JS_ASSERT_IF(checkAliasing, !script()->varIsAliased(i));
JS_ASSERT(i < script()->nfixedvars());
@ -105,7 +106,7 @@ StackFrame::unaliasedVar(uint32_t i, MaybeCheckAliasing checkAliasing)
}
inline Value &
StackFrame::unaliasedLocal(uint32_t i, MaybeCheckAliasing checkAliasing)
InterpreterFrame::unaliasedLocal(uint32_t i, MaybeCheckAliasing checkAliasing)
{
JS_ASSERT(i < script()->nfixed());
#ifdef DEBUG
@ -115,7 +116,7 @@ StackFrame::unaliasedLocal(uint32_t i, MaybeCheckAliasing checkAliasing)
}
inline Value &
StackFrame::unaliasedFormal(unsigned i, MaybeCheckAliasing checkAliasing)
InterpreterFrame::unaliasedFormal(unsigned i, MaybeCheckAliasing checkAliasing)
{
JS_ASSERT(i < numFormalArgs());
JS_ASSERT_IF(checkAliasing, !script()->argsObjAliasesFormals());
@ -124,7 +125,7 @@ StackFrame::unaliasedFormal(unsigned i, MaybeCheckAliasing checkAliasing)
}
inline Value &
StackFrame::unaliasedActual(unsigned i, MaybeCheckAliasing checkAliasing)
InterpreterFrame::unaliasedActual(unsigned i, MaybeCheckAliasing checkAliasing)
{
JS_ASSERT(i < numActualArgs());
JS_ASSERT_IF(checkAliasing, !script()->argsObjAliasesFormals());
@ -134,7 +135,7 @@ StackFrame::unaliasedActual(unsigned i, MaybeCheckAliasing checkAliasing)
template <class Op>
inline void
StackFrame::unaliasedForEachActual(Op op)
InterpreterFrame::unaliasedForEachActual(Op op)
{
// Don't assert !script()->funHasAnyAliasedFormal() since this function is
// called from ArgumentsObject::createUnexpected() which can access aliased
@ -160,7 +161,7 @@ struct CopyToHeap
};
inline ArgumentsObject &
StackFrame::argsObj() const
InterpreterFrame::argsObj() const
{
JS_ASSERT(script()->needsArgsObj());
JS_ASSERT(flags_ & HAS_ARGS_OBJ);
@ -168,7 +169,7 @@ StackFrame::argsObj() const
}
inline void
StackFrame::initArgsObj(ArgumentsObject &argsobj)
InterpreterFrame::initArgsObj(ArgumentsObject &argsobj)
{
JS_ASSERT(script()->needsArgsObj());
flags_ |= HAS_ARGS_OBJ;
@ -176,7 +177,7 @@ StackFrame::initArgsObj(ArgumentsObject &argsobj)
}
inline ScopeObject &
StackFrame::aliasedVarScope(ScopeCoordinate sc) const
InterpreterFrame::aliasedVarScope(ScopeCoordinate sc) const
{
JSObject *scope = &scopeChain()->as<ScopeObject>();
for (unsigned i = sc.hops(); i; i--)
@ -185,7 +186,7 @@ StackFrame::aliasedVarScope(ScopeCoordinate sc) const
}
inline void
StackFrame::pushOnScopeChain(ScopeObject &scope)
InterpreterFrame::pushOnScopeChain(ScopeObject &scope)
{
JS_ASSERT(*scopeChain() == scope.enclosingScope() ||
*scopeChain() == scope.as<CallObject>().enclosingScope().as<DeclEnvObject>().enclosingScope());
@ -194,21 +195,21 @@ StackFrame::pushOnScopeChain(ScopeObject &scope)
}
inline void
StackFrame::popOffScopeChain()
InterpreterFrame::popOffScopeChain()
{
JS_ASSERT(flags_ & HAS_SCOPECHAIN);
scopeChain_ = &scopeChain_->as<ScopeObject>().enclosingScope();
}
bool
StackFrame::hasCallObj() const
InterpreterFrame::hasCallObj() const
{
JS_ASSERT(isStrictEvalFrame() || fun()->isHeavyweight());
return flags_ & HAS_CALL_OBJ;
}
inline CallObject &
StackFrame::callObj() const
InterpreterFrame::callObj() const
{
JS_ASSERT(fun()->isHeavyweight());
@ -248,9 +249,9 @@ InterpreterStack::allocateFrame(JSContext *cx, size_t size)
return buffer;
}
MOZ_ALWAYS_INLINE StackFrame *
MOZ_ALWAYS_INLINE InterpreterFrame *
InterpreterStack::getCallFrame(JSContext *cx, const CallArgs &args, HandleScript script,
StackFrame::Flags *flags, Value **pargv)
InterpreterFrame::Flags *flags, Value **pargv)
{
JSFunction *fun = &args.callee().as<JSFunction>();
@ -260,15 +261,15 @@ InterpreterStack::getCallFrame(JSContext *cx, const CallArgs &args, HandleScript
if (args.length() >= nformal) {
*pargv = args.array();
uint8_t *buffer = allocateFrame(cx, sizeof(StackFrame) + nvals * sizeof(Value));
return reinterpret_cast<StackFrame *>(buffer);
uint8_t *buffer = allocateFrame(cx, sizeof(InterpreterFrame) + nvals * sizeof(Value));
return reinterpret_cast<InterpreterFrame *>(buffer);
}
// Pad any missing arguments with |undefined|.
JS_ASSERT(args.length() < nformal);
nvals += nformal + 2; // Include callee, |this|.
uint8_t *buffer = allocateFrame(cx, sizeof(StackFrame) + nvals * sizeof(Value));
uint8_t *buffer = allocateFrame(cx, sizeof(InterpreterFrame) + nvals * sizeof(Value));
if (!buffer)
return nullptr;
@ -279,7 +280,7 @@ InterpreterStack::getCallFrame(JSContext *cx, const CallArgs &args, HandleScript
SetValueRangeToUndefined(argv + 2 + args.length(), nmissing);
*pargv = argv + 2;
return reinterpret_cast<StackFrame *>(argv + 2 + nformal);
return reinterpret_cast<InterpreterFrame *>(argv + 2 + nformal);
}
MOZ_ALWAYS_INLINE bool
@ -292,16 +293,16 @@ InterpreterStack::pushInlineFrame(JSContext *cx, InterpreterRegs &regs, const Ca
script->ensureNonLazyCanonicalFunction(cx);
StackFrame *prev = regs.fp();
InterpreterFrame *prev = regs.fp();
jsbytecode *prevpc = regs.pc;
Value *prevsp = regs.sp;
JS_ASSERT(prev);
LifoAlloc::Mark mark = allocator_.mark();
StackFrame::Flags flags = ToFrameFlags(initial);
InterpreterFrame::Flags flags = ToFrameFlags(initial);
Value *argv;
StackFrame *fp = getCallFrame(cx, args, script, &flags, &argv);
InterpreterFrame *fp = getCallFrame(cx, args, script, &flags, &argv);
if (!fp)
return false;
@ -317,7 +318,7 @@ InterpreterStack::pushInlineFrame(JSContext *cx, InterpreterRegs &regs, const Ca
MOZ_ALWAYS_INLINE void
InterpreterStack::popInlineFrame(InterpreterRegs &regs)
{
StackFrame *fp = regs.fp();
InterpreterFrame *fp = regs.fp();
regs.popInlineFrame();
regs.sp[-1] = fp->returnValue();
releaseFrame(fp);
@ -354,8 +355,8 @@ FrameIter::unaliasedForEachActual(JSContext *cx, Op op)
inline void *
AbstractFramePtr::maybeHookData() const
{
if (isStackFrame())
return asStackFrame()->maybeHookData();
if (isInterpreterFrame())
return asInterpreterFrame()->maybeHookData();
#ifdef JS_ION
return asBaselineFrame()->maybeHookData();
#else
@ -366,8 +367,8 @@ AbstractFramePtr::maybeHookData() const
inline void
AbstractFramePtr::setHookData(void *data) const
{
if (isStackFrame()) {
asStackFrame()->setHookData(data);
if (isInterpreterFrame()) {
asInterpreterFrame()->setHookData(data);
return;
}
#ifdef JS_ION
@ -380,8 +381,8 @@ AbstractFramePtr::setHookData(void *data) const
inline HandleValue
AbstractFramePtr::returnValue() const
{
if (isStackFrame())
return asStackFrame()->returnValue();
if (isInterpreterFrame())
return asInterpreterFrame()->returnValue();
#ifdef JS_ION
return asBaselineFrame()->returnValue();
#else
@ -392,8 +393,8 @@ AbstractFramePtr::returnValue() const
inline void
AbstractFramePtr::setReturnValue(const Value &rval) const
{
if (isStackFrame()) {
asStackFrame()->setReturnValue(rval);
if (isInterpreterFrame()) {
asInterpreterFrame()->setReturnValue(rval);
return;
}
#ifdef JS_ION
@ -406,8 +407,8 @@ AbstractFramePtr::setReturnValue(const Value &rval) const
inline JSObject *
AbstractFramePtr::scopeChain() const
{
if (isStackFrame())
return asStackFrame()->scopeChain();
if (isInterpreterFrame())
return asInterpreterFrame()->scopeChain();
#ifdef JS_ION
return asBaselineFrame()->scopeChain();
#else
@ -418,8 +419,8 @@ AbstractFramePtr::scopeChain() const
inline void
AbstractFramePtr::pushOnScopeChain(ScopeObject &scope)
{
if (isStackFrame()) {
asStackFrame()->pushOnScopeChain(scope);
if (isInterpreterFrame()) {
asInterpreterFrame()->pushOnScopeChain(scope);
return;
}
#ifdef JS_ION
@ -432,8 +433,8 @@ AbstractFramePtr::pushOnScopeChain(ScopeObject &scope)
inline CallObject &
AbstractFramePtr::callObj() const
{
if (isStackFrame())
return asStackFrame()->callObj();
if (isInterpreterFrame())
return asInterpreterFrame()->callObj();
#ifdef JS_ION
return asBaselineFrame()->callObj();
#else
@ -444,8 +445,8 @@ AbstractFramePtr::callObj() const
inline bool
AbstractFramePtr::initFunctionScopeObjects(JSContext *cx)
{
if (isStackFrame())
return asStackFrame()->initFunctionScopeObjects(cx);
if (isInterpreterFrame())
return asInterpreterFrame()->initFunctionScopeObjects(cx);
#ifdef JS_ION
return asBaselineFrame()->initFunctionScopeObjects(cx);
#else
@ -462,8 +463,8 @@ AbstractFramePtr::compartment() const
inline unsigned
AbstractFramePtr::numActualArgs() const
{
if (isStackFrame())
return asStackFrame()->numActualArgs();
if (isInterpreterFrame())
return asInterpreterFrame()->numActualArgs();
#ifdef JS_ION
return asBaselineFrame()->numActualArgs();
#else
@ -473,8 +474,8 @@ AbstractFramePtr::numActualArgs() const
inline unsigned
AbstractFramePtr::numFormalArgs() const
{
if (isStackFrame())
return asStackFrame()->numFormalArgs();
if (isInterpreterFrame())
return asInterpreterFrame()->numFormalArgs();
#ifdef JS_ION
return asBaselineFrame()->numFormalArgs();
#else
@ -485,8 +486,8 @@ AbstractFramePtr::numFormalArgs() const
inline Value &
AbstractFramePtr::unaliasedVar(uint32_t i, MaybeCheckAliasing checkAliasing)
{
if (isStackFrame())
return asStackFrame()->unaliasedVar(i, checkAliasing);
if (isInterpreterFrame())
return asInterpreterFrame()->unaliasedVar(i, checkAliasing);
#ifdef JS_ION
return asBaselineFrame()->unaliasedVar(i, checkAliasing);
#else
@ -497,8 +498,8 @@ AbstractFramePtr::unaliasedVar(uint32_t i, MaybeCheckAliasing checkAliasing)
inline Value &
AbstractFramePtr::unaliasedLocal(uint32_t i, MaybeCheckAliasing checkAliasing)
{
if (isStackFrame())
return asStackFrame()->unaliasedLocal(i, checkAliasing);
if (isInterpreterFrame())
return asInterpreterFrame()->unaliasedLocal(i, checkAliasing);
#ifdef JS_ION
return asBaselineFrame()->unaliasedLocal(i, checkAliasing);
#else
@ -509,8 +510,8 @@ AbstractFramePtr::unaliasedLocal(uint32_t i, MaybeCheckAliasing checkAliasing)
inline Value &
AbstractFramePtr::unaliasedFormal(unsigned i, MaybeCheckAliasing checkAliasing)
{
if (isStackFrame())
return asStackFrame()->unaliasedFormal(i, checkAliasing);
if (isInterpreterFrame())
return asInterpreterFrame()->unaliasedFormal(i, checkAliasing);
#ifdef JS_ION
return asBaselineFrame()->unaliasedFormal(i, checkAliasing);
#else
@ -521,8 +522,8 @@ AbstractFramePtr::unaliasedFormal(unsigned i, MaybeCheckAliasing checkAliasing)
inline Value &
AbstractFramePtr::unaliasedActual(unsigned i, MaybeCheckAliasing checkAliasing)
{
if (isStackFrame())
return asStackFrame()->unaliasedActual(i, checkAliasing);
if (isInterpreterFrame())
return asInterpreterFrame()->unaliasedActual(i, checkAliasing);
#ifdef JS_ION
return asBaselineFrame()->unaliasedActual(i, checkAliasing);
#else
@ -533,8 +534,8 @@ AbstractFramePtr::unaliasedActual(unsigned i, MaybeCheckAliasing checkAliasing)
inline bool
AbstractFramePtr::hasCallObj() const
{
if (isStackFrame())
return asStackFrame()->hasCallObj();
if (isInterpreterFrame())
return asInterpreterFrame()->hasCallObj();
#ifdef JS_ION
return asBaselineFrame()->hasCallObj();
#else
@ -544,29 +545,29 @@ AbstractFramePtr::hasCallObj() const
inline bool
AbstractFramePtr::useNewType() const
{
if (isStackFrame())
return asStackFrame()->useNewType();
if (isInterpreterFrame())
return asInterpreterFrame()->useNewType();
return false;
}
inline bool
AbstractFramePtr::isGeneratorFrame() const
{
if (isStackFrame())
return asStackFrame()->isGeneratorFrame();
if (isInterpreterFrame())
return asInterpreterFrame()->isGeneratorFrame();
return false;
}
inline bool
AbstractFramePtr::isYielding() const
{
if (isStackFrame())
return asStackFrame()->isYielding();
if (isInterpreterFrame())
return asInterpreterFrame()->isYielding();
return false;
}
inline bool
AbstractFramePtr::isFunctionFrame() const
{
if (isStackFrame())
return asStackFrame()->isFunctionFrame();
if (isInterpreterFrame())
return asInterpreterFrame()->isFunctionFrame();
#ifdef JS_ION
return asBaselineFrame()->isFunctionFrame();
#else
@ -576,8 +577,8 @@ AbstractFramePtr::isFunctionFrame() const
inline bool
AbstractFramePtr::isGlobalFrame() const
{
if (isStackFrame())
return asStackFrame()->isGlobalFrame();
if (isInterpreterFrame())
return asInterpreterFrame()->isGlobalFrame();
#ifdef JS_ION
return asBaselineFrame()->isGlobalFrame();
#else
@ -587,8 +588,8 @@ AbstractFramePtr::isGlobalFrame() const
inline bool
AbstractFramePtr::isEvalFrame() const
{
if (isStackFrame())
return asStackFrame()->isEvalFrame();
if (isInterpreterFrame())
return asInterpreterFrame()->isEvalFrame();
#ifdef JS_ION
return asBaselineFrame()->isEvalFrame();
#else
@ -603,8 +604,8 @@ AbstractFramePtr::isFramePushedByExecute() const
inline bool
AbstractFramePtr::isDebuggerFrame() const
{
if (isStackFrame())
return asStackFrame()->isDebuggerFrame();
if (isInterpreterFrame())
return asInterpreterFrame()->isDebuggerFrame();
#ifdef JS_ION
return asBaselineFrame()->isDebuggerFrame();
#else
@ -618,8 +619,8 @@ AbstractFramePtr::hasArgs() const {
inline JSScript *
AbstractFramePtr::script() const
{
if (isStackFrame())
return asStackFrame()->script();
if (isInterpreterFrame())
return asInterpreterFrame()->script();
#ifdef JS_ION
return asBaselineFrame()->script();
#else
@ -629,8 +630,8 @@ AbstractFramePtr::script() const
inline JSFunction *
AbstractFramePtr::fun() const
{
if (isStackFrame())
return asStackFrame()->fun();
if (isInterpreterFrame())
return asInterpreterFrame()->fun();
#ifdef JS_ION
return asBaselineFrame()->fun();
#else
@ -640,8 +641,8 @@ AbstractFramePtr::fun() const
inline JSFunction *
AbstractFramePtr::maybeFun() const
{
if (isStackFrame())
return asStackFrame()->maybeFun();
if (isInterpreterFrame())
return asInterpreterFrame()->maybeFun();
#ifdef JS_ION
return asBaselineFrame()->maybeFun();
#else
@ -651,8 +652,8 @@ AbstractFramePtr::maybeFun() const
inline JSFunction *
AbstractFramePtr::callee() const
{
if (isStackFrame())
return &asStackFrame()->callee();
if (isInterpreterFrame())
return &asInterpreterFrame()->callee();
#ifdef JS_ION
return asBaselineFrame()->callee();
#else
@ -662,8 +663,8 @@ AbstractFramePtr::callee() const
inline Value
AbstractFramePtr::calleev() const
{
if (isStackFrame())
return asStackFrame()->calleev();
if (isInterpreterFrame())
return asInterpreterFrame()->calleev();
#ifdef JS_ION
return asBaselineFrame()->calleev();
#else
@ -673,8 +674,8 @@ AbstractFramePtr::calleev() const
inline bool
AbstractFramePtr::isNonEvalFunctionFrame() const
{
if (isStackFrame())
return asStackFrame()->isNonEvalFunctionFrame();
if (isInterpreterFrame())
return asInterpreterFrame()->isNonEvalFunctionFrame();
#ifdef JS_ION
return asBaselineFrame()->isNonEvalFunctionFrame();
#else
@ -684,8 +685,8 @@ AbstractFramePtr::isNonEvalFunctionFrame() const
inline bool
AbstractFramePtr::isNonStrictDirectEvalFrame() const
{
if (isStackFrame())
return asStackFrame()->isNonStrictDirectEvalFrame();
if (isInterpreterFrame())
return asInterpreterFrame()->isNonStrictDirectEvalFrame();
#ifdef JS_ION
return asBaselineFrame()->isNonStrictDirectEvalFrame();
#else
@ -695,8 +696,8 @@ AbstractFramePtr::isNonStrictDirectEvalFrame() const
inline bool
AbstractFramePtr::isStrictEvalFrame() const
{
if (isStackFrame())
return asStackFrame()->isStrictEvalFrame();
if (isInterpreterFrame())
return asInterpreterFrame()->isStrictEvalFrame();
#ifdef JS_ION
return asBaselineFrame()->isStrictEvalFrame();
#else
@ -707,8 +708,8 @@ AbstractFramePtr::isStrictEvalFrame() const
inline Value *
AbstractFramePtr::argv() const
{
if (isStackFrame())
return asStackFrame()->argv();
if (isInterpreterFrame())
return asInterpreterFrame()->argv();
#ifdef JS_ION
return asBaselineFrame()->argv();
#else
@ -719,8 +720,8 @@ AbstractFramePtr::argv() const
inline bool
AbstractFramePtr::hasArgsObj() const
{
if (isStackFrame())
return asStackFrame()->hasArgsObj();
if (isInterpreterFrame())
return asInterpreterFrame()->hasArgsObj();
#ifdef JS_ION
return asBaselineFrame()->hasArgsObj();
#else
@ -730,8 +731,8 @@ AbstractFramePtr::hasArgsObj() const
inline ArgumentsObject &
AbstractFramePtr::argsObj() const
{
if (isStackFrame())
return asStackFrame()->argsObj();
if (isInterpreterFrame())
return asInterpreterFrame()->argsObj();
#ifdef JS_ION
return asBaselineFrame()->argsObj();
#else
@ -741,8 +742,8 @@ AbstractFramePtr::argsObj() const
inline void
AbstractFramePtr::initArgsObj(ArgumentsObject &argsobj) const
{
if (isStackFrame()) {
asStackFrame()->initArgsObj(argsobj);
if (isInterpreterFrame()) {
asInterpreterFrame()->initArgsObj(argsobj);
return;
}
#ifdef JS_ION
@ -754,8 +755,8 @@ AbstractFramePtr::initArgsObj(ArgumentsObject &argsobj) const
inline bool
AbstractFramePtr::copyRawFrameSlots(AutoValueVector *vec) const
{
if (isStackFrame())
return asStackFrame()->copyRawFrameSlots(vec);
if (isInterpreterFrame())
return asInterpreterFrame()->copyRawFrameSlots(vec);
#ifdef JS_ION
return asBaselineFrame()->copyRawFrameSlots(vec);
#else
@ -766,8 +767,8 @@ AbstractFramePtr::copyRawFrameSlots(AutoValueVector *vec) const
inline bool
AbstractFramePtr::prevUpToDate() const
{
if (isStackFrame())
return asStackFrame()->prevUpToDate();
if (isInterpreterFrame())
return asInterpreterFrame()->prevUpToDate();
#ifdef JS_ION
return asBaselineFrame()->prevUpToDate();
#else
@ -777,8 +778,8 @@ AbstractFramePtr::prevUpToDate() const
inline void
AbstractFramePtr::setPrevUpToDate() const
{
if (isStackFrame()) {
asStackFrame()->setPrevUpToDate();
if (isInterpreterFrame()) {
asInterpreterFrame()->setPrevUpToDate();
return;
}
#ifdef JS_ION
@ -791,8 +792,8 @@ AbstractFramePtr::setPrevUpToDate() const
inline Value &
AbstractFramePtr::thisValue() const
{
if (isStackFrame())
return asStackFrame()->thisValue();
if (isInterpreterFrame())
return asInterpreterFrame()->thisValue();
#ifdef JS_ION
return asBaselineFrame()->thisValue();
#else
@ -803,8 +804,8 @@ AbstractFramePtr::thisValue() const
inline void
AbstractFramePtr::popBlock(JSContext *cx) const
{
if (isStackFrame()) {
asStackFrame()->popBlock(cx);
if (isInterpreterFrame()) {
asInterpreterFrame()->popBlock(cx);
return;
}
#ifdef JS_ION
@ -817,8 +818,8 @@ AbstractFramePtr::popBlock(JSContext *cx) const
inline void
AbstractFramePtr::popWith(JSContext *cx) const
{
if (isStackFrame()) {
asStackFrame()->popWith(cx);
if (isInterpreterFrame()) {
asInterpreterFrame()->popWith(cx);
return;
}
#ifdef JS_ION
@ -846,7 +847,8 @@ Activation::~Activation()
cx_->mainThread().activation_ = prev_;
}
InterpreterActivation::InterpreterActivation(RunState &state, JSContext *cx, StackFrame *entryFrame)
InterpreterActivation::InterpreterActivation(RunState &state, JSContext *cx,
InterpreterFrame *entryFrame)
: Activation(cx, Interpreter),
state_(state),
entryFrame_(entryFrame),
@ -896,7 +898,7 @@ InterpreterActivation::pushInlineFrame(const CallArgs &args, HandleScript script
}
inline void
InterpreterActivation::popInlineFrame(StackFrame *frame)
InterpreterActivation::popInlineFrame(InterpreterFrame *frame)
{
(void)frame; // Quell compiler warning.
JS_ASSERT(regs_.fp() == frame);

View File

@ -30,7 +30,7 @@ using mozilla::PodCopy;
/*****************************************************************************/
void
StackFrame::initExecuteFrame(JSContext *cx, JSScript *script, AbstractFramePtr evalInFramePrev,
InterpreterFrame::initExecuteFrame(JSContext *cx, JSScript *script, AbstractFramePtr evalInFramePrev,
const Value &thisv, JSObject &scopeChain, ExecuteType type)
{
/*
@ -93,16 +93,16 @@ StackFrame::initExecuteFrame(JSContext *cx, JSScript *script, AbstractFramePtr e
#endif
}
template <StackFrame::TriggerPostBarriers doPostBarrier>
template <InterpreterFrame::TriggerPostBarriers doPostBarrier>
void
StackFrame::copyFrameAndValues(JSContext *cx, Value *vp, StackFrame *otherfp,
const Value *othervp, Value *othersp)
InterpreterFrame::copyFrameAndValues(JSContext *cx, Value *vp, InterpreterFrame *otherfp,
const Value *othervp, Value *othersp)
{
JS_ASSERT(othervp == otherfp->generatorArgsSnapshotBegin());
JS_ASSERT(othersp >= otherfp->slots());
JS_ASSERT(othersp <= otherfp->generatorSlotsSnapshotBegin() + otherfp->script()->nslots());
/* Copy args, StackFrame, and slots. */
/* Copy args, InterpreterFrame, and slots. */
const Value *srcend = otherfp->generatorArgsSnapshotEnd();
Value *dst = vp;
for (const Value *src = othervp; src < srcend; src++, dst++) {
@ -128,16 +128,16 @@ StackFrame::copyFrameAndValues(JSContext *cx, Value *vp, StackFrame *otherfp,
/* Note: explicit instantiation for js_NewGenerator located in jsiter.cpp. */
template
void StackFrame::copyFrameAndValues<StackFrame::NoPostBarrier>(
JSContext *, Value *, StackFrame *, const Value *, Value *);
void InterpreterFrame::copyFrameAndValues<InterpreterFrame::NoPostBarrier>(
JSContext *, Value *, InterpreterFrame *, const Value *, Value *);
template
void StackFrame::copyFrameAndValues<StackFrame::DoPostBarrier>(
JSContext *, Value *, StackFrame *, const Value *, Value *);
void InterpreterFrame::copyFrameAndValues<InterpreterFrame::DoPostBarrier>(
JSContext *, Value *, InterpreterFrame *, const Value *, Value *);
void
StackFrame::writeBarrierPost()
InterpreterFrame::writeBarrierPost()
{
/* This needs to follow the same rules as in StackFrame::mark. */
/* This needs to follow the same rules as in InterpreterFrame::mark. */
if (scopeChain_)
JSObject::writeBarrierPost(scopeChain_, (void *)&scopeChain_);
if (flags_ & HAS_ARGS_OBJ)
@ -154,7 +154,7 @@ StackFrame::writeBarrierPost()
}
bool
StackFrame::copyRawFrameSlots(AutoValueVector *vec)
InterpreterFrame::copyRawFrameSlots(AutoValueVector *vec)
{
if (!vec->resize(numFormalArgs() + script()->nfixed()))
return false;
@ -164,7 +164,7 @@ StackFrame::copyRawFrameSlots(AutoValueVector *vec)
}
JSObject *
StackFrame::createRestParameter(JSContext *cx)
InterpreterFrame::createRestParameter(JSContext *cx)
{
JS_ASSERT(fun()->hasRest());
unsigned nformal = fun()->nargs() - 1, nactual = numActualArgs();
@ -213,7 +213,7 @@ AssertDynamicScopeMatchesStaticScope(JSContext *cx, JSScript *script, JSObject *
}
bool
StackFrame::initFunctionScopeObjects(JSContext *cx)
InterpreterFrame::initFunctionScopeObjects(JSContext *cx)
{
CallObject *callobj = CallObject::createForFunction(cx, this);
if (!callobj)
@ -224,7 +224,7 @@ StackFrame::initFunctionScopeObjects(JSContext *cx)
}
bool
StackFrame::prologue(JSContext *cx)
InterpreterFrame::prologue(JSContext *cx)
{
RootedScript script(cx, this->script());
@ -268,7 +268,7 @@ StackFrame::prologue(JSContext *cx)
}
void
StackFrame::epilogue(JSContext *cx)
InterpreterFrame::epilogue(JSContext *cx)
{
JS_ASSERT(!isYielding());
@ -322,7 +322,7 @@ StackFrame::epilogue(JSContext *cx)
}
bool
StackFrame::pushBlock(JSContext *cx, StaticBlockObject &block)
InterpreterFrame::pushBlock(JSContext *cx, StaticBlockObject &block)
{
JS_ASSERT (block.needsClone());
@ -337,14 +337,14 @@ StackFrame::pushBlock(JSContext *cx, StaticBlockObject &block)
}
void
StackFrame::popBlock(JSContext *cx)
InterpreterFrame::popBlock(JSContext *cx)
{
JS_ASSERT(scopeChain_->is<ClonedBlockObject>());
popOffScopeChain();
}
void
StackFrame::popWith(JSContext *cx)
InterpreterFrame::popWith(JSContext *cx)
{
if (MOZ_UNLIKELY(cx->compartment()->debugMode()))
DebugScopes::onPopWith(this);
@ -354,7 +354,7 @@ StackFrame::popWith(JSContext *cx)
}
void
StackFrame::mark(JSTracer *trc)
InterpreterFrame::mark(JSTracer *trc)
{
/*
* Normally we would use MarkRoot here, except that generators also take
@ -378,14 +378,14 @@ StackFrame::mark(JSTracer *trc)
}
void
StackFrame::markValues(JSTracer *trc, unsigned start, unsigned end)
InterpreterFrame::markValues(JSTracer *trc, unsigned start, unsigned end)
{
if (start < end)
gc::MarkValueRootRange(trc, end - start, slots() + start, "vm_stack");
}
void
StackFrame::markValues(JSTracer *trc, Value *sp, jsbytecode *pc)
InterpreterFrame::markValues(JSTracer *trc, Value *sp, jsbytecode *pc)
{
JS_ASSERT(sp >= slots());
@ -434,7 +434,7 @@ static void
MarkInterpreterActivation(JSTracer *trc, InterpreterActivation *act)
{
for (InterpreterFrameIterator frames(act); !frames.done(); ++frames) {
StackFrame *fp = frames.frame();
InterpreterFrame *fp = frames.frame();
fp->markValues(trc, frames.sp(), frames.pc());
fp->mark(trc);
}
@ -466,7 +466,7 @@ InterpreterRegs::setToEndOfScript()
/*****************************************************************************/
StackFrame *
InterpreterFrame *
InterpreterStack::pushInvokeFrame(JSContext *cx, const CallArgs &args, InitialFrameFlags initial)
{
LifoAlloc::Mark mark = allocator_.mark();
@ -474,9 +474,9 @@ InterpreterStack::pushInvokeFrame(JSContext *cx, const CallArgs &args, InitialFr
RootedFunction fun(cx, &args.callee().as<JSFunction>());
RootedScript script(cx, fun->nonLazyScript());
StackFrame::Flags flags = ToFrameFlags(initial);
InterpreterFrame::Flags flags = ToFrameFlags(initial);
Value *argv;
StackFrame *fp = getCallFrame(cx, args, script, &flags, &argv);
InterpreterFrame *fp = getCallFrame(cx, args, script, &flags, &argv);
if (!fp)
return nullptr;
@ -485,7 +485,7 @@ InterpreterStack::pushInvokeFrame(JSContext *cx, const CallArgs &args, InitialFr
return fp;
}
StackFrame *
InterpreterFrame *
InterpreterStack::pushExecuteFrame(JSContext *cx, HandleScript script, const Value &thisv,
HandleObject scopeChain, ExecuteType type,
AbstractFramePtr evalInFrame)
@ -493,11 +493,11 @@ InterpreterStack::pushExecuteFrame(JSContext *cx, HandleScript script, const Val
LifoAlloc::Mark mark = allocator_.mark();
unsigned nvars = 2 /* callee, this */ + script->nslots();
uint8_t *buffer = allocateFrame(cx, sizeof(StackFrame) + nvars * sizeof(Value));
uint8_t *buffer = allocateFrame(cx, sizeof(InterpreterFrame) + nvars * sizeof(Value));
if (!buffer)
return nullptr;
StackFrame *fp = reinterpret_cast<StackFrame *>(buffer + 2 * sizeof(Value));
InterpreterFrame *fp = reinterpret_cast<InterpreterFrame *>(buffer + 2 * sizeof(Value));
fp->mark_ = mark;
fp->initExecuteFrame(cx, script, evalInFrame, thisv, *scopeChain, type);
fp->initVarsToUndefined();
@ -1085,7 +1085,7 @@ FrameIter::updatePcQuadratic()
case ASMJS:
break;
case INTERP: {
StackFrame *frame = interpFrame();
InterpreterFrame *frame = interpFrame();
InterpreterActivation *activation = data_.activations_.activation()->asInterpreter();
// Look for the current frame.
@ -1471,8 +1471,8 @@ AbstractFramePtr::evalPrevScopeChain(JSContext *cx) const
bool
AbstractFramePtr::hasPushedSPSFrame() const
{
if (isStackFrame())
return asStackFrame()->hasPushedSPSFrame();
if (isInterpreterFrame())
return asInterpreterFrame()->hasPushedSPSFrame();
#ifdef JS_ION
return asBaselineFrame()->hasPushedSPSFrame();
#else

View File

@ -29,7 +29,7 @@ class InterpreterRegs;
class ScopeObject;
class ScriptFrameIter;
class SPSProfiler;
class StackFrame;
class InterpreterFrame;
class StaticBlockObject;
struct ScopeCoordinate;
@ -47,21 +47,21 @@ struct ScopeCoordinate;
// contexts. This happens whenever an embedding enters the JS engine on cx1 and
// then, from a native called by the JS engine, reenters the VM on cx2.
// Interpreter frames (StackFrame)
// Interpreter frames (InterpreterFrame)
//
// Each interpreter script activation (global or function code) is given a
// fixed-size header (js::StackFrame). The frame contains bookkeeping information
// about the activation and links to the previous frame.
// fixed-size header (js::InterpreterFrame). The frame contains bookkeeping
// information about the activation and links to the previous frame.
//
// The values after a StackFrame in memory are its locals followed by its
// expression stack. StackFrame::argv_ points to the frame's arguments. Missing
// formal arguments are padded with |undefined|, so the number of arguments is
// always >= the number of formals.
// The values after an InterpreterFrame in memory are its locals followed by its
// expression stack. InterpreterFrame::argv_ points to the frame's arguments.
// Missing formal arguments are padded with |undefined|, so the number of
// arguments is always >= the number of formals.
//
// The top of an activation's current frame's expression stack is pointed to by the
// activation's "current regs", which contains the stack pointer 'sp'. In the
// interpreter, sp is adjusted as individual values are pushed and popped from
// the stack and the InterpreterRegs struct (pointed to by the
// The top of an activation's current frame's expression stack is pointed to by
// the activation's "current regs", which contains the stack pointer 'sp'. In
// the interpreter, sp is adjusted as individual values are pushed and popped
// from the stack and the InterpreterRegs struct (pointed to by the
// InterpreterActivation) is a local var of js::Interpret.
enum MaybeCheckAliasing { CHECK_ALIASING = true, DONT_CHECK_ALIASING = false };
@ -78,8 +78,8 @@ namespace jit {
}
/*
* Pointer to either a ScriptFrameIter::Data, a StackFrame, or a baseline JIT
* frame.
* Pointer to either a ScriptFrameIter::Data, an InterpreterFrame, or a Baseline
* JIT frame.
*
* The Debugger may cache ScriptFrameIter::Data as a bookmark to reconstruct a
* ScriptFrameIter without doing a full stack walk.
@ -104,7 +104,7 @@ class AbstractFramePtr
enum {
Tag_ScriptFrameIterData = 0x0,
Tag_StackFrame = 0x1,
Tag_InterpreterFrame = 0x1,
Tag_BaselineFrame = 0x2,
TagMask = 0x3
};
@ -114,10 +114,10 @@ class AbstractFramePtr
: ptr_(0)
{}
AbstractFramePtr(StackFrame *fp)
: ptr_(fp ? uintptr_t(fp) | Tag_StackFrame : 0)
AbstractFramePtr(InterpreterFrame *fp)
: ptr_(fp ? uintptr_t(fp) | Tag_InterpreterFrame : 0)
{
MOZ_ASSERT(asStackFrame() == fp);
MOZ_ASSERT(asInterpreterFrame() == fp);
}
AbstractFramePtr(jit::BaselineFrame *fp)
@ -140,12 +140,12 @@ class AbstractFramePtr
bool isScriptFrameIterData() const {
return !!ptr_ && (ptr_ & TagMask) == Tag_ScriptFrameIterData;
}
bool isStackFrame() const {
return ptr_ & Tag_StackFrame;
bool isInterpreterFrame() const {
return ptr_ & Tag_InterpreterFrame;
}
StackFrame *asStackFrame() const {
JS_ASSERT(isStackFrame());
StackFrame *res = (StackFrame *)(ptr_ & ~TagMask);
InterpreterFrame *asInterpreterFrame() const {
JS_ASSERT(isInterpreterFrame());
InterpreterFrame *res = (InterpreterFrame *)(ptr_ & ~TagMask);
JS_ASSERT(res);
return res;
}
@ -241,20 +241,20 @@ class NullFramePtr : public AbstractFramePtr
/* Flags specified for a frame as it is constructed. */
enum InitialFrameFlags {
INITIAL_NONE = 0,
INITIAL_CONSTRUCT = 0x20, /* == StackFrame::CONSTRUCTING, asserted below */
INITIAL_CONSTRUCT = 0x20, /* == InterpreterFrame::CONSTRUCTING, asserted below */
};
enum ExecuteType {
EXECUTE_GLOBAL = 0x1, /* == StackFrame::GLOBAL */
EXECUTE_DIRECT_EVAL = 0x4, /* == StackFrame::EVAL */
EXECUTE_INDIRECT_EVAL = 0x5, /* == StackFrame::GLOBAL | EVAL */
EXECUTE_DEBUG = 0xc, /* == StackFrame::EVAL | DEBUGGER */
EXECUTE_DEBUG_GLOBAL = 0xd /* == StackFrame::EVAL | DEBUGGER | GLOBAL */
EXECUTE_GLOBAL = 0x1, /* == InterpreterFrame::GLOBAL */
EXECUTE_DIRECT_EVAL = 0x4, /* == InterpreterFrame::EVAL */
EXECUTE_INDIRECT_EVAL = 0x5, /* == InterpreterFrame::GLOBAL | EVAL */
EXECUTE_DEBUG = 0xc, /* == InterpreterFrame::EVAL | DEBUGGER */
EXECUTE_DEBUG_GLOBAL = 0xd /* == InterpreterFrame::EVAL | DEBUGGER | GLOBAL */
};
/*****************************************************************************/
class StackFrame
class InterpreterFrame
{
public:
enum Flags {
@ -339,7 +339,7 @@ class StackFrame
* InterpreterActivation's entry frame, always non-nullptr for inline
* frames.
*/
StackFrame *prev_;
InterpreterFrame *prev_;
jsbytecode *prevpc_;
Value *prevsp_;
@ -355,8 +355,8 @@ class StackFrame
LifoAlloc::Mark mark_; /* Used to release memory for this frame. */
static void staticAsserts() {
JS_STATIC_ASSERT(offsetof(StackFrame, rval_) % sizeof(Value) == 0);
JS_STATIC_ASSERT(sizeof(StackFrame) % sizeof(Value) == 0);
JS_STATIC_ASSERT(offsetof(InterpreterFrame, rval_) % sizeof(Value) == 0);
JS_STATIC_ASSERT(sizeof(InterpreterFrame) % sizeof(Value) == 0);
}
void writeBarrierPost();
@ -364,8 +364,8 @@ class StackFrame
/*
* The utilities are private since they are not able to assert that only
* unaliased vars/formals are accessed. Normal code should prefer the
* StackFrame::unaliased* members (or InterpreterRegs::stackDepth for the
* usual "depth is at least" assertions).
* InterpreterFrame::unaliased* members (or InterpreterRegs::stackDepth for
* the usual "depth is at least" assertions).
*/
Value *slots() const { return (Value *)(this + 1); }
Value *base() const { return slots() + script()->nfixed(); }
@ -381,8 +381,9 @@ class StackFrame
*/
/* Used for Invoke and Interpret. */
void initCallFrame(JSContext *cx, StackFrame *prev, jsbytecode *prevpc, Value *prevsp, JSFunction &callee,
JSScript *script, Value *argv, uint32_t nactual, StackFrame::Flags flags);
void initCallFrame(JSContext *cx, InterpreterFrame *prev, jsbytecode *prevpc, Value *prevsp,
JSFunction &callee, JSScript *script, Value *argv, uint32_t nactual,
InterpreterFrame::Flags flags);
/* Used for global and eval frames. */
void initExecuteFrame(JSContext *cx, JSScript *script, AbstractFramePtr prev,
@ -439,7 +440,7 @@ class StackFrame
*
* As noted above, global and function frames may optionally be 'eval
* frames'. Eval code shares its parent's arguments which means that the
* arg-access members of StackFrame may not be used for eval frames.
* arg-access members of InterpreterFrame may not be used for eval frames.
* Search for 'hasArgs' below for more details.
*
* A further sub-classification of eval frames is whether the frame was
@ -487,7 +488,7 @@ class StackFrame
* to set cx->regs->fp to when this frame is popped.
*/
StackFrame *prev() const {
InterpreterFrame *prev() const {
return prev_;
}
@ -537,7 +538,7 @@ class StackFrame
* created in the prologue and stored in the local variable for the
* 'arguments' binding (script->argumentsLocal). Since this local is
* mutable, the arguments object can be overwritten and we can "lose" the
* arguments object. Thus, StackFrame keeps an explicit argsObj_ field so
* arguments object. Thus, InterpreterFrame keeps an explicit argsObj_ field so
* that the original arguments object is always available.
*/
@ -553,8 +554,8 @@ class StackFrame
* scope. However, only objects that are required for dynamic lookup are
* actually created.
*
* Given that a StackFrame corresponds roughly to a ES5 Execution Context
* (ES5 10.3), StackFrame::varObj corresponds to the VariableEnvironment
* Given that an InterpreterFrame corresponds roughly to a ES5 Execution Context
* (ES5 10.3), InterpreterFrame::varObj corresponds to the VariableEnvironment
* component of a Exection Context. Intuitively, the variables object is
* where new bindings (variables and functions) are stored. One might
* expect that this is either the Call object or scopeChain.globalObj for
@ -786,10 +787,11 @@ class StackFrame
* Since generators are not executed LIFO, the VM copies a single abstract
* generator frame back and forth between the LIFO VM stack (when the
* generator is active) and a snapshot stored in JSGenerator (when the
* generator is inactive). A generator frame is comprised of a StackFrame
* structure and the values that make up the arguments, locals, and
* expression stack. The layout in the JSGenerator snapshot matches the
* layout on the stack (see the "VM stack layout" comment above).
* generator is inactive). A generator frame is comprised of an
* InterpreterFrame structure and the values that make up the arguments,
* locals, and expression stack. The layout in the JSGenerator snapshot
* matches the layout on the stack (see the "VM stack layout" comment
* above).
*/
bool isGeneratorFrame() const {
@ -824,7 +826,7 @@ class StackFrame
NoPostBarrier = false
};
template <TriggerPostBarriers doPostBarrier>
void copyFrameAndValues(JSContext *cx, Value *vp, StackFrame *otherfp,
void copyFrameAndValues(JSContext *cx, Value *vp, InterpreterFrame *otherfp,
const Value *othervp, Value *othersp);
/*
@ -942,12 +944,12 @@ class StackFrame
}
};
static const size_t VALUES_PER_STACK_FRAME = sizeof(StackFrame) / sizeof(Value);
static const size_t VALUES_PER_STACK_FRAME = sizeof(InterpreterFrame) / sizeof(Value);
static inline StackFrame::Flags
static inline InterpreterFrame::Flags
ToFrameFlags(InitialFrameFlags initial)
{
return StackFrame::Flags(initial);
return InterpreterFrame::Flags(initial);
}
static inline InitialFrameFlags
@ -970,9 +972,9 @@ class InterpreterRegs
Value *sp;
jsbytecode *pc;
private:
StackFrame *fp_;
InterpreterFrame *fp_;
public:
StackFrame *fp() const { return fp_; }
InterpreterFrame *fp() const { return fp_; }
unsigned stackDepth() const {
JS_ASSERT(sp >= fp_->base());
@ -985,7 +987,7 @@ class InterpreterRegs
}
/* For generators. */
void rebaseFromTo(const InterpreterRegs &from, StackFrame &to) {
void rebaseFromTo(const InterpreterRegs &from, InterpreterFrame &to) {
fp_ = &to;
sp = to.slots() + (from.sp - from.fp_->slots());
pc = from.pc;
@ -998,7 +1000,7 @@ class InterpreterRegs
fp_ = fp_->prev();
JS_ASSERT(fp_);
}
void prepareToRun(StackFrame &fp, JSScript *script) {
void prepareToRun(InterpreterFrame &fp, JSScript *script) {
pc = script->code();
sp = fp.slots() + script->nfixed();
fp_ = &fp;
@ -1031,11 +1033,11 @@ class InterpreterStack
inline uint8_t *allocateFrame(JSContext *cx, size_t size);
inline StackFrame *
inline InterpreterFrame *
getCallFrame(JSContext *cx, const CallArgs &args, HandleScript script,
StackFrame::Flags *pflags, Value **pargv);
InterpreterFrame::Flags *pflags, Value **pargv);
void releaseFrame(StackFrame *fp) {
void releaseFrame(InterpreterFrame *fp) {
frameCount_--;
allocator_.release(fp->mark_);
}
@ -1051,12 +1053,13 @@ class InterpreterStack
}
// For execution of eval or global code.
StackFrame *pushExecuteFrame(JSContext *cx, HandleScript script, const Value &thisv,
InterpreterFrame *pushExecuteFrame(JSContext *cx, HandleScript script, const Value &thisv,
HandleObject scopeChain, ExecuteType type,
AbstractFramePtr evalInFrame);
// Called to invoke a function.
StackFrame *pushInvokeFrame(JSContext *cx, const CallArgs &args, InitialFrameFlags initial);
InterpreterFrame *pushInvokeFrame(JSContext *cx, const CallArgs &args,
InitialFrameFlags initial);
// The interpreter can push light-weight, "inline" frames without entering a
// new InterpreterActivation or recursively calling Interpret.
@ -1227,7 +1230,7 @@ class InterpreterActivation : public Activation
RunState &state_;
InterpreterRegs regs_;
StackFrame *entryFrame_;
InterpreterFrame *entryFrame_;
size_t opMask_; // For debugger interrupts, see js::Interpret.
#ifdef DEBUG
@ -1235,20 +1238,20 @@ class InterpreterActivation : public Activation
#endif
public:
inline InterpreterActivation(RunState &state, JSContext *cx, StackFrame *entryFrame);
inline InterpreterActivation(RunState &state, JSContext *cx, InterpreterFrame *entryFrame);
inline ~InterpreterActivation();
inline bool pushInlineFrame(const CallArgs &args, HandleScript script,
InitialFrameFlags initial);
inline void popInlineFrame(StackFrame *frame);
inline void popInlineFrame(InterpreterFrame *frame);
StackFrame *current() const {
InterpreterFrame *current() const {
return regs_.fp();
}
InterpreterRegs &regs() {
return regs_;
}
StackFrame *entryFrame() const {
InterpreterFrame *entryFrame() const {
return entryFrame_;
}
size_t opMask() const {
@ -1377,7 +1380,7 @@ class JitActivationIterator : public ActivationIterator
class InterpreterFrameIterator
{
InterpreterActivation *activation_;
StackFrame *fp_;
InterpreterFrame *fp_;
jsbytecode *pc_;
Value *sp_;
@ -1395,7 +1398,7 @@ class InterpreterFrameIterator
}
}
StackFrame *frame() const {
InterpreterFrame *frame() const {
JS_ASSERT(!done());
return fp_;
}
@ -1594,7 +1597,7 @@ class FrameIter
Data *copyData() const;
// This can only be called when isInterp():
inline StackFrame *interpFrame() const;
inline InterpreterFrame *interpFrame() const;
private:
Data data_;
@ -1773,7 +1776,7 @@ FrameIter::isBaseline() const
#endif
}
inline StackFrame *
inline InterpreterFrame *
FrameIter::interpFrame() const
{
JS_ASSERT(data_.state_ == INTERP);