зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1032869 - Part 5: Add JSOP_DEBUGAFTERYIELD to fix up resumed generator BaselineFrames. (r=jandem)
This commit is contained in:
Родитель
879c073038
Коммит
54dc6aaed1
|
@ -3017,7 +3017,10 @@ EmitYieldOp(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp op)
|
|||
|
||||
SET_UINT24(bce->code(off), yieldIndex);
|
||||
|
||||
return bce->yieldOffsetList.append(bce->offset());
|
||||
if (!bce->yieldOffsetList.append(bce->offset()))
|
||||
return false;
|
||||
|
||||
return Emit1(cx, bce, JSOP_DEBUGAFTERYIELD) >= 0;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -3405,6 +3405,22 @@ BaselineCompiler::emit_JSOP_YIELD()
|
|||
return emitReturn();
|
||||
}
|
||||
|
||||
typedef bool (*DebugAfterYieldFn)(JSContext *, BaselineFrame *);
|
||||
static const VMFunction DebugAfterYieldInfo = FunctionInfo<DebugAfterYieldFn>(jit::DebugAfterYield);
|
||||
|
||||
bool
|
||||
BaselineCompiler::emit_JSOP_DEBUGAFTERYIELD()
|
||||
{
|
||||
if (!compileDebugInstrumentation_)
|
||||
return true;
|
||||
|
||||
frame.assertSyncedStack();
|
||||
masm.loadBaselineFramePtr(BaselineFrameReg, R0.scratchReg());
|
||||
prepareVMCall();
|
||||
pushArg(R0.scratchReg());
|
||||
return callVM(DebugAfterYieldInfo);
|
||||
}
|
||||
|
||||
typedef bool (*FinalSuspendFn)(JSContext *, HandleObject, BaselineFrame *, jsbytecode *);
|
||||
static const VMFunction FinalSuspendInfo = FunctionInfo<FinalSuspendFn>(jit::FinalSuspend);
|
||||
|
||||
|
|
|
@ -176,6 +176,7 @@ namespace jit {
|
|||
_(JSOP_GENERATOR) \
|
||||
_(JSOP_INITIALYIELD) \
|
||||
_(JSOP_YIELD) \
|
||||
_(JSOP_DEBUGAFTERYIELD) \
|
||||
_(JSOP_FINALYIELDRVAL) \
|
||||
_(JSOP_RESUME) \
|
||||
_(JSOP_CALLEE) \
|
||||
|
|
|
@ -907,6 +907,16 @@ InterpretResume(JSContext *cx, HandleObject obj, HandleValue val, HandleProperty
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
DebugAfterYield(JSContext *cx, BaselineFrame *frame)
|
||||
{
|
||||
// The BaselineFrame has just been constructed by JSOP_RESUME in the
|
||||
// caller. We need to set its debuggee flag as necessary.
|
||||
if (frame->script()->isDebuggee())
|
||||
frame->setIsDebuggee();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
StrictEvalPrologue(JSContext *cx, BaselineFrame *frame)
|
||||
{
|
||||
|
|
|
@ -712,6 +712,7 @@ bool NormalSuspend(JSContext *cx, HandleObject obj, BaselineFrame *frame, jsbyte
|
|||
bool FinalSuspend(JSContext *cx, HandleObject obj, BaselineFrame *frame, jsbytecode *pc);
|
||||
bool InterpretResume(JSContext *cx, HandleObject obj, HandleValue val, HandlePropertyName kind,
|
||||
MutableHandleValue rval);
|
||||
bool DebugAfterYield(JSContext *cx, BaselineFrame *frame);
|
||||
|
||||
bool StrictEvalPrologue(JSContext *cx, BaselineFrame *frame);
|
||||
bool HeavyweightFunPrologue(JSContext *cx, BaselineFrame *frame);
|
||||
|
|
|
@ -1645,7 +1645,6 @@ CASE(JSOP_UNUSED190)
|
|||
CASE(JSOP_UNUSED191)
|
||||
CASE(JSOP_UNUSED192)
|
||||
CASE(JSOP_UNUSED196)
|
||||
CASE(JSOP_UNUSED208)
|
||||
CASE(JSOP_UNUSED209)
|
||||
CASE(JSOP_UNUSED210)
|
||||
CASE(JSOP_UNUSED211)
|
||||
|
@ -3413,6 +3412,14 @@ CASE(JSOP_RESUME)
|
|||
ADVANCE_AND_DISPATCH(0);
|
||||
}
|
||||
|
||||
CASE(JSOP_DEBUGAFTERYIELD)
|
||||
{
|
||||
// No-op in the interpreter, as GeneratorObject::resume takes care of
|
||||
// fixing up InterpreterFrames.
|
||||
MOZ_ASSERT_IF(REGS.fp()->script()->isDebuggee(), REGS.fp()->isDebuggee());
|
||||
}
|
||||
END_CASE(JSOP_DEBUGAFTERYIELD)
|
||||
|
||||
CASE(JSOP_FINALYIELDRVAL)
|
||||
{
|
||||
RootedObject &gen = rootObject0;
|
||||
|
|
|
@ -1619,7 +1619,15 @@
|
|||
*/ \
|
||||
macro(JSOP_FORCEINTERPRETER, 207, "forceinterpreter", NULL, 1, 0, 0, JOF_BYTE) \
|
||||
\
|
||||
macro(JSOP_UNUSED208, 208, "unused208", NULL, 1, 0, 0, JOF_BYTE) \
|
||||
/*
|
||||
* Bytecode emitted after 'yield' statements to help the Debugger
|
||||
* fix up the frame in the JITs. No-op in the interpreter.
|
||||
*
|
||||
* Category: Debugger
|
||||
* Operands:
|
||||
* Stack: =>
|
||||
*/ \
|
||||
macro(JSOP_DEBUGAFTERYIELD, 208, "debugafteryield", NULL, 1, 0, 0, JOF_BYTE) \
|
||||
macro(JSOP_UNUSED209, 209, "unused209", NULL, 1, 0, 0, JOF_BYTE) \
|
||||
macro(JSOP_UNUSED210, 210, "unused210", NULL, 1, 0, 0, JOF_BYTE) \
|
||||
macro(JSOP_UNUSED211, 211, "unused211", NULL, 1, 0, 0, JOF_BYTE) \
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace js {
|
|||
* Nightly) and without (all others). FIXME: Bug 1066322 - Enable ES6 symbols
|
||||
* in all builds.
|
||||
*/
|
||||
static const uint32_t XDR_BYTECODE_VERSION_SUBTRAHEND = 202;
|
||||
static const uint32_t XDR_BYTECODE_VERSION_SUBTRAHEND = 204;
|
||||
static_assert(XDR_BYTECODE_VERSION_SUBTRAHEND % 2 == 0, "see the comment above");
|
||||
static const uint32_t XDR_BYTECODE_VERSION =
|
||||
uint32_t(0xb973c0de - (XDR_BYTECODE_VERSION_SUBTRAHEND
|
||||
|
|
Загрузка…
Ссылка в новой задаче