summaryrefslogtreecommitdiffstats
path: root/js/src/frontend/BytecodeEmitter.cpp
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-03-25 18:24:06 +0200
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-03-25 18:24:06 +0200
commitaafdd314442c903815f6fdf6072b001c25ae85c5 (patch)
tree2b299f6b553e13570478ea6b42a23d1cb3e653e9 /js/src/frontend/BytecodeEmitter.cpp
parent05441d12b6bbc9dde268914fcfd374db61b83462 (diff)
downloadUXP-aafdd314442c903815f6fdf6072b001c25ae85c5.tar
UXP-aafdd314442c903815f6fdf6072b001c25ae85c5.tar.gz
UXP-aafdd314442c903815f6fdf6072b001c25ae85c5.tar.lz
UXP-aafdd314442c903815f6fdf6072b001c25ae85c5.tar.xz
UXP-aafdd314442c903815f6fdf6072b001c25ae85c5.zip
Bug 1357075 - Pad a nop to unwind to the scope just before a destructuring iterator close trynote
Issue #74
Diffstat (limited to 'js/src/frontend/BytecodeEmitter.cpp')
-rw-r--r--js/src/frontend/BytecodeEmitter.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitter.cpp
index b2e48d7ea..4d3b60c2f 100644
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -5318,6 +5318,14 @@ BytecodeEmitter::wrapWithDestructuringIteratorCloseTryNote(int32_t iterDepth, In
{
MOZ_ASSERT(this->stackDepth >= iterDepth);
+ // Pad a nop at the beginning of the bytecode covered by the trynote so
+ // that when unwinding environments, we may unwind to the scope
+ // corresponding to the pc *before* the start, in case the first bytecode
+ // emitted by |emitter| is the start of an inner scope. See comment above
+ // UnwindEnvironmentToTryPc.
+ if (!emit1(JSOP_TRY_DESTRUCTURING_ITERCLOSE))
+ return false;
+
ptrdiff_t start = offset();
if (!emitter(this))
return false;