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

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

Issue 660184: Implemented one-char cache lookup in generated code. (Closed)
Patch Set: Created 10 years, 10 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
Index: test/mjsunit/string-charat.js
diff --git a/test/mjsunit/string-charat.js b/test/mjsunit/string-charat.js
index 8ec8f1e08f5b3b7c40ecffaabac410f45b9db378..d1989dfd731177e50c4bd3dcbdd585995901b16e 100644
--- a/test/mjsunit/string-charat.js
+++ b/test/mjsunit/string-charat.js
@@ -51,3 +51,16 @@ assertEquals(116, s.charCodeAt(NaN));
assertTrue(isNaN(s.charCodeAt(-1)));
assertTrue(isNaN(s.charCodeAt(4)));
+// Make sure enough of the one-char string cache is filled.
+var alpha = ['@'];
+for (var i = 1; i < 128; i++) {
+ var c = String.fromCharCode(i);
+ alpha[i] = c.charAt(0);
+}
+var alphaStr = alpha.join("");
+
+// Now test chars.
+for (var i = 1; i < 128; i++) {
+ assertEquals(alpha[i], alphaStr.charAt(i));
+ assertEquals(String.fromCharCode(i), alphaStr.charAt(i));
+}

Powered by Google App Engine
This is Rietveld 408576698