summaryrefslogtreecommitdiffstats
path: root/js/src/frontend/BytecodeEmitter.cpp
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2019-12-01 18:44:06 -0500
committerGaming4JC <g4jc@hyperbola.info>2019-12-17 06:25:23 -0500
commitf07d5707c77e73031b6921faac165ca7f8d577c6 (patch)
tree0ecbf325bbefb73bee1dce56dac494620b461fb2 /js/src/frontend/BytecodeEmitter.cpp
parent9163aaebb670bd87e6ef71beaf24999c926217eb (diff)
downloadUXP-f07d5707c77e73031b6921faac165ca7f8d577c6.tar
UXP-f07d5707c77e73031b6921faac165ca7f8d577c6.tar.gz
UXP-f07d5707c77e73031b6921faac165ca7f8d577c6.tar.lz
UXP-f07d5707c77e73031b6921faac165ca7f8d577c6.tar.xz
UXP-f07d5707c77e73031b6921faac165ca7f8d577c6.zip
Bug 1343481 - Part 2: Stop using StarGegerator for async function.
Tag #1287
Diffstat (limited to 'js/src/frontend/BytecodeEmitter.cpp')
-rw-r--r--js/src/frontend/BytecodeEmitter.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitter.cpp
index 4dc4914dc..b8a9bdf7e 100644
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -8443,7 +8443,8 @@ BytecodeEmitter::emitReturn(ParseNode* pn)
if (!updateSourceCoordNotes(pn->pn_pos.begin))
return false;
- if (sc->isFunctionBox() && sc->asFunctionBox()->isStarGenerator()) {
+ bool needsIteratorResult = sc->isFunctionBox() && sc->asFunctionBox()->needsIteratorResult();
+ if (needsIteratorResult) {
if (!emitPrepareIteratorResult())
return false;
}
@@ -8458,7 +8459,7 @@ BytecodeEmitter::emitReturn(ParseNode* pn)
return false;
}
- if (sc->isFunctionBox() && sc->asFunctionBox()->isStarGenerator()) {
+ if (needsIteratorResult) {
if (!emitFinishIteratorResult(true))
return false;
}
@@ -8530,7 +8531,8 @@ BytecodeEmitter::emitYield(ParseNode* pn)
MOZ_ASSERT(sc->isFunctionBox());
if (pn->getOp() == JSOP_YIELD) {
- if (sc->asFunctionBox()->isStarGenerator()) {
+ bool needsIteratorResult = sc->asFunctionBox()->needsIteratorResult();
+ if (needsIteratorResult) {
if (!emitPrepareIteratorResult())
return false;
}
@@ -8541,7 +8543,7 @@ BytecodeEmitter::emitYield(ParseNode* pn)
if (!emit1(JSOP_UNDEFINED))
return false;
}
- if (sc->asFunctionBox()->isStarGenerator()) {
+ if (needsIteratorResult) {
if (!emitFinishIteratorResult(false))
return false;
}
@@ -10319,14 +10321,19 @@ BytecodeEmitter::emitFunctionBody(ParseNode* funBody)
if (funbox->needsFinalYield()) {
// If we fall off the end of a generator, do a final yield.
- if (funbox->isStarGenerator() && !emitPrepareIteratorResult())
- return false;
+ bool needsIteratorResult = funbox->needsIteratorResult();
+ if (needsIteratorResult) {
+ if (!emitPrepareIteratorResult())
+ return false;
+ }
if (!emit1(JSOP_UNDEFINED))
return false;
- if (funbox->isStarGenerator() && !emitFinishIteratorResult(true))
- return false;
+ if (needsIteratorResult) {
+ if (!emitFinishIteratorResult(true))
+ return false;
+ }
if (!emit1(JSOP_SETRVAL))
return false;