summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/indexed-iteration.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/basic/indexed-iteration.js')
-rw-r--r--js/src/jit-test/tests/basic/indexed-iteration.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/basic/indexed-iteration.js b/js/src/jit-test/tests/basic/indexed-iteration.js
new file mode 100644
index 0000000000..952aa105ba
--- /dev/null
+++ b/js/src/jit-test/tests/basic/indexed-iteration.js
@@ -0,0 +1,20 @@
+
+// Don't use NativeIterator cache for objects with dense elements.
+
+function bar(a) {
+ var n = 0;
+ for (var b in a) { n++; }
+ return n;
+}
+
+function foo() {
+ var x = {a:0,b:1};
+ var y = {a:0,b:1};
+ y[0] = 2;
+ y[1] = 3;
+ for (var i = 0; i < 10; i++) {
+ assertEq(bar(x), 2);
+ assertEq(bar(y), 4);
+ }
+}
+foo();