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

Side by Side Diff: test/mjsunit/string-charat.js

Issue 660184: Implemented one-char cache lookup in generated code. (Closed)
Patch Set: Created 10 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 assertEquals(116, s.charCodeAt(null)); 44 assertEquals(116, s.charCodeAt(null));
45 assertEquals(116, s.charCodeAt(void 0)); 45 assertEquals(116, s.charCodeAt(void 0));
46 assertEquals(116, s.charCodeAt(false)); 46 assertEquals(116, s.charCodeAt(false));
47 assertEquals(101, s.charCodeAt(true)); 47 assertEquals(101, s.charCodeAt(true));
48 assertEquals(116, s.charCodeAt(0)); 48 assertEquals(116, s.charCodeAt(0));
49 assertEquals(116, s.charCodeAt(3)); 49 assertEquals(116, s.charCodeAt(3));
50 assertEquals(116, s.charCodeAt(NaN)); 50 assertEquals(116, s.charCodeAt(NaN));
51 assertTrue(isNaN(s.charCodeAt(-1))); 51 assertTrue(isNaN(s.charCodeAt(-1)));
52 assertTrue(isNaN(s.charCodeAt(4))); 52 assertTrue(isNaN(s.charCodeAt(4)));
53 53
54 // Make sure enough of the one-char string cache is filled.
55 var alpha = ['@'];
56 for (var i = 1; i < 128; i++) {
57 var c = String.fromCharCode(i);
58 alpha[i] = c.charAt(0);
59 }
60 var alphaStr = alpha.join("");
61
62 // Now test chars.
63 for (var i = 1; i < 128; i++) {
64 assertEquals(alpha[i], alphaStr.charAt(i));
65 assertEquals(String.fromCharCode(i), alphaStr.charAt(i));
66 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698