summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/ion/iterator-indices-9.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/ion/iterator-indices-9.js')
-rw-r--r--js/src/jit-test/tests/ion/iterator-indices-9.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/ion/iterator-indices-9.js b/js/src/jit-test/tests/ion/iterator-indices-9.js
new file mode 100644
index 0000000000..631beee5d3
--- /dev/null
+++ b/js/src/jit-test/tests/ion/iterator-indices-9.js
@@ -0,0 +1,34 @@
+// Tests SetPropertyCache sets to object.
+function test(obj) {
+ let index = 0;
+ for (var s in obj) {
+ if (s.startsWith("test")) {
+ obj[s] = index;
+ }
+ index++;
+ }
+ index = 0;
+ for (var s in obj) {
+ if (s.startsWith("test")) {
+ assertEq(obj[s], index);
+ }
+ index++;
+ }
+}
+
+var arr = [];
+for (var i = 0; i < 2; i++) {
+ var obj = {};
+ for (var j = 0; j < i * 20; j++) {
+ obj["x_" + i + "_" + j] = 1;
+ }
+ obj.testKey = 1;
+ arr.push(obj);
+}
+
+with ({}) {}
+for (var i = 0; i < 2000; i++) {
+ var idx = i % arr.length;
+ test(arr[idx]);
+}
+