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

Side by Side Diff: test/mjsunit/substr.js

Issue 7477045: Tentative implementation of string slices (hidden under the flag --string-slices). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Some more suggested changes. Created 9 years, 4 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 | Annotate | Revision Log
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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 x += x; // 2^10 128 x += x; // 2^10
129 x += x; 129 x += x;
130 x += x; 130 x += x;
131 var xl = x.length; 131 var xl = x.length;
132 var cache = []; 132 var cache = [];
133 for (var i = 0; i < 10000; i++) { 133 for (var i = 0; i < 10000; i++) {
134 var z = x.substring(i % xl); 134 var z = x.substring(i % xl);
135 assertEquals(xl - (i % xl), z.length); 135 assertEquals(xl - (i % xl), z.length);
136 cache.push(z); 136 cache.push(z);
137 } 137 }
138
139 // Substring of substring.
140 var cache = [];
141 var last = x;
142 var offset = 0;
143 for (var i = 0; i < 64; i++) {
144 var z = last.substring(i);
145 last = z;
146 cache.push(z);
147 offset += i;
148 }
149 for (var i = 63; i >= 0; i--) {
150 var z = cache.pop();
151 assertTrue(/\u2028123456789ABCDEF/.test(z));
152 assertEquals(xl - offset, z.length);
153 offset -= i;
154 }
OLDNEW
« src/ia32/code-stubs-ia32.cc ('K') | « test/mjsunit/string-slices-regexp.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698