summaryrefslogtreecommitdiffstats
path: root/js/src
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-03-25 14:47:39 +0200
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-03-25 14:47:39 +0200
commit6056525ced07af6c6c4f48ea605a2f4589821fdf (patch)
tree82643cc93120a04d160a819c951385225daf676d /js/src
parent4ee42e38e0a490eb4880b4a260e3cbe07dd486d1 (diff)
downloadUXP-6056525ced07af6c6c4f48ea605a2f4589821fdf.tar
UXP-6056525ced07af6c6c4f48ea605a2f4589821fdf.tar.gz
UXP-6056525ced07af6c6c4f48ea605a2f4589821fdf.tar.lz
UXP-6056525ced07af6c6c4f48ea605a2f4589821fdf.tar.xz
UXP-6056525ced07af6c6c4f48ea605a2f4589821fdf.zip
Bug 1341339 - Check for duplicates in processIterators
Issue #74
Diffstat (limited to 'js/src')
-rw-r--r--js/src/jit-test/tests/for-of/bug-1341339.js9
-rw-r--r--js/src/jit/IonBuilder.cpp9
2 files changed, 15 insertions, 3 deletions
diff --git a/js/src/jit-test/tests/for-of/bug-1341339.js b/js/src/jit-test/tests/for-of/bug-1341339.js
new file mode 100644
index 000000000..1f88acdaf
--- /dev/null
+++ b/js/src/jit-test/tests/for-of/bug-1341339.js
@@ -0,0 +1,9 @@
+let m = parseModule(`
+function* values() {}
+var iterator = values();
+for (var i=0; i < 10000; ++i) {
+ for (var x of iterator) {}
+}
+`);
+m.declarationInstantiation();
+m.evaluation();
diff --git a/js/src/jit/IonBuilder.cpp b/js/src/jit/IonBuilder.cpp
index 534a48a90..26bba0656 100644
--- a/js/src/jit/IonBuilder.cpp
+++ b/js/src/jit/IonBuilder.cpp
@@ -963,9 +963,12 @@ IonBuilder::processIterators()
Vector<MDefinition*, 8, SystemAllocPolicy> worklist;
for (size_t i = 0; i < iterators_.length(); i++) {
- if (!worklist.append(iterators_[i]))
- return false;
- iterators_[i]->setInWorklist();
+ MDefinition* iter = iterators_[i];
+ if (!iter->isInWorklist()) {
+ if (!worklist.append(iter))
+ return false;
+ iter->setInWorklist();
+ }
}
while (!worklist.empty()) {