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

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

Issue 7833033: Promote and inflate string slices during scavenging GC. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 3 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
« no previous file with comments | « test/cctest/test-strings.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/string-slices.js
diff --git a/test/mjsunit/string-slices.js b/test/mjsunit/string-slices.js
index 8cc1f81e774fe6b8449555b90a3d5bba868f4db2..eb33e013d8a71c9089fa942313cd67082bb8258c 100755
--- a/test/mjsunit/string-slices.js
+++ b/test/mjsunit/string-slices.js
@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --string-slices --expose-externalize-string
+// Flags: --string-slices --expose-externalize-string --expose-gc
var s = 'abcdefghijklmn';
assertEquals(s, s.substr());
@@ -113,7 +113,6 @@ var cache = [];
for (var i = 0; i < 1000; i++) {
var z = x.substring(i % xl);
assertEquals(xl - (i % xl), z.length);
- cache.push(z);
}
@@ -127,30 +126,39 @@ x += x;
x += x; // 2^10
x += x;
x += x;
+x += x;
+x += x;
+x += x;
+x += x;
+x += x;
var xl = x.length;
var cache = [];
for (var i = 0; i < 1000; i++) {
var z = x.substring(i % xl);
assertEquals(xl - (i % xl), z.length);
- cache.push(z);
}
// Substring of substring.
var cache = [];
var last = x;
-var offset = 0;
-for (var i = 0; i < 64; i++) {
- var z = last.substring(i);
+for (var i = 0; i < 100000; i++) {
+ var z = last.substring(1);
last = z;
cache.push(z);
- offset += i;
}
-for (var i = 63; i >= 0; i--) {
+
+// Fill up new space with junk and then invoke GC.
+var fill = [];
+for (var i = 0; i < 1000000; i++) {
+ fill.push(i + " ");
+}
+gc(true);
+
+for (var i = 100000; i > 0; i--) {
var z = cache.pop();
assertTrue(/\u2028123456789ABCDEF/.test(z));
- assertEquals(xl - offset, z.length);
- assertEquals(x.charAt(i*(i+1)/2), z.charAt(0));
- offset -= i;
+ assertEquals(xl - i, z.length);
+ assertEquals(x.charAt(i), z.charAt(0));
}
// Test charAt for different strings.
« no previous file with comments | « test/cctest/test-strings.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698