| Index: test/mjsunit/string-charcodeat.js
|
| ===================================================================
|
| --- test/mjsunit/string-charcodeat.js (revision 6800)
|
| +++ test/mjsunit/string-charcodeat.js (working copy)
|
| @@ -153,6 +153,17 @@
|
| TestStringType(Flat16, true);
|
| TestStringType(NotAString16, true);
|
|
|
| +
|
| +function ConsNotSmiIndex() {
|
| + var str = Cons();
|
| + assertTrue(isNaN(str.charCodeAt(0x7fffffff)));
|
| +}
|
| +
|
| +for (var i = 0; i < 100000; i++) {
|
| + ConsNotSmiIndex();
|
| +}
|
| +
|
| +
|
| for (var i = 0; i != 10; i++) {
|
| assertEquals(101, Cons16().charCodeAt(1.1));
|
| assertEquals('e', Cons16().charAt(1.1));
|
| @@ -194,3 +205,23 @@
|
| assertEquals(49, long.charCodeAt(0), 36);
|
| assertEquals(56, long.charCodeAt(65535), 37);
|
| assertTrue(isNaN(long.charCodeAt(65536)), 38);
|
| +
|
| +
|
| +// Test crankshaft code when the function is set directly on the
|
| +// string prototype object instead of the hidden prototype object.
|
| +// See http://code.google.com/p/v8/issues/detail?id=1070
|
| +
|
| +String.prototype.x = String.prototype.charCodeAt;
|
| +
|
| +function directlyOnPrototype() {
|
| + assertEquals(97, "a".x(0));
|
| + assertEquals(98, "b".x(0));
|
| + assertEquals(99, "c".x(0));
|
| + assertEquals(97, "a".x(0));
|
| + assertEquals(98, "b".x(0));
|
| + assertEquals(99, "c".x(0));
|
| +}
|
| +
|
| +for (var i = 0; i < 10000; i++) {
|
| + directlyOnPrototype();
|
| +}
|
|
|