Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(724)

Unified Diff: test/mjsunit/for-in.js

Issue 2810027: Fix error in for-in on x64 platform using full compiler with keyed store IC.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/for-in.js
===================================================================
--- test/mjsunit/for-in.js (revision 4940)
+++ test/mjsunit/for-in.js (working copy)
@@ -84,3 +84,38 @@
for (var p in { get a() {}, set a(x) {}, b : 1}) { result += p; }
assertEquals('ab', result, "abgetset");
+
+// Test that for-in in the global scope works with a keyed property as "each".
+// Test outside a loop and in a loop for multiple iterations.
+a = [1,2,3,4];
+x = {foo:5, bar:6, zip:7, glep:9, 10:11};
+delete x.bar;
+y = {}
+
+for (a[2] in x) {
+ y[a[2]] = x[a[2]];
+}
+
+assertEquals(5, y.foo, "y.foo");
+assertEquals("undefined", typeof y.bar, "y.bar");
+assertEquals(7, y.zip, "y.zip");
+assertEquals(9, y.glep, "y.glep");
+assertEquals(11, y[10], "y[10]");
+assertEquals("undefined", typeof y[2], "y[2]");
+assertEquals("undefined", typeof y[0], "y[0]");
+
+for (i=0 ; i < 3; ++i) {
+ y = {}
+
+ for (a[2] in x) {
+ y[a[2]] = x[a[2]];
+ }
+
+ assertEquals(5, y.foo, "y.foo");
+ assertEquals("undefined", typeof y.bar, "y.bar");
+ assertEquals(7, y.zip, "y.zip");
+ assertEquals(9, y.glep, "y.glep");
+ assertEquals(11, y[10], "y[10]");
+ assertEquals("undefined", typeof y[2], "y[2]");
+ assertEquals("undefined", typeof y[0], "y[0]");
+}
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698