summaryrefslogtreecommitdiffstats
path: root/js/src/frontend
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2019-12-14 09:58:06 -0500
committerGaming4JC <g4jc@hyperbola.info>2019-12-17 06:25:29 -0500
commitdd1cbde1569e823e5e76e8c3ef0ecba66408719d (patch)
treee55301983fb9558565871d43675ae24df8b784f3 /js/src/frontend
parent63eee6325ea72fae191b50ea2a23c46758c063e6 (diff)
downloadUXP-dd1cbde1569e823e5e76e8c3ef0ecba66408719d.tar
UXP-dd1cbde1569e823e5e76e8c3ef0ecba66408719d.tar.gz
UXP-dd1cbde1569e823e5e76e8c3ef0ecba66408719d.tar.lz
UXP-dd1cbde1569e823e5e76e8c3ef0ecba66408719d.tar.xz
UXP-dd1cbde1569e823e5e76e8c3ef0ecba66408719d.zip
Bug 1364608 - Stash rval in AsyncIteratorClose.
Tag #1287
Diffstat (limited to 'js/src/frontend')
-rw-r--r--js/src/frontend/BytecodeEmitter.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitter.cpp
index f16450db9..f629c86e5 100644
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -5365,7 +5365,14 @@ BytecodeEmitter::emitIteratorClose(IteratorKind iterKind /* = IteratorKind::Sync
checkTypeSet(JSOP_CALL);
if (iterKind == IteratorKind::Async) {
- if (!emitAwait()) // ... ... RESULT
+ if (completionKind != CompletionKind::Throw) {
+ // Await clobbers rval, so save the current rval.
+ if (!emit1(JSOP_GETRVAL)) // ... ... RESULT RVAL
+ return false;
+ if (!emit1(JSOP_SWAP)) // ... ... RVAL RESULT
+ return false;
+ }
+ if (!emitAwait()) // ... ... RVAL? RESULT
return false;
}
@@ -5395,8 +5402,15 @@ BytecodeEmitter::emitIteratorClose(IteratorKind iterKind /* = IteratorKind::Sync
if (!emit1(JSOP_POP)) // ... RESULT
return false;
} else {
- if (!emitCheckIsObj(CheckIsObjectKind::IteratorReturn)) // ... RESULT
+ if (!emitCheckIsObj(CheckIsObjectKind::IteratorReturn)) // ... RVAL? RESULT
return false;
+
+ if (iterKind == IteratorKind::Async) {
+ if (!emit1(JSOP_SWAP)) // ... RESULT RVAL
+ return false;
+ if (!emit1(JSOP_SETRVAL)) // ... RESULT
+ return false;
+ }
}
if (!ifReturnMethodIsDefined.emitElse())