mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Remove imacros (bug 698201 part 2, r=luke).
This commit is contained in:
parent
8039f894d7
commit
36b619c3f6
@ -1346,41 +1346,7 @@ js_GetScriptedCaller(JSContext *cx, StackFrame *fp)
|
||||
jsbytecode*
|
||||
js_GetCurrentBytecodePC(JSContext* cx)
|
||||
{
|
||||
jsbytecode *pc, *imacpc;
|
||||
|
||||
#ifdef JS_TRACER
|
||||
if (JS_ON_TRACE(cx)) {
|
||||
pc = JS_TRACE_MONITOR_ON_TRACE(cx)->bailExit->pc;
|
||||
imacpc = JS_TRACE_MONITOR_ON_TRACE(cx)->bailExit->imacpc;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
JS_ASSERT_NOT_ON_TRACE(cx); /* for static analysis */
|
||||
pc = cx->hasfp() ? cx->regs().pc : NULL;
|
||||
if (!pc)
|
||||
return NULL;
|
||||
imacpc = cx->fp()->maybeImacropc();
|
||||
}
|
||||
|
||||
/*
|
||||
* If we are inside GetProperty_tn or similar, return a pointer to the
|
||||
* current instruction in the script, not the CALL instruction in the
|
||||
* imacro, for the benefit of callers doing bytecode inspection.
|
||||
*/
|
||||
return (*pc == JSOP_CALL && imacpc) ? imacpc : pc;
|
||||
}
|
||||
|
||||
bool
|
||||
js_CurrentPCIsInImacro(JSContext *cx)
|
||||
{
|
||||
#ifdef JS_TRACER
|
||||
VOUCH_DOES_NOT_REQUIRE_STACK();
|
||||
if (JS_ON_TRACE(cx))
|
||||
return JS_TRACE_MONITOR_ON_TRACE(cx)->bailExit->imacpc != NULL;
|
||||
return cx->fp()->hasImacropc();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
return cx->hasfp() ? cx->regs().pc : NULL;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2185,9 +2185,6 @@ js_GetCurrentBytecodePC(JSContext* cx);
|
||||
extern JSScript *
|
||||
js_GetCurrentScript(JSContext* cx);
|
||||
|
||||
extern bool
|
||||
js_CurrentPCIsInImacro(JSContext *cx);
|
||||
|
||||
namespace js {
|
||||
|
||||
extern JS_FORCES_STACK JS_FRIEND_API(void)
|
||||
|
@ -402,9 +402,7 @@ LeaveTraceIfArgumentsObject(JSContext *cx, JSObject *obj)
|
||||
static inline JSAtom **
|
||||
FrameAtomBase(JSContext *cx, js::StackFrame *fp)
|
||||
{
|
||||
return fp->hasImacropc()
|
||||
? cx->runtime->atomState.commonAtomsStart()
|
||||
: fp->script()->atoms;
|
||||
return fp->script()->atoms;
|
||||
}
|
||||
|
||||
} /* namespace js */
|
||||
|
@ -152,7 +152,7 @@ js::GetBlockChain(JSContext *cx, StackFrame *fp)
|
||||
return NULL;
|
||||
|
||||
/* Assume that imacros don't affect blockChain */
|
||||
jsbytecode *target = fp->hasImacropc() ? fp->imacropc() : fp->pcQuadratic(cx->stack);
|
||||
jsbytecode *target = fp->pcQuadratic(cx->stack);
|
||||
|
||||
JSScript *script = fp->script();
|
||||
jsbytecode *start = script->code;
|
||||
@ -1695,10 +1695,7 @@ js::Interpret(JSContext *cx, StackFrame *entryFrame, InterpMode interpMode)
|
||||
|
||||
#define LOAD_ATOM(PCOFF, atom) \
|
||||
JS_BEGIN_MACRO \
|
||||
JS_ASSERT(regs.fp()->hasImacropc() \
|
||||
? atoms == rt->atomState.commonAtomsStart() && \
|
||||
GET_INDEX(regs.pc + PCOFF) < js_common_atom_count \
|
||||
: (size_t)(atoms - script->atoms) < \
|
||||
JS_ASSERT((size_t)(atoms - script->atoms) < \
|
||||
(size_t)(script->natoms - GET_INDEX(regs.pc + PCOFF))); \
|
||||
atom = atoms[GET_INDEX(regs.pc + PCOFF)]; \
|
||||
JS_END_MACRO
|
||||
@ -1880,9 +1877,6 @@ js::Interpret(JSContext *cx, StackFrame *entryFrame, InterpMode interpMode)
|
||||
} else if (TRACE_RECORDER(cx)) {
|
||||
AbortRecording(cx, "attempt to reenter interpreter while recording");
|
||||
}
|
||||
|
||||
if (regs.fp()->hasImacropc())
|
||||
atoms = rt->atomState.commonAtomsStart();
|
||||
#endif
|
||||
|
||||
/* Don't call the script prologue if executing between Method and Trace JIT. */
|
||||
@ -1978,10 +1972,8 @@ js::Interpret(JSContext *cx, StackFrame *entryFrame, InterpMode interpMode)
|
||||
bool moreInterrupts = false;
|
||||
|
||||
if (script->pcCounters) {
|
||||
if (!regs.fp()->hasImacropc()) {
|
||||
OpcodeCounts counts = script->getCounts(regs.pc);
|
||||
counts.get(OpcodeCounts::BASE_INTERP)++;
|
||||
}
|
||||
moreInterrupts = true;
|
||||
}
|
||||
|
||||
@ -2074,6 +2066,7 @@ js::Interpret(JSContext *cx, StackFrame *entryFrame, InterpMode interpMode)
|
||||
|
||||
/* No-ops for ease of decompilation. */
|
||||
ADD_EMPTY_CASE(JSOP_NOP)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED0)
|
||||
ADD_EMPTY_CASE(JSOP_CONDSWITCH)
|
||||
ADD_EMPTY_CASE(JSOP_TRY)
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
@ -2219,30 +2212,10 @@ BEGIN_CASE(JSOP_STOP)
|
||||
*/
|
||||
CHECK_BRANCH();
|
||||
|
||||
#ifdef JS_TRACER
|
||||
if (regs.fp()->hasImacropc()) {
|
||||
/*
|
||||
* If we are at the end of an imacro, return to its caller in the
|
||||
* current frame.
|
||||
*/
|
||||
JS_ASSERT(op == JSOP_STOP);
|
||||
JS_ASSERT((uintN)(regs.sp - regs.fp()->slots()) <= script->nslots);
|
||||
jsbytecode *imacpc = regs.fp()->imacropc();
|
||||
regs.pc = imacpc + js_CodeSpec[*imacpc].length;
|
||||
if (js_CodeSpec[*imacpc].format & JOF_DECOMPOSE)
|
||||
regs.pc += GetDecomposeLength(imacpc, js_CodeSpec[*imacpc].length);
|
||||
regs.fp()->clearImacropc();
|
||||
atoms = script->atoms;
|
||||
op = JSOp(*regs.pc);
|
||||
DO_OP();
|
||||
}
|
||||
#endif
|
||||
|
||||
interpReturnOK = true;
|
||||
if (entryFrame != regs.fp())
|
||||
inline_return:
|
||||
{
|
||||
JS_ASSERT(!regs.fp()->hasImacropc());
|
||||
JS_ASSERT(!IsActiveWithOrBlock(cx, regs.fp()->scopeChain(), 0));
|
||||
interpReturnOK = ScriptEpilogue(cx, regs.fp(), interpReturnOK);
|
||||
|
||||
@ -2679,11 +2652,6 @@ BEGIN_CASE(JSOP_BINDNAME)
|
||||
}
|
||||
END_CASE(JSOP_BINDNAME)
|
||||
|
||||
BEGIN_CASE(JSOP_IMACOP)
|
||||
JS_ASSERT(UnsignedPtrDiff(regs.fp()->imacropc(), script->code) < script->length);
|
||||
op = JSOp(*regs.fp()->imacropc());
|
||||
DO_OP();
|
||||
|
||||
#define BITWISE_OP(OP) \
|
||||
JS_BEGIN_MACRO \
|
||||
int32_t i, j; \
|
||||
@ -3467,9 +3435,7 @@ BEGIN_CASE(JSOP_LENGTH)
|
||||
} else {
|
||||
JS_ASSERT(entry->vword.isShape());
|
||||
const Shape *shape = entry->vword.toShape();
|
||||
NATIVE_GET(cx, obj, obj2, shape,
|
||||
regs.fp()->hasImacropc() ? JSGET_NO_METHOD_BARRIER : JSGET_METHOD_BARRIER,
|
||||
&rval);
|
||||
NATIVE_GET(cx, obj, obj2, shape, JSGET_METHOD_BARRIER, &rval);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -3477,8 +3443,7 @@ BEGIN_CASE(JSOP_LENGTH)
|
||||
jsid id = ATOM_TO_JSID(atom);
|
||||
if (JS_LIKELY(!aobj->getOps()->getProperty)
|
||||
? !js_GetPropertyHelper(cx, obj, id,
|
||||
(regs.fp()->hasImacropc() ||
|
||||
regs.pc[JSOP_GETPROP_LENGTH] == JSOP_IFEQ)
|
||||
(regs.pc[JSOP_GETPROP_LENGTH] == JSOP_IFEQ)
|
||||
? JSGET_CACHE_RESULT | JSGET_NO_METHOD_BARRIER
|
||||
: JSGET_CACHE_RESULT | JSGET_METHOD_BARRIER,
|
||||
&rval)
|
||||
@ -3799,7 +3764,7 @@ BEGIN_CASE(JSOP_GETELEM)
|
||||
if (!obj->getElement(cx, index, &rval))
|
||||
goto error;
|
||||
} else {
|
||||
if (script->hasAnalysis() && !regs.fp()->hasImacropc())
|
||||
if (script->hasAnalysis())
|
||||
script->analysis()->getCode(regs.pc).getStringElement = true;
|
||||
|
||||
SpecialId special;
|
||||
@ -3883,7 +3848,7 @@ BEGIN_CASE(JSOP_SETELEM)
|
||||
obj->setDenseArrayElementWithType(cx, i, regs.sp[-1]);
|
||||
goto end_setelem;
|
||||
} else {
|
||||
if (script->hasAnalysis() && !regs.fp()->hasImacropc())
|
||||
if (script->hasAnalysis())
|
||||
script->analysis()->getCode(regs.pc).arrayWriteHole = true;
|
||||
}
|
||||
}
|
||||
@ -4131,7 +4096,6 @@ END_CASE(JSOP_RESETBASE)
|
||||
|
||||
BEGIN_CASE(JSOP_DOUBLE)
|
||||
{
|
||||
JS_ASSERT(!regs.fp()->hasImacropc());
|
||||
double dbl;
|
||||
LOAD_DOUBLE(0, dbl);
|
||||
PUSH_DOUBLE(dbl);
|
||||
@ -4282,7 +4246,6 @@ BEGIN_CASE(JSOP_LOOKUPSWITCH)
|
||||
* JSOP_LOOKUPSWITCH and JSOP_LOOKUPSWITCHX are never used if any atom
|
||||
* index in it would exceed 64K limit.
|
||||
*/
|
||||
JS_ASSERT(!regs.fp()->hasImacropc());
|
||||
JS_ASSERT(atoms == script->atoms);
|
||||
jsbytecode *pc2 = regs.pc;
|
||||
|
||||
@ -5893,16 +5856,7 @@ END_CASE(JSOP_ARRAYPUSH)
|
||||
|
||||
error:
|
||||
JS_ASSERT(&cx->regs() == ®s);
|
||||
#ifdef JS_TRACER
|
||||
if (regs.fp()->hasImacropc() && cx->isExceptionPending()) {
|
||||
// Handle exceptions as if they came from the imacro-calling pc.
|
||||
regs.pc = regs.fp()->imacropc();
|
||||
regs.fp()->clearImacropc();
|
||||
}
|
||||
#endif
|
||||
|
||||
JS_ASSERT(size_t((regs.fp()->hasImacropc() ? regs.fp()->imacropc() : regs.pc) - script->code) <
|
||||
script->length);
|
||||
JS_ASSERT(uint32(regs.pc - script->code) < script->length);
|
||||
|
||||
#ifdef JS_TRACER
|
||||
/*
|
||||
|
@ -3153,7 +3153,7 @@ Detecting(JSContext *cx, jsbytecode *pc)
|
||||
JSScript *script = cx->stack.currentScript();
|
||||
endpc = script->code + script->length;
|
||||
for (;; pc += js_CodeSpec[op].length) {
|
||||
JS_ASSERT_IF(!cx->fp()->hasImacropc(), script->code <= pc && pc < endpc);
|
||||
JS_ASSERT(script->code <= pc && pc < endpc);
|
||||
|
||||
/* General case: a branch or equality op follows the access. */
|
||||
op = js_GetOpcode(cx, script, pc);
|
||||
@ -5733,7 +5733,7 @@ js_NativeGetInline(JSContext *cx, JSObject *receiver, JSObject *obj, JSObject *p
|
||||
|
||||
jsbytecode *pc;
|
||||
JSScript *script = cx->stack.currentScript(&pc);
|
||||
if (script && script->hasAnalysis() && !cx->fp()->hasImacropc()) {
|
||||
if (script && script->hasAnalysis()) {
|
||||
analyze::Bytecode *code = script->analysis()->maybeCode(pc);
|
||||
if (code)
|
||||
code->accessGetter = true;
|
||||
@ -5867,8 +5867,7 @@ js_GetPropertyHelperInline(JSContext *cx, JSObject *obj, JSObject *receiver, jsi
|
||||
} else {
|
||||
if (!cx->hasStrictOption() ||
|
||||
cx->stack.currentScript()->warnedAboutUndefinedProp ||
|
||||
(op != JSOP_GETPROP && op != JSOP_GETELEM) ||
|
||||
js_CurrentPCIsInImacro(cx)) {
|
||||
(op != JSOP_GETPROP && op != JSOP_GETELEM)) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
@ -7418,12 +7417,6 @@ js_DumpStackFrame(JSContext *cx, StackFrame *start)
|
||||
fprintf(stderr, "*** pc && !script, skipping frame\n\n");
|
||||
continue;
|
||||
}
|
||||
if (fp->hasImacropc()) {
|
||||
fprintf(stderr, " pc in imacro at %p\n called from ", pc);
|
||||
pc = fp->imacropc();
|
||||
} else {
|
||||
fprintf(stderr, " ");
|
||||
}
|
||||
fprintf(stderr, " pc = %p\n", pc);
|
||||
fprintf(stderr, " current op: %s\n", js_CodeName[*pc]);
|
||||
}
|
||||
|
@ -5161,7 +5161,7 @@ js_DecompileValueGenerator(JSContext *cx, intN spindex, jsval v,
|
||||
|
||||
fp = js_GetTopStackFrame(cx, FRAME_EXPAND_ALL);
|
||||
script = fp->script();
|
||||
pc = fp->hasImacropc() ? fp->imacropc() : cx->regs().pc;
|
||||
pc = cx->regs().pc;
|
||||
JS_ASSERT(script->code <= pc && pc < script->code + script->length);
|
||||
|
||||
if (pc < script->main())
|
||||
@ -5223,28 +5223,7 @@ js_DecompileValueGenerator(JSContext *cx, intN spindex, jsval v,
|
||||
}
|
||||
|
||||
{
|
||||
jsbytecode* basepc = cx->regs().pc;
|
||||
jsbytecode* savedImacropc = fp->maybeImacropc();
|
||||
if (savedImacropc) {
|
||||
cx->regs().pc = savedImacropc;
|
||||
fp->clearImacropc();
|
||||
}
|
||||
|
||||
/*
|
||||
* FIXME: bug 489843. Stack reconstruction may have returned a pc
|
||||
* value *inside* an imacro; this would confuse the decompiler.
|
||||
*/
|
||||
char *name;
|
||||
if (savedImacropc && size_t(pc - script->code) >= script->length)
|
||||
name = FAILED_EXPRESSION_DECOMPILER;
|
||||
else
|
||||
name = DecompileExpression(cx, script, fp->maybeFun(), pc);
|
||||
|
||||
if (savedImacropc) {
|
||||
cx->regs().pc = basepc;
|
||||
fp->setImacropc(savedImacropc);
|
||||
}
|
||||
|
||||
char *name = DecompileExpression(cx, script, fp->maybeFun(), pc);
|
||||
if (name != FAILED_EXPRESSION_DECOMPILER)
|
||||
return name;
|
||||
}
|
||||
@ -5424,95 +5403,6 @@ SimulateOp(JSContext *cx, JSScript *script, JSOp op, const JSCodeSpec *cs,
|
||||
return pcdepth;
|
||||
}
|
||||
|
||||
#ifdef JS_TRACER
|
||||
|
||||
#undef LOCAL_ASSERT
|
||||
#define LOCAL_ASSERT(expr) LOCAL_ASSERT_CUSTOM(expr, goto failure);
|
||||
|
||||
static intN
|
||||
SimulateImacroCFG(JSContext *cx, JSScript *script,
|
||||
uintN pcdepth, jsbytecode *pc, jsbytecode *target,
|
||||
jsbytecode **pcstack)
|
||||
{
|
||||
size_t nbytes = 0;
|
||||
jsbytecode** tmp_pcstack = NULL;
|
||||
if (pcstack) {
|
||||
nbytes = StackDepth(script) * sizeof *pcstack;
|
||||
tmp_pcstack = (jsbytecode **) cx->malloc_(nbytes);
|
||||
if (!tmp_pcstack)
|
||||
return -1;
|
||||
memcpy(tmp_pcstack, pcstack, nbytes);
|
||||
}
|
||||
|
||||
ptrdiff_t oplen;
|
||||
for (; pc < target; pc += oplen) {
|
||||
JSOp op = js_GetOpcode(cx, script, pc);
|
||||
const JSCodeSpec *cs = &js_CodeSpec[op];
|
||||
oplen = cs->length;
|
||||
if (oplen < 0)
|
||||
oplen = js_GetVariableBytecodeLength(pc);
|
||||
|
||||
if (SimulateOp(cx, script, op, cs, pc, tmp_pcstack, pcdepth) < 0)
|
||||
goto failure;
|
||||
|
||||
uint32 type = cs->format & JOF_TYPEMASK;
|
||||
if (type == JOF_JUMP || type == JOF_JUMPX) {
|
||||
ptrdiff_t jmpoff = (type == JOF_JUMP) ? GET_JUMP_OFFSET(pc)
|
||||
: GET_JUMPX_OFFSET(pc);
|
||||
LOCAL_ASSERT(jmpoff >= 0);
|
||||
intN tmp_pcdepth = SimulateImacroCFG(cx, script, pcdepth, pc + jmpoff,
|
||||
target, tmp_pcstack);
|
||||
if (tmp_pcdepth >= 0) {
|
||||
pcdepth = uintN(tmp_pcdepth);
|
||||
goto success;
|
||||
}
|
||||
|
||||
if (op == JSOP_GOTO || op == JSOP_GOTOX)
|
||||
goto failure;
|
||||
}
|
||||
}
|
||||
|
||||
if (pc > target)
|
||||
goto failure;
|
||||
|
||||
LOCAL_ASSERT(pc == target);
|
||||
|
||||
success:
|
||||
if (tmp_pcstack) {
|
||||
memcpy(pcstack, tmp_pcstack, nbytes);
|
||||
cx->free_(tmp_pcstack);
|
||||
}
|
||||
return pcdepth;
|
||||
|
||||
failure:
|
||||
if (tmp_pcstack)
|
||||
cx->free_(tmp_pcstack);
|
||||
return -1;
|
||||
}
|
||||
|
||||
#undef LOCAL_ASSERT
|
||||
#define LOCAL_ASSERT(expr) LOCAL_ASSERT_RV(expr, -1);
|
||||
|
||||
static intN
|
||||
ReconstructImacroPCStack(JSContext *cx, JSScript *script,
|
||||
jsbytecode *imacstart, jsbytecode *target,
|
||||
jsbytecode **pcstack)
|
||||
{
|
||||
/*
|
||||
* Begin with a recursive call back to ReconstructPCStack to pick up
|
||||
* the state-of-the-world at the *start* of the imacro.
|
||||
*/
|
||||
StackFrame *fp = js_GetScriptedCaller(cx, NULL);
|
||||
JS_ASSERT(fp->hasImacropc());
|
||||
intN pcdepth = ReconstructPCStack(cx, script, fp->imacropc(), pcstack);
|
||||
if (pcdepth < 0)
|
||||
return pcdepth;
|
||||
return SimulateImacroCFG(cx, script, pcdepth, imacstart, target, pcstack);
|
||||
}
|
||||
|
||||
extern jsbytecode* js_GetImacroStart(jsbytecode* pc);
|
||||
#endif
|
||||
|
||||
static intN
|
||||
ReconstructPCStack(JSContext *cx, JSScript *script, jsbytecode *target,
|
||||
jsbytecode **pcstack)
|
||||
@ -5524,12 +5414,6 @@ ReconstructPCStack(JSContext *cx, JSScript *script, jsbytecode *target,
|
||||
* FIXME: Code to compute oplen copied from js_Disassemble1 and reduced.
|
||||
* FIXME: Optimize to use last empty-stack sequence point.
|
||||
*/
|
||||
#ifdef JS_TRACER
|
||||
jsbytecode *imacstart = js_GetImacroStart(target);
|
||||
|
||||
if (imacstart)
|
||||
return ReconstructImacroPCStack(cx, script, imacstart, target, pcstack);
|
||||
#endif
|
||||
|
||||
LOCAL_ASSERT(script->code <= target && target < script->code + script->length);
|
||||
jsbytecode *pc = script->code;
|
||||
|
@ -347,16 +347,6 @@ js_GetIndexFromBytecode(JSContext *cx, JSScript *script, jsbytecode *pc,
|
||||
JS_GET_SCRIPT_ATOM(script, pc, index_, atom); \
|
||||
JS_END_MACRO
|
||||
|
||||
/*
|
||||
* Variant for getting a double atom when we might be in an imacro. Bytecodes
|
||||
* with literals that are only ever doubles must use this macro, and never use
|
||||
* GET_ATOM_FROM_BYTECODE or JS_GET_SCRIPT_ATOM.
|
||||
*
|
||||
* Unfortunately some bytecodes such as JSOP_LOOKUPSWITCH have immediates that
|
||||
* might be string or double atoms. Those opcodes cannot be used from imacros.
|
||||
* See the assertions in the JSOP_DOUBLE and JSOP_LOOKUPSWTICH* opcode cases in
|
||||
* jsinterp.cpp.
|
||||
*/
|
||||
#define GET_DOUBLE_FROM_BYTECODE(script, pc, pcoff, dbl) \
|
||||
JS_BEGIN_MACRO \
|
||||
uintN index_ = js_GetIndexFromBytecode(cx, (script), (pc), (pcoff)); \
|
||||
|
@ -272,7 +272,7 @@ OPDEF(JSOP_DECLOCAL, 102,"declocal", NULL, 3, 0, 1, 15, JOF_LOCAL|
|
||||
OPDEF(JSOP_LOCALINC, 103,"localinc", NULL, 3, 0, 1, 15, JOF_LOCAL|JOF_NAME|JOF_INC|JOF_POST|JOF_TMPSLOT3)
|
||||
OPDEF(JSOP_LOCALDEC, 104,"localdec", NULL, 3, 0, 1, 15, JOF_LOCAL|JOF_NAME|JOF_DEC|JOF_POST|JOF_TMPSLOT3)
|
||||
|
||||
OPDEF(JSOP_IMACOP, 105,"imacop", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_UNUSED0, 105,"unused0", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
|
||||
/* The argument is the offset to the next statement and is used by IonMonkey. */
|
||||
OPDEF(JSOP_LABEL, 106,"label", NULL, 3, 0, 0, 0, JOF_JUMP)
|
||||
|
@ -327,8 +327,7 @@ PropertyCache::fullTest(JSContext *cx, jsbytecode *pc, JSObject **objp, JSObject
|
||||
JSScript *script = cx->stack.currentScript();
|
||||
|
||||
JS_ASSERT(this == &JS_PROPERTY_CACHE(cx));
|
||||
JS_ASSERT(uintN((cx->fp()->hasImacropc() ? cx->fp()->imacropc() : pc) - script->code)
|
||||
< script->length);
|
||||
JS_ASSERT(uint32(pc - script->code) < script->length);
|
||||
|
||||
JSOp op = js_GetOpcode(cx, script, pc);
|
||||
const JSCodeSpec &cs = js_CodeSpec[op];
|
||||
|
@ -1431,7 +1431,7 @@ js_GetSrcNoteCached(JSContext *cx, JSScript *script, jsbytecode *pc)
|
||||
uintN
|
||||
js_FramePCToLineNumber(JSContext *cx, StackFrame *fp, jsbytecode *pc)
|
||||
{
|
||||
return js_PCToLineNumber(cx, fp->script(), fp->hasImacropc() ? fp->imacropc() : pc);
|
||||
return js_PCToLineNumber(cx, fp->script(), pc);
|
||||
}
|
||||
|
||||
uintN
|
||||
|
@ -1578,9 +1578,7 @@ InlineGetProp(VMFrame &f)
|
||||
} else {
|
||||
JS_ASSERT(entry->vword.isShape());
|
||||
const Shape *shape = entry->vword.toShape();
|
||||
NATIVE_GET(cx, obj, obj2, shape,
|
||||
f.fp()->hasImacropc() ? JSGET_NO_METHOD_BARRIER : JSGET_METHOD_BARRIER,
|
||||
&rval, return false);
|
||||
NATIVE_GET(cx, obj, obj2, shape, JSGET_METHOD_BARRIER, &rval, return false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1588,9 +1586,7 @@ InlineGetProp(VMFrame &f)
|
||||
jsid id = ATOM_TO_JSID(atom);
|
||||
if (JS_LIKELY(!aobj->getOps()->getProperty)
|
||||
? !js_GetPropertyHelper(cx, obj, id,
|
||||
f.fp()->hasImacropc()
|
||||
? JSGET_CACHE_RESULT | JSGET_NO_METHOD_BARRIER
|
||||
: JSGET_CACHE_RESULT | JSGET_METHOD_BARRIER,
|
||||
JSGET_CACHE_RESULT | JSGET_METHOD_BARRIER,
|
||||
&rval)
|
||||
: !obj->getGeneric(cx, id, &rval)) {
|
||||
return false;
|
||||
|
@ -62,7 +62,7 @@ StackFrame::initPrev(JSContext *cx)
|
||||
prev_ = regs->fp();
|
||||
prevpc_ = regs->pc;
|
||||
prevInline_ = regs->inlined();
|
||||
JS_ASSERT_IF(!prev_->isDummyFrame() && !prev_->hasImacropc(),
|
||||
JS_ASSERT_IF(!prev_->isDummyFrame(),
|
||||
uint32(prevpc_ - prev_->script()->code) < prev_->script()->length);
|
||||
} else {
|
||||
prev_ = NULL;
|
||||
@ -120,7 +120,6 @@ StackFrame::initCallFrame(JSContext *cx, JSObject &callee, JSFunction *fun,
|
||||
scopeChain_ = callee.getParent();
|
||||
ncode_ = NULL;
|
||||
initPrev(cx);
|
||||
JS_ASSERT(!hasImacropc());
|
||||
JS_ASSERT(!hasHookData());
|
||||
JS_ASSERT(annotation() == NULL);
|
||||
JS_ASSERT(!hasCallObj());
|
||||
@ -638,12 +637,8 @@ ContextStack::currentScript(jsbytecode **ppc) const
|
||||
if (script->compartment() != cx_->compartment)
|
||||
return NULL;
|
||||
|
||||
if (ppc) {
|
||||
if (fp->hasImacropc())
|
||||
*ppc = fp->imacropc();
|
||||
else
|
||||
if (ppc)
|
||||
*ppc = fp->pcQuadratic(*this);
|
||||
}
|
||||
return script;
|
||||
}
|
||||
|
||||
|
@ -1047,7 +1047,7 @@ StackIter::settleOnNewState()
|
||||
if (op == JSOP_CALL || op == JSOP_FUNCALL) {
|
||||
uintN argc = GET_ARGC(pc_);
|
||||
DebugOnly<uintN> spoff = sp_ - fp_->base();
|
||||
JS_ASSERT_IF(cx_->stackIterAssertionEnabled && !fp_->hasImacropc(),
|
||||
JS_ASSERT_IF(cx_->stackIterAssertionEnabled,
|
||||
spoff == js_ReconstructStackDepth(cx_, fp_->script(), pc_));
|
||||
Value *vp = sp_ - (2 + argc);
|
||||
|
||||
@ -1063,8 +1063,7 @@ StackIter::settleOnNewState()
|
||||
DebugOnly<JSScript *> script = fp_->script();
|
||||
JS_ASSERT_IF(op != JSOP_FUNAPPLY,
|
||||
sp_ >= fp_->base() && sp_ <= fp_->slots() + script->nslots);
|
||||
JS_ASSERT_IF(!fp_->hasImacropc(),
|
||||
pc_ >= script->code && pc_ < script->code + script->length);
|
||||
JS_ASSERT(pc_ >= script->code && pc_ < script->code + script->length);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -338,18 +338,17 @@ class StackFrame
|
||||
UNDERFLOW_ARGS = 0x1000, /* numActualArgs < numFormalArgs */
|
||||
|
||||
/* Lazy frame initialization */
|
||||
HAS_IMACRO_PC = 0x2000, /* frame has imacpc value available */
|
||||
HAS_CALL_OBJ = 0x4000, /* frame has a callobj reachable from scopeChain_ */
|
||||
HAS_ARGS_OBJ = 0x8000, /* frame has an argsobj in StackFrame::args */
|
||||
HAS_HOOK_DATA = 0x10000, /* frame has hookData_ set */
|
||||
HAS_ANNOTATION = 0x20000, /* frame has annotation_ set */
|
||||
HAS_RVAL = 0x40000, /* frame has rval_ set */
|
||||
HAS_SCOPECHAIN = 0x80000, /* frame has scopeChain_ set */
|
||||
HAS_PREVPC = 0x100000, /* frame has prevpc_ and prevInline_ set */
|
||||
HAS_CALL_OBJ = 0x2000, /* frame has a callobj reachable from scopeChain_ */
|
||||
HAS_ARGS_OBJ = 0x4000, /* frame has an argsobj in StackFrame::args */
|
||||
HAS_HOOK_DATA = 0x8000, /* frame has hookData_ set */
|
||||
HAS_ANNOTATION = 0x10000, /* frame has annotation_ set */
|
||||
HAS_RVAL = 0x20000, /* frame has rval_ set */
|
||||
HAS_SCOPECHAIN = 0x40000, /* frame has scopeChain_ set */
|
||||
HAS_PREVPC = 0x80000, /* frame has prevpc_ and prevInline_ set */
|
||||
|
||||
/* Method JIT state */
|
||||
DOWN_FRAMES_EXPANDED = 0x200000, /* inlining in down frames has been expanded */
|
||||
LOWERED_CALL_APPLY = 0x400000 /* Pushed by a lowered call/apply */
|
||||
DOWN_FRAMES_EXPANDED = 0x100000, /* inlining in down frames has been expanded */
|
||||
LOWERED_CALL_APPLY = 0x200000 /* Pushed by a lowered call/apply */
|
||||
};
|
||||
|
||||
private:
|
||||
@ -371,7 +370,6 @@ class StackFrame
|
||||
Value rval_; /* return value of the frame */
|
||||
jsbytecode *prevpc_; /* pc of previous frame*/
|
||||
JSInlinedSite *prevInline_; /* inlined site in previous frame */
|
||||
jsbytecode *imacropc_; /* pc of macro caller */
|
||||
void *hookData_; /* closure returned by call hook */
|
||||
void *annotation_; /* perhaps remove with bug 546848 */
|
||||
JSRejoinState rejoin_; /* If rejoining into the interpreter
|
||||
@ -896,38 +894,6 @@ class StackFrame
|
||||
return scopeChain().compartment();
|
||||
}
|
||||
|
||||
/*
|
||||
* Imacropc
|
||||
*
|
||||
* A frame's IMacro pc is the bytecode address when an imacro started
|
||||
* executing (guaranteed non-null). An imacro does not push a frame, so
|
||||
* when the imacro finishes, the frame's IMacro pc becomes the current pc.
|
||||
*/
|
||||
|
||||
bool hasImacropc() const {
|
||||
return flags_ & HAS_IMACRO_PC;
|
||||
}
|
||||
|
||||
jsbytecode *imacropc() const {
|
||||
JS_ASSERT(hasImacropc());
|
||||
return imacropc_;
|
||||
}
|
||||
|
||||
jsbytecode *maybeImacropc() const {
|
||||
return hasImacropc() ? imacropc() : NULL;
|
||||
}
|
||||
|
||||
void clearImacropc() {
|
||||
flags_ &= ~HAS_IMACRO_PC;
|
||||
}
|
||||
|
||||
void setImacropc(jsbytecode *pc) {
|
||||
JS_ASSERT(pc);
|
||||
JS_ASSERT(!(flags_ & HAS_IMACRO_PC));
|
||||
imacropc_ = pc;
|
||||
flags_ |= HAS_IMACRO_PC;
|
||||
}
|
||||
|
||||
/* Annotation (will be removed after bug 546848) */
|
||||
|
||||
void* annotation() const {
|
||||
|
@ -55,7 +55,7 @@ class GeneratorFrameGuard;
|
||||
enum InitialFrameFlags {
|
||||
INITIAL_NONE = 0,
|
||||
INITIAL_CONSTRUCT = 0x80, /* == StackFrame::CONSTRUCTING, asserted in Stack.h */
|
||||
INITIAL_LOWERED = 0x400000 /* == StackFrame::LOWERED_CALL_APPLY, asserted in Stack.h */
|
||||
INITIAL_LOWERED = 0x200000 /* == StackFrame::LOWERED_CALL_APPLY, asserted in Stack.h */
|
||||
};
|
||||
|
||||
enum ExecuteType {
|
||||
|
Loading…
Reference in New Issue
Block a user