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

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

Issue 2087009: Custom call IC-s for String.prototype.{charAt,charCodeAt}. (Closed)
Patch Set: ARM port. Created 10 years, 7 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
« src/codegen.h ('K') | « test/mjsunit/string-charat.js ('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 866faa89586f41a0321e6f0c63ae2aa92b65392d..1d6476ea19373bf518f3ae3859d1db104adc66ed 100644
--- a/test/mjsunit/string-index.js
+++ b/test/mjsunit/string-index.js
@@ -207,6 +207,28 @@ for (var i = 0; i < 100; ++i) {
assertEquals(expected, actual);
}
+// Test negative zero case.
+var keys = [0, -0.0];
+var str = 'ab', arr = ['a', 'a'];
+for (var i = 0; i < 100; ++i) {
+ var index = Math.floor(i / 50);
+ var key = keys[index];
+ var expected = arr[index];
+ var actual = str[key];
+ assertEquals(expected, actual);
+}
+
+// Test "not-an-array-index" case.
+var keys = [0, 0.5];
+var str = 'ab', arr = ['a', undefined];
+for (var i = 0; i < 100; ++i) {
+ var index = Math.floor(i / 50);
+ var key = keys[index];
+ var expected = arr[index];
+ var actual = str[key];
+ assertEquals(expected, actual);
+}
+
// Test out of range case.
var keys = [0, -1];
var str = 'ab', arr = ['a', undefined];
@@ -234,4 +256,4 @@ for (var i = 0; i < 50; ++i) {
var expected = arr[0];
var actual = str[0];
assertEquals(expected, actual);
-}
+}
« src/codegen.h ('K') | « test/mjsunit/string-charat.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698