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

Unified Diff: test/mjsunit/string-index.js

Issue 1567024: Land patch by Pavel Podivilov (podivilov@chromium.org). (Closed)
Patch Set: Created 10 years, 8 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/ic-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/string-index.js
diff --git a/test/mjsunit/string-index.js b/test/mjsunit/string-index.js
index c6b26a85eea65b22f82bdf742d02e435bb51ccb8..3ad71e06ba02164c2d7264ff92b6e45dfa4bf0a2 100644
--- a/test/mjsunit/string-index.js
+++ b/test/mjsunit/string-index.js
@@ -166,3 +166,24 @@ for (var i = 1; i < 128; i++) {
assertEquals(alpha[i], alphaStr[i]);
assertEquals(String.fromCharCode(i), alphaStr[i]);
}
+
+// Test for keyed ic.
+var foo = ['a12', ['a', 2, 'c'], 'a31', 42];
+var results = [1, 2, 3, NaN];
+for (var i = 0; i < 200; ++i) {
+ var index = Math.floor(i / 50);
+ var receiver = foo[index];
+ var expected = results[index];
+ var actual = +(receiver[1]);
+ assertEquals(expected, actual);
+}
+
+var keys = [0, '1', 2, 3.0];
+var str = 'abcd', arr = ['a', 'b', 'c', 'd'];
+for (var i = 0; i < 200; ++i) {
+ var index = Math.floor(i / 50);
+ var key = keys[index];
+ var expected = arr[index];
+ var actual = str[key];
+ assertEquals(expected, actual);
+}
« no previous file with comments | « src/x64/ic-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698