mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1093573 part 1 - Some generator bytecode changes. r=wingo
--HG-- extra : rebase_source : d5d35bc7f367f3a3427bf22a8bdd83b1ea76be16
This commit is contained in:
parent
62fc2f138d
commit
2e7da6e40b
@ -3062,6 +3062,9 @@ frontend::EmitFunctionScript(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNo
|
||||
if (bce->sc->asFunctionBox()->isStarGenerator() && !EmitFinishIteratorResult(cx, bce, true))
|
||||
return false;
|
||||
|
||||
if (Emit1(cx, bce, JSOP_SETRVAL) < 0)
|
||||
return false;
|
||||
|
||||
ScopeCoordinate sc;
|
||||
// We know that .generator is on the top scope chain node, as we are
|
||||
// at the function end.
|
||||
@ -3071,7 +3074,7 @@ frontend::EmitFunctionScript(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNo
|
||||
return false;
|
||||
|
||||
// No need to check for finally blocks, etc as in EmitReturn.
|
||||
if (Emit1(cx, bce, JSOP_FINALYIELD) < 0)
|
||||
if (Emit1(cx, bce, JSOP_FINALYIELDRVAL) < 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -5598,6 +5601,9 @@ EmitYield(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
||||
if (Emit1(cx, bce, pn->getOp()) < 0)
|
||||
return false;
|
||||
|
||||
if (pn->getOp() == JSOP_INITIALYIELD && Emit1(cx, bce, JSOP_POP) < 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -288,7 +288,6 @@ BytecodeFallsThrough(JSOp op)
|
||||
case JSOP_DEFAULT:
|
||||
case JSOP_RETURN:
|
||||
case JSOP_RETRVAL:
|
||||
case JSOP_FINALYIELD:
|
||||
case JSOP_FINALYIELDRVAL:
|
||||
case JSOP_THROW:
|
||||
case JSOP_TABLESWITCH:
|
||||
@ -597,7 +596,6 @@ FlowsIntoNext(JSOp op)
|
||||
case JSOP_THROW:
|
||||
case JSOP_GOTO:
|
||||
case JSOP_RETSUB:
|
||||
case JSOP_FINALYIELD:
|
||||
case JSOP_FINALYIELDRVAL:
|
||||
return false;
|
||||
default:
|
||||
|
@ -132,15 +132,12 @@ GeneratorObject::resume(JSContext *cx, InterpreterActivation &activation,
|
||||
|
||||
activation.regs().pc = callee->nonLazyScript()->code() + genObj->suspendedBytecodeOffset();
|
||||
|
||||
// If we are resuming a JSOP_YIELD, always push on a value, even if we are
|
||||
// raising an exception. In the exception case, the stack needs to have
|
||||
// something on it so that exception handling doesn't skip the catch
|
||||
// blocks. See TryNoteIter::settle.
|
||||
if (!genObj->isNewborn()) {
|
||||
activation.regs().sp++;
|
||||
MOZ_ASSERT(activation.regs().spForStackDepth(activation.regs().stackDepth()));
|
||||
activation.regs().sp[-1] = arg;
|
||||
}
|
||||
// Always push on a value, even if we are raising an exception. In the
|
||||
// exception case, the stack needs to have something on it so that exception
|
||||
// handling doesn't skip the catch blocks. See TryNoteIter::settle.
|
||||
activation.regs().sp++;
|
||||
MOZ_ASSERT(activation.regs().spForStackDepth(activation.regs().stackDepth()));
|
||||
activation.regs().sp[-1] = arg;
|
||||
|
||||
switch (resumeKind) {
|
||||
case NEXT:
|
||||
|
@ -1659,6 +1659,7 @@ CASE(JSOP_UNUSED190)
|
||||
CASE(JSOP_UNUSED191)
|
||||
CASE(JSOP_UNUSED192)
|
||||
CASE(JSOP_UNUSED196)
|
||||
CASE(JSOP_UNUSED207)
|
||||
CASE(JSOP_UNUSED208)
|
||||
CASE(JSOP_UNUSED209)
|
||||
CASE(JSOP_UNUSED210)
|
||||
@ -3424,11 +3425,6 @@ CASE(JSOP_RESUME)
|
||||
ADVANCE_AND_DISPATCH(0);
|
||||
}
|
||||
|
||||
CASE(JSOP_FINALYIELD)
|
||||
REGS.fp()->setReturnValue(REGS.sp[-2]);
|
||||
REGS.sp[-2] = REGS.sp[-1];
|
||||
REGS.sp--;
|
||||
/* FALL THROUGH */
|
||||
CASE(JSOP_FINALYIELDRVAL)
|
||||
{
|
||||
RootedObject &gen = rootObject0;
|
||||
|
@ -1568,7 +1568,7 @@
|
||||
* Operands:
|
||||
* Stack: generator =>
|
||||
*/ \
|
||||
macro(JSOP_INITIALYIELD, 202,"initialyield", NULL, 1, 1, 0, JOF_BYTE) \
|
||||
macro(JSOP_INITIALYIELD, 202,"initialyield", NULL, 1, 1, 1, JOF_BYTE) \
|
||||
/*
|
||||
* Pops the generator and the return value 'rval1', stops interpretation and
|
||||
* returns 'rval1'. Pushes sent value from 'send()' onto the stack.
|
||||
@ -1578,15 +1578,6 @@
|
||||
* Stack: rval1, gen => rval2
|
||||
*/ \
|
||||
macro(JSOP_YIELD, 203,"yield", NULL, 1, 2, 1, JOF_BYTE) \
|
||||
/*
|
||||
* Pops the generator and the value to yield from the stack. Then suspends
|
||||
* and closes the generator.
|
||||
* Category: Statements
|
||||
* Type: Generator
|
||||
* Operands:
|
||||
* Stack: gen, val =>
|
||||
*/ \
|
||||
macro(JSOP_FINALYIELD, 204,"finalyield", NULL, 1, 2, 0, JOF_BYTE) \
|
||||
/*
|
||||
* Pops the generator and suspends and closes it. Yields the value in the
|
||||
* frame's return value slot.
|
||||
@ -1595,7 +1586,7 @@
|
||||
* Operands:
|
||||
* Stack: gen =>
|
||||
*/ \
|
||||
macro(JSOP_FINALYIELDRVAL,205,"finalyieldrval",NULL, 1, 1, 0, JOF_BYTE) \
|
||||
macro(JSOP_FINALYIELDRVAL,204,"finalyieldrval",NULL, 1, 1, 0, JOF_BYTE) \
|
||||
/*
|
||||
* Pops the generator and argument from the stack, pushes a new generator
|
||||
* frame and resumes execution of it. Pushes the return value after the
|
||||
@ -1605,7 +1596,7 @@
|
||||
* Operands: resume kind (GeneratorObject::ResumeKind)
|
||||
* Stack: gen, val => rval
|
||||
*/ \
|
||||
macro(JSOP_RESUME, 206,"resume", NULL, 3, 2, 1, JOF_UINT8|JOF_INVOKE) \
|
||||
macro(JSOP_RESUME, 205,"resume", NULL, 3, 2, 1, JOF_UINT8|JOF_INVOKE) \
|
||||
/*
|
||||
* Pops the top two values on the stack as 'obj' and 'v', pushes 'v' to
|
||||
* 'obj'.
|
||||
@ -1616,8 +1607,9 @@
|
||||
* Operands:
|
||||
* Stack: v, obj =>
|
||||
*/ \
|
||||
macro(JSOP_ARRAYPUSH, 207,"arraypush", NULL, 1, 2, 0, JOF_BYTE) \
|
||||
macro(JSOP_ARRAYPUSH, 206,"arraypush", NULL, 1, 2, 0, JOF_BYTE) \
|
||||
\
|
||||
macro(JSOP_UNUSED207, 207, "unused207", NULL, 1, 0, 0, JOF_BYTE) \
|
||||
macro(JSOP_UNUSED208, 208, "unused208", 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) \
|
||||
|
@ -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 = 192;
|
||||
static const uint32_t XDR_BYTECODE_VERSION_SUBTRAHEND = 194;
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user