mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-02 07:05:24 +00:00
Bug 1234845 part 6 - Simplify isEvalFrame, make it use script->isForEval() instead of flags. r=luke
This commit is contained in:
parent
fbc825f0b8
commit
063ad0b899
@ -357,13 +357,7 @@ BaselineCompiler::emitPrologue()
|
||||
// is passed in R1, so we have to be careful not to clobber it.
|
||||
|
||||
// Initialize BaselineFrame::flags.
|
||||
uint32_t flags = 0;
|
||||
if (script->isForEval())
|
||||
flags |= BaselineFrame::EVAL;
|
||||
masm.store32(Imm32(flags), frame.addressOfFlags());
|
||||
|
||||
if (script->isForEval())
|
||||
masm.storePtr(ImmGCPtr(script), frame.addressOfEvalScript());
|
||||
masm.store32(Imm32(0), frame.addressOfFlags());
|
||||
|
||||
// Handle scope chain pre-initialization (in case GC gets run
|
||||
// during stack check). For global and eval scripts, the scope
|
||||
|
@ -48,11 +48,8 @@ BaselineFrame::trace(JSTracer* trc, JitFrameIterator& frameIterator)
|
||||
if (hasReturnValue())
|
||||
TraceRoot(trc, returnValue().address(), "baseline-rval");
|
||||
|
||||
if (isEvalFrame()) {
|
||||
TraceRoot(trc, &evalScript_, "baseline-evalscript");
|
||||
if (script()->isDirectEvalInFunction())
|
||||
TraceRoot(trc, evalNewTargetAddress(), "baseline-evalNewTarget");
|
||||
}
|
||||
if (isEvalFrame() && script()->isDirectEvalInFunction())
|
||||
TraceRoot(trc, evalNewTargetAddress(), "baseline-evalNewTarget");
|
||||
|
||||
if (hasArgsObj())
|
||||
TraceRoot(trc, &argsObj_, "baseline-args-obj");
|
||||
@ -148,11 +145,6 @@ BaselineFrame::initForOsr(InterpreterFrame* fp, uint32_t numStackValues)
|
||||
if (fp->hasCallObjUnchecked())
|
||||
flags_ |= BaselineFrame::HAS_CALL_OBJ;
|
||||
|
||||
if (fp->isEvalFrame()) {
|
||||
flags_ |= BaselineFrame::EVAL;
|
||||
evalScript_ = fp->script();
|
||||
}
|
||||
|
||||
if (fp->script()->needsArgsObj() && fp->hasArgsObj()) {
|
||||
flags_ |= BaselineFrame::HAS_ARGS_OBJ;
|
||||
argsObj_ = &fp->argsObj();
|
||||
|
@ -24,13 +24,6 @@ struct BaselineDebugModeOSRInfo;
|
||||
// locals
|
||||
// stack values
|
||||
|
||||
// Eval frames
|
||||
//
|
||||
// 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
|
||||
// itself.
|
||||
class BaselineFrame
|
||||
{
|
||||
public:
|
||||
@ -53,8 +46,7 @@ class BaselineFrame
|
||||
// invariants of debuggee compartments, scripts, and frames.
|
||||
DEBUGGEE = 1 << 6,
|
||||
|
||||
// Eval frame, see the "eval frames" comment.
|
||||
EVAL = 1 << 7,
|
||||
// (1 << 7 and 1 << 8 are unused)
|
||||
|
||||
// Frame has over-recursed on an early check.
|
||||
OVER_RECURSED = 1 << 9,
|
||||
@ -100,9 +92,7 @@ class BaselineFrame
|
||||
uint32_t hiReturnValue_;
|
||||
uint32_t frameSize_;
|
||||
JSObject* scopeChain_; // Scope chain (always initialized).
|
||||
JSScript* evalScript_; // If isEvalFrame(), the current eval script.
|
||||
ArgumentsObject* argsObj_; // If HAS_ARGS_OBJ, the arguments object.
|
||||
void* unused; // See static assertion re: sizeof, below.
|
||||
uint32_t overrideOffset_; // If HAS_OVERRIDE_PC, the bytecode offset.
|
||||
uint32_t flags_;
|
||||
|
||||
@ -154,8 +144,6 @@ class BaselineFrame
|
||||
return CalleeTokenIsConstructing(calleeToken());
|
||||
}
|
||||
JSScript* script() const {
|
||||
if (isEvalFrame())
|
||||
return evalScript();
|
||||
return ScriptFromCalleeToken(calleeToken());
|
||||
}
|
||||
JSFunction* callee() const {
|
||||
@ -331,11 +319,6 @@ class BaselineFrame
|
||||
flags_ |= HAS_CACHED_SAVED_FRAME;
|
||||
}
|
||||
|
||||
JSScript* evalScript() const {
|
||||
MOZ_ASSERT(isEvalFrame());
|
||||
return evalScript_;
|
||||
}
|
||||
|
||||
bool overRecursed() const {
|
||||
return flags_ & OVER_RECURSED;
|
||||
}
|
||||
@ -394,7 +377,7 @@ class BaselineFrame
|
||||
return !CalleeTokenIsFunction(calleeToken());
|
||||
}
|
||||
bool isEvalFrame() const {
|
||||
return flags_ & EVAL;
|
||||
return script()->isForEval();
|
||||
}
|
||||
bool isStrictEvalFrame() const {
|
||||
return isEvalFrame() && script()->strict();
|
||||
@ -456,9 +439,6 @@ class BaselineFrame
|
||||
static int reverseOffsetOfFlags() {
|
||||
return -int(Size()) + offsetof(BaselineFrame, flags_);
|
||||
}
|
||||
static int reverseOffsetOfEvalScript() {
|
||||
return -int(Size()) + offsetof(BaselineFrame, evalScript_);
|
||||
}
|
||||
static int reverseOffsetOfReturnValue() {
|
||||
return -int(Size()) + offsetof(BaselineFrame, loReturnValue_);
|
||||
}
|
||||
|
@ -280,9 +280,6 @@ class FrameInfo
|
||||
Address addressOfFlags() const {
|
||||
return Address(BaselineFrameReg, BaselineFrame::reverseOffsetOfFlags());
|
||||
}
|
||||
Address addressOfEvalScript() const {
|
||||
return Address(BaselineFrameReg, BaselineFrame::reverseOffsetOfEvalScript());
|
||||
}
|
||||
Address addressOfReturnValue() const {
|
||||
return Address(BaselineFrameReg, BaselineFrame::reverseOffsetOfReturnValue());
|
||||
}
|
||||
|
@ -292,11 +292,7 @@ class InterpreterFrame
|
||||
enum Flags : uint32_t {
|
||||
/* Primary frame type */
|
||||
GLOBAL_OR_MODULE = 0x1, /* frame pushed for a global script */
|
||||
/* (0x2 and 0x4 are unused) */
|
||||
|
||||
/* Frame subtypes */
|
||||
EVAL = 0x8, /* frame pushed for eval() or debugger eval */
|
||||
|
||||
/* (0x2, 0x4, 0x8 are unused) */
|
||||
|
||||
/*
|
||||
* Frame pushed for debugger eval.
|
||||
@ -454,12 +450,13 @@ class InterpreterFrame
|
||||
/*
|
||||
* Stack frame type
|
||||
*
|
||||
* A stack frame may have one of three types, which determines which
|
||||
* A stack frame may have one of four types, which determines which
|
||||
* members of the frame may be accessed and other invariants:
|
||||
*
|
||||
* global frame: execution of global code or an eval in global code
|
||||
* function frame: execution of function code or an eval in a function
|
||||
* module frame: execution of a module
|
||||
* global frame: execution of global code
|
||||
* function frame: execution of function code
|
||||
* module frame: execution of a module
|
||||
* eval frame: execution of eval code
|
||||
*/
|
||||
|
||||
bool isGlobalOrModuleFrame() const {
|
||||
@ -475,20 +472,8 @@ class InterpreterFrame
|
||||
return isGlobalOrModuleFrame() && script()->module();
|
||||
}
|
||||
|
||||
/*
|
||||
* Eval frames
|
||||
*
|
||||
* 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 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
|
||||
* pushed for an ES5 strict-mode eval().
|
||||
*/
|
||||
|
||||
bool isEvalFrame() const {
|
||||
return flags_ & EVAL;
|
||||
return script_->isForEval();
|
||||
}
|
||||
|
||||
bool isFunctionFrame() const {
|
||||
|
Loading…
Reference in New Issue
Block a user