зеркало из https://github.com/mozilla/gecko-dev.git
Bug 680562 - Remove CHECK_INTERRUPT_HANDLER (r=jimb)
This commit is contained in:
Родитель
7d3af7da1f
Коммит
77c3bf67cc
|
@ -223,7 +223,9 @@ JS_SetInterrupt(JSRuntime *rt, JSInterruptHook hook, void *closure)
|
|||
{
|
||||
rt->debugHooks.interruptHook = hook;
|
||||
rt->debugHooks.interruptHookData = closure;
|
||||
return JS_TRUE;
|
||||
for (InterpreterFrames *f = rt->interpreterFrames; f; f = f->older)
|
||||
f->enableInterruptsUnconditionally();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
|
|
|
@ -923,7 +923,7 @@ template<typename T>
|
|||
class GenericInterruptEnabler : public InterpreterFrames::InterruptEnablerBase {
|
||||
public:
|
||||
GenericInterruptEnabler(T *variable, T value) : variable(variable), value(value) { }
|
||||
void enableInterrupts() const { *variable = value; }
|
||||
void enable() const { *variable = value; }
|
||||
|
||||
private:
|
||||
T *variable;
|
||||
|
@ -1088,7 +1088,7 @@ js::Interpret(JSContext *cx, StackFrame *entryFrame, InterpMode interpMode)
|
|||
register void * const *jumpTable = normalJumpTable;
|
||||
|
||||
typedef GenericInterruptEnabler<void * const *> InterruptEnabler;
|
||||
InterruptEnabler interruptEnabler(&jumpTable, interruptJumpTable);
|
||||
InterruptEnabler interrupts(&jumpTable, interruptJumpTable);
|
||||
|
||||
# define DO_OP() JS_BEGIN_MACRO \
|
||||
CHECK_PCCOUNT_INTERRUPTS(); \
|
||||
|
@ -1116,7 +1116,7 @@ js::Interpret(JSContext *cx, StackFrame *entryFrame, InterpMode interpMode)
|
|||
register int switchMask = 0;
|
||||
int switchOp;
|
||||
typedef GenericInterruptEnabler<int> InterruptEnabler;
|
||||
InterruptEnabler interruptEnabler(&switchMask, -1);
|
||||
InterruptEnabler interrupts(&switchMask, -1);
|
||||
|
||||
# define DO_OP() goto do_op
|
||||
# define DO_NEXT_OP(n) JS_BEGIN_MACRO \
|
||||
|
@ -1151,8 +1151,6 @@ js::Interpret(JSContext *cx, StackFrame *entryFrame, InterpMode interpMode)
|
|||
|
||||
#endif /* !JS_THREADED_INTERP */
|
||||
|
||||
#define ENABLE_INTERRUPTS() (interruptEnabler.enableInterrupts())
|
||||
|
||||
#define LOAD_DOUBLE(PCOFF, dbl) \
|
||||
(dbl = script->getConst(GET_UINT32_INDEX(regs.pc + (PCOFF))).toDouble())
|
||||
|
||||
|
@ -1214,20 +1212,12 @@ js::Interpret(JSContext *cx, StackFrame *entryFrame, InterpMode interpMode)
|
|||
#define SET_SCRIPT(s) \
|
||||
JS_BEGIN_MACRO \
|
||||
script = (s); \
|
||||
if (script->hasAnyBreakpointsOrStepMode()) \
|
||||
ENABLE_INTERRUPTS(); \
|
||||
if (script->hasScriptCounts) \
|
||||
ENABLE_INTERRUPTS(); \
|
||||
if (script->hasAnyBreakpointsOrStepMode() || script->hasScriptCounts) \
|
||||
interrupts.enable(); \
|
||||
JS_ASSERT_IF(interpMode == JSINTERP_SKIP_TRAP, \
|
||||
script->hasAnyBreakpointsOrStepMode()); \
|
||||
JS_END_MACRO
|
||||
|
||||
#define CHECK_INTERRUPT_HANDLER() \
|
||||
JS_BEGIN_MACRO \
|
||||
if (cx->runtime->debugHooks.interruptHook) \
|
||||
ENABLE_INTERRUPTS(); \
|
||||
JS_END_MACRO
|
||||
|
||||
/* Repoint cx->regs to a local variable for faster access. */
|
||||
FrameRegs regs = cx->regs();
|
||||
PreserveRegsGuard interpGuard(cx, regs);
|
||||
|
@ -1236,13 +1226,12 @@ js::Interpret(JSContext *cx, StackFrame *entryFrame, InterpMode interpMode)
|
|||
* Help Debugger find frames running scripts that it has put in
|
||||
* single-step mode.
|
||||
*/
|
||||
InterpreterFrames interpreterFrame(cx, ®s, interruptEnabler);
|
||||
InterpreterFrames interpreterFrame(cx, ®s, interrupts);
|
||||
|
||||
/* Copy in hot values that change infrequently. */
|
||||
JSRuntime *const rt = cx->runtime;
|
||||
Rooted<JSScript*> script(cx);
|
||||
SET_SCRIPT(regs.fp()->script());
|
||||
CHECK_INTERRUPT_HANDLER();
|
||||
|
||||
/*
|
||||
* Pool of rooters for use in this interpreter frame. References to these
|
||||
|
@ -1260,9 +1249,6 @@ js::Interpret(JSContext *cx, StackFrame *entryFrame, InterpMode interpMode)
|
|||
RootedId rootId0(cx);
|
||||
RootedShape rootShape0(cx);
|
||||
|
||||
if (rt->profilingScripts)
|
||||
ENABLE_INTERRUPTS();
|
||||
|
||||
if (!entryFrame)
|
||||
entryFrame = regs.fp();
|
||||
|
||||
|
@ -1315,8 +1301,6 @@ js::Interpret(JSContext *cx, StackFrame *entryFrame, InterpMode interpMode)
|
|||
if (interpMode == JSINTERP_REJOIN)
|
||||
interpMode = JSINTERP_NORMAL;
|
||||
|
||||
CHECK_INTERRUPT_HANDLER();
|
||||
|
||||
RESET_USE_METHODJIT();
|
||||
|
||||
/*
|
||||
|
@ -1329,6 +1313,9 @@ js::Interpret(JSContext *cx, StackFrame *entryFrame, InterpMode interpMode)
|
|||
int32_t len;
|
||||
len = 0;
|
||||
|
||||
if (rt->profilingScripts || cx->runtime->debugHooks.interruptHook)
|
||||
interrupts.enable();
|
||||
|
||||
DO_NEXT_OP(len);
|
||||
|
||||
#if JS_THREADED_INTERP
|
||||
|
@ -1424,7 +1411,6 @@ js::Interpret(JSContext *cx, StackFrame *entryFrame, InterpMode interpMode)
|
|||
break;
|
||||
}
|
||||
JS_ASSERT(status == JSTRAP_CONTINUE);
|
||||
CHECK_INTERRUPT_HANDLER();
|
||||
JS_ASSERT(rval.isInt32() && rval.toInt32() == op);
|
||||
}
|
||||
|
||||
|
@ -1738,7 +1724,6 @@ BEGIN_CASE(JSOP_ITER)
|
|||
uint8_t flags = GET_UINT8(regs.pc);
|
||||
if (!ValueToIterator(cx, flags, ®s.sp[-1]))
|
||||
goto error;
|
||||
CHECK_INTERRUPT_HANDLER();
|
||||
JS_ASSERT(!regs.sp[-1].isPrimitive());
|
||||
}
|
||||
END_CASE(JSOP_ITER)
|
||||
|
@ -1751,7 +1736,6 @@ BEGIN_CASE(JSOP_MOREITER)
|
|||
bool cond;
|
||||
if (!IteratorMore(cx, ®s.sp[-2].toObject(), &cond, ®s.sp[-1]))
|
||||
goto error;
|
||||
CHECK_INTERRUPT_HANDLER();
|
||||
regs.sp[-1].setBoolean(cond);
|
||||
}
|
||||
END_CASE(JSOP_MOREITER)
|
||||
|
@ -2412,7 +2396,6 @@ BEGIN_CASE(JSOP_EVAL)
|
|||
if (!InvokeKernel(cx, args))
|
||||
goto error;
|
||||
}
|
||||
CHECK_INTERRUPT_HANDLER();
|
||||
regs.sp = args.spAfterCall();
|
||||
TypeScript::Monitor(cx, script, regs.pc, regs.sp[-1]);
|
||||
}
|
||||
|
@ -2445,7 +2428,6 @@ BEGIN_CASE(JSOP_FUNCALL)
|
|||
Value *newsp = args.spAfterCall();
|
||||
TypeScript::Monitor(cx, script, regs.pc, newsp[-1]);
|
||||
regs.sp = newsp;
|
||||
CHECK_INTERRUPT_HANDLER();
|
||||
len = JSOP_CALL_LENGTH;
|
||||
DO_NEXT_OP(len);
|
||||
}
|
||||
|
@ -2483,7 +2465,6 @@ BEGIN_CASE(JSOP_FUNCALL)
|
|||
mjit::JaegerStatus status = mjit::JaegerShot(cx, true);
|
||||
CHECK_PARTIAL_METHODJIT(status);
|
||||
interpReturnOK = mjit::JaegerStatusToSuccess(status);
|
||||
CHECK_INTERRUPT_HANDLER();
|
||||
goto jit_return;
|
||||
}
|
||||
}
|
||||
|
@ -2506,8 +2487,6 @@ BEGIN_CASE(JSOP_FUNCALL)
|
|||
}
|
||||
}
|
||||
|
||||
CHECK_INTERRUPT_HANDLER();
|
||||
|
||||
/* Load first op and dispatch it (safe since JSOP_STOP). */
|
||||
op = (JSOp) *regs.pc;
|
||||
DO_OP();
|
||||
|
@ -3079,8 +3058,6 @@ BEGIN_CASE(JSOP_NEWINIT)
|
|||
|
||||
PUSH_OBJECT(*obj);
|
||||
TypeScript::Monitor(cx, script, regs.pc, regs.sp[-1]);
|
||||
|
||||
CHECK_INTERRUPT_HANDLER();
|
||||
}
|
||||
END_CASE(JSOP_NEWINIT)
|
||||
|
||||
|
@ -3094,8 +3071,6 @@ BEGIN_CASE(JSOP_NEWARRAY)
|
|||
|
||||
PUSH_OBJECT(*obj);
|
||||
TypeScript::Monitor(cx, script, regs.pc, regs.sp[-1]);
|
||||
|
||||
CHECK_INTERRUPT_HANDLER();
|
||||
}
|
||||
END_CASE(JSOP_NEWARRAY)
|
||||
|
||||
|
@ -3111,8 +3086,6 @@ BEGIN_CASE(JSOP_NEWOBJECT)
|
|||
|
||||
PUSH_OBJECT(*obj);
|
||||
TypeScript::Monitor(cx, script, regs.pc, regs.sp[-1]);
|
||||
|
||||
CHECK_INTERRUPT_HANDLER();
|
||||
}
|
||||
END_CASE(JSOP_NEWOBJECT)
|
||||
|
||||
|
@ -3326,7 +3299,6 @@ BEGIN_CASE(JSOP_DEBUGGER)
|
|||
goto error;
|
||||
default:;
|
||||
}
|
||||
CHECK_INTERRUPT_HANDLER();
|
||||
}
|
||||
END_CASE(JSOP_DEBUGGER)
|
||||
|
||||
|
@ -3843,7 +3815,6 @@ END_CASE(JSOP_ARRAYPUSH)
|
|||
case JSTRAP_CONTINUE:
|
||||
default:;
|
||||
}
|
||||
CHECK_INTERRUPT_HANDLER();
|
||||
}
|
||||
|
||||
for (TryNoteIter tni(regs); !tni.done(); ++tni) {
|
||||
|
|
|
@ -234,7 +234,7 @@ class InterpreterFrames {
|
|||
public:
|
||||
class InterruptEnablerBase {
|
||||
public:
|
||||
virtual void enableInterrupts() const = 0;
|
||||
virtual void enable() const = 0;
|
||||
};
|
||||
|
||||
InterpreterFrames(JSContext *cx, FrameRegs *regs, const InterruptEnablerBase &enabler);
|
||||
|
@ -242,6 +242,7 @@ class InterpreterFrames {
|
|||
|
||||
/* If this js::Interpret frame is running |script|, enable interrupts. */
|
||||
inline void enableInterruptsIfRunning(JSScript *script);
|
||||
inline void enableInterruptsUnconditionally() { enabler.enable(); }
|
||||
|
||||
InterpreterFrames *older;
|
||||
|
||||
|
|
|
@ -464,7 +464,7 @@ inline void
|
|||
InterpreterFrames::enableInterruptsIfRunning(JSScript *script)
|
||||
{
|
||||
if (script == regs->fp()->script())
|
||||
enabler.enableInterrupts();
|
||||
enabler.enable();
|
||||
}
|
||||
|
||||
static JS_ALWAYS_INLINE bool
|
||||
|
|
Загрузка…
Ссылка в новой задаче